← All compilation units

Flyology_RDF.Triples

Description

Immutable RDF triples.

The predicate is typed as an IRI rather than a Term, so a literal or a blank node in predicate position is a compile error rather than a runtime check. Nothing here validates positions, because nothing can reach this package holding an invalid one.

"="

function "=" (Left, Right : Triple) return Boolean

Compare two triples componentwise.

Parameters
Left

First triple

Right

Second triple

Return value

True when all three components are equal

Create

function Create
  (Subject   : Terms.Term;
   Predicate : IRIs.IRI;
   Object    : Terms.Term) return Triple

Build a triple from its three components.

Parameters
Subject

Subject term

Predicate

Predicate IRI

Object

Object term

Return value

The corresponding triple

Object

function Object (Value : Triple) return Terms.Term

Return a copy of the object.

Parameters
Value

Triple to inspect

Return value

The object term

Object_View

function Object_View
  (Value : Triple) return not null access constant Terms.Term
Parameters
Value
Return value

Predicate

function Predicate (Value : Triple) return IRIs.IRI

Return a copy of the predicate.

Parameters
Value

Triple to inspect

Return value

The predicate IRI

Predicate_View

function Predicate_View
  (Value : Triple) return not null access constant IRIs.IRI
Parameters
Value
Return value

Query_Components

procedure Query_Components
  (Value   : Triple;
   Process : not null access procedure
     (Subject   : Terms.Term;
      Predicate : IRIs.IRI;
      Object    : Terms.Term))
Parameters
Value
Process

Subject

function Subject (Value : Triple) return Terms.Term

Return a copy of the subject.

Parameters
Value

Triple to inspect

Return value

The subject term

Subject_View

function Subject_View
  (Value : Triple) return not null access constant Terms.Term

Borrow all three components for the duration of Process.

Unlike the selectors above, this returns nothing by copy. On any path that runs once per statement, prefer it: the selectors each copy a whole term, and a term may be an arbitrarily deep quoted triple.

Parameters
Value

Triple to borrow from @param Process Callback receiving the three components Views of the components, valid while Value is.

Subject and the rest hand back a copy, and a term and an IRI are both reference counted, so a caller that only reads one still pays the bookkeeping the runtime wraps a controlled operation in. These lend the component where it lives.

Triple to view

Return value

The component

Triple

type Triple is private;

An immutable RDF triple.