This module defines the Graph type which models an RDF
graph,
and helper functions for building, updating, parsing, serializing these. Take
a look at the Rdf.Graph.Decode module if you want to extract Elm values from
a Graph. On the other hand, the Rdf.Graph.Encode module deals with
conveniently building these Graph's.
Create an empty RDF graph.
Create an RDF graph which only contains one triple.
Convert a list of RDF triples into an RDF graph.
Like fromTriples, this converts a list of RDF triples
into an RDF graph, while also minting new blank node identifiers using the
provided Seed. This can be useful if you plan to merge multiple
graphs with union and need to ensure that there are no identifiers
used twice.
A Seed is used to mint unique blank node identifiers. Functions like
parseSafe, fromTriplesSafe, or
generateBlankNode take a Seed and then return an
updated one. You should always use the returned Seed in subsequent calls to
ensure that you don't get blank node identifier collisions.
A fixed Seed. This is useful for tests. For actual application
code, take a look at seedGenerator.
A Random.Generator for generating a random Seed.
Parse 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.
Important: For minting the initialSeed is being used.
Therefore, you will probably get identificer clashes when parsing multiple
graphs and combining them later. It is usually better to use
parseSafe instead.
Parse 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 get one of these if parsing fails.
Turn a 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.
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 blank node with a freshy minted identifier using the provided
Seed.
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 the Base and
prefixes section to adjust the serialization.
This type represents an RDF Graph.