Encode a node, for which we already have a name, alongside some properties where the node is the subject.
import Rdf
import Rdf.Graph as Graph
node (Rdf.blankNode "alice")
[ property (Rdf.iri "http://example.org/hasName")
(term (Rdf.string "Alice"))
]
|> encode Rdf.initialSeed
|> Tuple.first
|> Graph.toTurtle
|> String.lines
--> [ "_:alice"
--> , " <http://example.org/hasName> \"Alice\" ."
--> ]
import Rdf
import Rdf.Graph as Graph
node (Rdf.blankNode "alice") []
|> encode Rdf.initialSeed
|> Tuple.first
|> Graph.toTurtle
--> ""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.
import Rdf
import Rdf.Graph as Graph
blankNode
[ property (Rdf.iri "http://example.org/hasName")
(term (Rdf.string "Alice"))
]
|> encode Rdf.initialSeed
|> Tuple.first
|> Graph.toTurtle
|> String.lines
--> [ "_:2273e9c9-fa2d-4c28-ae87-947ad36cbecd"
--> , " <http://example.org/hasName> \"Alice\" ."
--> ]
import Rdf
import Rdf.Graph as Graph
blankNode []
|> encode Rdf.initialSeed
|> Tuple.first
|> Graph.toTurtle
--> ""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, initialSeed)
import Rdf.Graph exposing (toTurtle)
blankNode
[ property a (term (iri "http://example.org#Person")) ]
|> encode initialSeed
|> Tuple.first
|> toTurtle
|> 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.