Copyright | Travis Whitaker 2016 |
---|---|
License | MIT |
Maintainer | [email protected] |
Stability | Provisional |
Portability | Portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Data.RDF.Graph
Description
This module provides conversion between RDF triples and fgl
graphs. Naturally
these functions will force the entire graph into memory.
- data GNode
- type GEdge = Predicate
- rdfGraph :: DynGraph g => RDFGraph -> (g GNode GEdge, NodeMap GNode)
- triplesGraph :: DynGraph g => [Triple] -> (g GNode GEdge, NodeMap GNode)
- graphRDF :: Graph g => Maybe IRI -> g GNode GEdge -> Either String RDFGraph
- graphTriples :: Graph g => g GNode GEdge -> Either String [Triple]
Documentation
An RDF Subject
or Object
as a Graph
node. This common
representation is necessary because the Object
of one Triple
might be
the Subject
of another.
Constructors
IRIGNode !IRI | |
BlankGNode !BlankNode | |
LiteralGNode !Literal |
Conversion to FGL Graphs
rdfGraph :: DynGraph g => RDFGraph -> (g GNode GEdge, NodeMap GNode) Source
Convert an RDFGraph
into a DynGraph
and NodeMap
. The graphLabel
is discarded.
triplesGraph :: DynGraph g => [Triple] -> (g GNode GEdge, NodeMap GNode) Source
Convert a list of Triple
s into a DynGraph
and a NodeMap
.
Conversion from FGL Graphs
graphRDF :: Graph g => Maybe IRI -> g GNode GEdge -> Either String RDFGraph Source
Convert a Graph
into an RDFGraph
. This will fail if the graph
contains any LiteralGNode
s with an outward degree greater than zero,
since such a graph is illegal in RDF.
graphTriples :: Graph g => g GNode GEdge -> Either String [Triple] Source
Convert a Graph
into a list of Triple
s. This will fail if the graph
contains any LiteralGNode
s with an outward degree greater than zero,
since such a graph is illegal in RDF.