RDFParser

trait RDFParser

Obtains data from an RDFReader

The approach is similar to parser combinators but instead of sequence of characters, we have RDF graphs available through an RDFReader

class Object
trait Matchable
class Any

Type members

Types

type Err = Throwable
type R[A] = Kleisli[IO, Config, A]
type RDFParser[A] = EitherT[R, Err, A]

An RDFParser of values of type a takes a pointed node RDFNode and an RDFReader and tries to obtain a value of type a

An RDFParser of values of type a takes a pointed node RDFNode and an RDFReader and tries to obtain a value of type a

Value members

Concrete methods

def anyOf[A](ps: RDFParser[A]*): RDFParser[Seq[A]]

Applies a list of parsers If a parser fails, it continues with the rest of the list

Applies a list of parsers If a parser fails, it continues with the rest of the list

Returns:

the list of successful values that can be parsed

def anyOfLs[A](ps: RDFParser[List[A]]*): RDFParser[Seq[A]]

Applies a list of parsers

Applies a list of parsers

Value parameters:
ps:

List of parsers. Each parser returns a list of values

def arc[A](pred: IRI, parser: RDFParser[A]): RDFParser[A]
def checkExpected(obtained: RDFNode, expected: RDFNode, n: RDFNode): RDFParser[Boolean]
def checkNil[A](n: RDFNode): RDFParser[List[A]]
def checkNodes[A](ns: Set[RDFNode], parser: RDFParser[A], n: RDFNode, pred: IRI): RDFParser[Option[A]]
def collect[A](ps: List[RDFParser[A]]): RDFParser[List[A]]
def combine[A](p1: RDFParser[Seq[A]], p2: RDFParser[Seq[A]]): RDFParser[Seq[A]]
def combineAll[A](ps: RDFParser[Seq[A]]*): RDFParser[Seq[A]]

Combine a sequence of RDFParsers

Combine a sequence of RDFParsers

Returns the Decimal literal associated with a predicate p

Returns the Decimal literal associated with a predicate p

Value parameters:
p

predicate

Returns:

An RDFParser that returns the decimal literal associated with that predicate

def failIf(cond: Boolean, msg: String): RDFParser[Unit]
def firstOf[A](ps: RDFParser[A]*): RDFParser[A]

If a parser fails, it continues with the rest of the list

If a parser fails, it continues with the rest of the list

Returns:

the result of the first parser that succeeds of failure

def fromEither[A](e: Either[Err, A]): RDFParser[A]
def fromEitherT[A](e: EitherT[IO, Err, A]): RDFParser[A]
def fromIO[A](x: IO[A]): RDFParser[A]
def fromRDFStream[A](r: Stream[IO, A]): RDFParser[Vector[A]]
def group[A](parser: RDFParser[A], nodes: Seq[RDFNode]): RDFParser[Seq[A]]

Applies a parser over a sequence of nodes

Applies a parser over a sequence of nodes

Value parameters:
nodes

sequence of nodes

parser

parser

Returns true if the current node does not have a given type

Returns true if the current node does not have a given type

Value parameters:
t

type to be checked

Returns true if the current node has a given type

Returns true if the current node has a given type

Value parameters:
t

type to be checked

Returns true if the current node has a type which belong to a given set of types

Returns true if the current node has a type which belong to a given set of types

Value parameters:
ts

set of types to be checked

Obtains an integer literal associated with a predicate in the current node

Obtains an integer literal associated with a predicate in the current node

Value parameters:
p

predicate

def io2r[A](x: IO[A]): R[A]
def lift[A](r: R[A]): RDFParser[A]
def liftIO[A](io: IO[A]): RDFParser[A]
def list1Plus[A](p: RDFParser[A]): RDFParser[List[A]]

Parses a list of values. The list must contain at least one value

Parses a list of values. The list must contain at least one value

def list1PlusAux[A](p: RDFParser[A], visited: List[RDFNode]): RDFParser[List[A]]
def list2Plus[A](p: RDFParser[A]): RDFParser[List[A]]

Parses a list of values. The list must contain at least two values

Parses a list of values. The list must contain at least two values

def mapRDFParser[A, B](ls: List[A], p: A => RDFParser[B]): RDFParser[List[B]]

RDFParser that retrieves the object associated with current node for a given predicate

RDFParser that retrieves the object associated with current node for a given predicate

Fails if there are more than one object

Value parameters:
p

predicate

RDFParser that retrieves the set of iriObjects associated with the current node for a given predicate

RDFParser that retrieves the set of iriObjects associated with the current node for a given predicate

Value parameters:
p

predicate

def ok[A](x: A): RDFParser[A]
def oneOf[A](parsers: Seq[RDFParser[A]]): RDFParser[A]

Checks that exactly one of the parsers succeeds on the current node

Checks that exactly one of the parsers succeeds on the current node

Value parameters:
parsers

sequence of parsers

def opt[A](pred: IRI, parser: RDFParser[A]): RDFParser[Option[A]]
def optional[A](parser: RDFParser[A]): RDFParser[Option[A]]

An RDF parser that parses a value of type a if possible

An RDF parser that parses a value of type a if possible

def parse[A](parser: RDFParser[A], node: RDFNode, rdf: RDFReader): IO[Either[Err, A]]
def parseFail[A](str: String): RDFParser[A]
def parseNodes[A](nodes: List[RDFNode], parser: RDFParser[A]): RDFParser[List[A]]
def parseOk[A](x: A): RDFParser[A]
def parsePredicate[A](p: IRI, maker: RDFNode => A): RDFParser[A]
def parsePredicateIRI[A](p: IRI, maker: IRI => A): RDFParser[A]
def parsePredicateIRIList[A](p: IRI, maker: IRI => A): RDFParser[List[A]]
def parsePredicateInt[A](p: IRI, maker: Int => A): RDFParser[A]
def parsePredicateIntList[A](p: IRI, maker: Int => A): RDFParser[List[A]]
def parsePredicateList[A](p: IRI, maker: RDFNode => A): RDFParser[List[A]]
def parsePredicateLiteral[A](p: IRI, maker: Literal => A): RDFParser[A]
def parsePredicateLiteralList[A](p: IRI, maker: Literal => A): RDFParser[List[A]]
def parsePredicateString[A](p: IRI, maker: String => A): RDFParser[A]
def parseRest[A](visited: List[RDFNode], restNode: RDFNode, parser: RDFParser[A]): RDFParser[List[A]]

A parser of the RDF List associated with the current node

A parser of the RDF List associated with the current node

Fails if there are more than one iriObjects associated with rdf_first or rdf_rest

Obtains the RDF list associated with a predicate for the current node

Obtains the RDF list associated with a predicate for the current node

Value parameters:
p

predicate

Obtains the RDF list associated with a predicate for the current node If there is no value, returns the empty list

Obtains the RDF list associated with a predicate for the current node If there is no value, returns the empty list

Value parameters:
p

predicate

def rdfNil[A]: RDFParser[List[A]]

Returns a parser that obtains the type associated with the current node

Returns a parser that obtains the type associated with the current node

Fails if there are more than one type associated

Returns a parser that obtains the set of types associated with the current node

Returns a parser that obtains the set of types associated with the current node

def sequenceEither[E, A](xs: List[Either[E, A]]): Either[E, List[A]]
def someOf[A](ps: RDFParser[A]*): RDFParser[A]

Checks if some of the parsers pass and returns the corresponding value

Checks if some of the parsers pass and returns the corresponding value

Value parameters:
ps

sequence of parsers

def star[A](pred: IRI, parser: RDFParser[A]): RDFParser[List[A]]
def starWithNodes[A](pred: IRI, parser: RDFParser[A]): RDFParser[List[(RDFNode, A)]]
def stream2list[A](st: Stream[IO, A]): IO[Vector[A]]

Returns the String associated with a predicate p

Returns the String associated with a predicate p

Value parameters:
p

predicate

Returns:

An RDFParser that returns the String associated with that predicate

def withNode[A](n: RDFNode, parser: RDFParser[A]): RDFParser[A]
def withRdf[A](rdf: RDFReader, parser: RDFParser[A]): RDFParser[A]