NAME
rdf/graph - RDF graph and dataset utility functions.
SYNOPSIS
from rdf/graph import rdf_graph_isomorphic, rdf_quads_union;
let combined := rdf_quads_union(left, right);
ok(rdf_graph_isomorphic(actual, expected));
DESCRIPTION
This module provides helpers for sorting, deduplicating, comparing, and rewriting arrays of RDF quads. Dataset helpers consider graph terms; graph helpers compare only default-graph quads.
EXPORTS
Functions
rdf_quad_key(RDFQuad quad)Returns a stable key for a quad.
rdf_quads_sort(Array quads)Returns quads sorted by
rdf_quad_key.rdf_quads_unique(Array quads)Returns sorted quads with duplicates removed.
rdf_quads_union(Array left, Array right)Returns the set union of two quad arrays.
rdf_quads_minus(Array left, Array right)Returns quads from
leftthat are not inright.rdf_quads_intersection(Array left, Array right)Returns quads present in both arrays.
rdf_quads_patch(Array quads, Array remove, Array add)Applies a remove/add patch and returns the resulting unique quads.
rdf_dataset_canonical_lines(Array quads)Returns canonical string lines for a dataset, including blank node renaming.
rdf_dataset_canonical_string(Array quads)Returns the canonical dataset string.
rdf_datasets_isomorphic(Array left, Array right)Returns true when two datasets are isomorphic.
rdf_graph_isomorphic(Array left, Array right)Returns true when the default graphs in two quad arrays are isomorphic.
rdf_relabel_blank_nodes(Array quads, Dict labels)Returns quads with blank node labels replaced according to
labels.rdf_stable_relabel_blank_nodes(Array quads, String prefix := "b")Relabels blank nodes deterministically by their original labels.
rdf_skolemize_blank_nodes(Array quads, String base := "urn:zuzu:rdf:skolem:")Replaces blank nodes with IRI terms under
base.
COPYRIGHT AND LICENCE
rdf/graph is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.