This module defines the Graph type which models an RDF
graph, and helper
functions for building, updating, parsing, and serializing these. Take a look
at the Rdf.Decode module if you want to extract Elm values from
a Graph. On the other hand, the Rdf.Encode module
deals with conveniently building these Graph's.
Create an RDF graph which only contains one triple.
Parse an N-Triples file. This function will keep blank node identifiers.
Note: Since every N-Triples file is also a valid Turtle file, you can also
use fromTurtle instead of this function. But if you know that you are dealing
with N-Triples files it is still better to use fromNTriples since
Seed's, andParse a Turtle or
N-Triples file and put all RDF triples into
a Graph. This function will keep blank node identifiers and only
mint new ones if they are not given in the original. For minting it uses the
provided Seed. Make sure to reuse the returned Seed
in subsequent calls to avoid blank node identifier collisions. You can use
Rdf.initialSeed and
Rdf.seedGenerator to get a seed.
This is like fromTurtle but you can also specify the
initial base IRI.
You get one of these if parsing fails.
Turn an Error into a more human friendly error message.
A JSON decoder for decoding a Graph from a JSON value according
to the RDFJS Specification.
Encode a Graph into a JSON value according to the RDFJS
Specification.
Run a Decoder on an actual Graph. Make sure
to anchor your decoder using from,
fromSubject, or at.
Insert an RDF triple into the Graph.
Insert a property into the graph. If you provide a property path which does
not just consist of a single IRI (or its inverse), intermediate blank nodes
will be minted using the provided Seed.
Create a new graph by replacing all occurances of the first term with the second term.
Return the current base declaration.
Set the base declaration to the provided URL.
Remove the base declaration.
Return all defined prefix declarations.
Add one prefix declaration to the Graph. An existing
declaration with the same name will be overwritten.
Add some prefix declarations to the Graph. Existing prefixes
with the same name will be overwritten.
Remove all prefix declarations.
Merge two Graph's into one.
Important: This will not mint new blank node identifiers, so you might get
unwanted identifier collissions. Take a look at
mintBlankNodes for a safer approach.
Serialize a Graph into the
Turtle format. Take a look at the Base and
prefixes section for functions to adjust the
serialization.
This type represents an RDF Graph.