ralphtq/elm-rdf/1.0.0

Rdf.Core.Types

Resource Description Framework (RDF) primitives for Elm. See https://www.w3.org/TR/rdf11-concepts/.

String aliases

These are convenient names for string values that carry RDF semantics in context.

type alias IRI =
String

An Internationalized Resource Identifier. See https://www.ietf.org/rfc/rfc3987.txt. Stringly typed for now.

type alias Prefix =
String

A CURIE prefix label (e.g. "qudt").

type alias BaseURI =
String

The base IRI of a named graph.

type alias GraphId =
String

Identifier for a named graph (typically its IRI).

type alias TermId =
String

An RDF resource identifier — IRI or blank-node id, depending on context.

type alias LangString =
String

A BCP 47 language tag (e.g. "en", "en-GB"). See http://tools.ietf.org/html/bcp47.

Prefix dictionaries

type alias PrefixDictionary =
Dict Prefix IRI

Maps prefix labels to their full IRI namespaces.

type alias InversePrefixDict =
Dict IRI Prefix

The inverse of PrefixDictionary: full IRI namespace to prefix label. Useful for CURIE shortening.

Quads and statements

type alias Quad =
{ subject : RDFnonLiteralTerm
, predicate : PredicateTerm
, object : RDFterm
, graph : QuadGraph
}

An RDF quad — a triple plus its containing graph.

type alias QuadStatement =
{ subject : RDFnonLiteralTerm
, predicate : PredicateTerm
, objects : List RDFterm
, graph : QuadGraph
}

Like Quad, but with a list of objects sharing the same subject and predicate. Convenient for display.

Terms

The RDF data model: a Quad is a {subject, predicate, object, graph} record. The subject is an RDFnonLiteralTerm (named node or blank node). The object can be any RDFterm.

type RDFterm
= NonLiteral RDFnonLiteralTerm
| Literal RDFliteralTerm
| Predicate PredicateTerm
| Graph QuadGraph

Any RDF term that can appear in object position.

= NamedNode IRI
| BlankNode BlankNodeId

A non-literal RDF term: a named node (IRI) or a blank node.

= LiteralString String (Maybe LangString)
| LiteralDataType String (Maybe DataType)

An RDF literal — either a plain or language-tagged string, or a typed literal with an optional DataType.

= PredicateNamedNode IRI

An RDF predicate. The wire model uses only named-node predicates.

= DefaultGraph
| QuadGraphNamedNode NamedNodeId

The graph component of a Quad.

= IRIid IRI

Wrapper around an IRI used for named-node graphs and as a future extension point for blank-node graphs.

Blank nodes

A blank node, identified by an opaque string id.

type alias BlankNodeId =
String

An opaque blank-node identifier.

blankNode : String -> BlankNode

Construct a blank node.

Extract the id of a blank node.

Aliases for clarity at call sites

Alias for the subject side of a triple.

Alias for the predicate side of a triple.

type alias RDFobject =

Alias for the object side of a triple.

type alias SubjectId =
TermId

Resource id used in the subject position.

type alias ClassId =
TermId

Identifier for an rdfs:Class.

type alias ClassList =
List ClassId

A list of class identifiers.

type alias QNameId =
String

A qualified name identifier (prefix:localName).

type alias QuadId =
String

Opaque identifier for a quad in a store.

Auxiliary types

= DataType IRI

A literal datatype IRI (e.g. xsd:integer).

= Known

Marker for an asserted triple.

= TypeKind

Discriminator for kinds of statements. Currently only TypeKind (rdf:type triples).

Smart constructors

iri : String -> IRI

Construct an IRI from a String. Identity at the value level; provided so callers can express intent at the type level.