Turn elm values into Graph's. This is what
Json.Encode
is for JSON values. Since generating RDF graphs potentially requires minting
(local) names for blank nodes, you first have to create an
Encoder and then turn this into an Graph by feeding it into
encode with a Seed.
Run an Encoder. You have to provide a Seed which is used
for minting unique blank node identifiers. The function encode returns the
RDF graph as well as an updated Seed which you should use for further
encoding or parsing of RDF graphs to ensure you don't get blank node identifier
clashes.
Encode a node, for which we already have a name, alongside some properties where the node is the subject.
Encode a new blank node alongside some properties where the node is the subject. This will mint a new blank node identifier under the hood.
This works like node but returns a PropertyEncoder. You can
use this if you are deep in a tree of encoders and have to encode
a different/detached part of the graph.
This works like blankNode but returns a PropertyEncoder.
You can use this if you are deep in a tree of encoders and have to encode
a different/detached part of the graph.
Encode a property by providing an IRI of property path and an object. The current focus node will be the subject.
Encode a single RDF term.
import Rdf exposing (iri, a)
import Rdf.Graph exposing (initialSeed, serializeTurtle)
blankNode
[ property a (term (iri "http://example.org#Person")) ]
|> encode initialSeed
|> Tuple.first
|> serializeTurtle
|> String.lines
--> [ "_:2273e9c9-fa2d-4c28-ae87-947ad36cbecd"
--> , " a <http://example.org#Person> ."
--> ]An Encoder which can be fed into encode to produce an RDF graph.
This type will only be used as the argument of functions.
An Encoder which encodes an RDF property.
This type will only be used as the argument of functions.
An Encoder which encodes an RDF term.
This type will only be used as the argument of functions.
This type will only be used as the argument of functions.
An Encoder which encodes an RDF graph or an RDf term.
You can ignore this type, it is only used for implementing the different
Encoder variants.
A value which knows how to encode an Elm value into an RDF graph.
The
compatibletype variable is used to ensure that certain instances of anEncodercan only be used in the right context.