ddn.odf.rdf

ODF RDF-based metadata support (ODF 1.2+).

Parses and serialises RDF/XML content found in ODF packages (e.g. manifest.rdf). Provides typed access to RDF triples, graphs, and metadata collections conforming to ODF 1.2 Part 1 Section 4.2 and ODF 1.3 extensions.

RDF constructs

  • OdfRdfTriple represents a subject-predicate-object triple
  • OdfRdfGraph groups triples into named graphs
  • parseRdf() extracts triples from RDF/XML content
  • serializeRdf() produces well-formed RDF/XML output
  • Round-trip preservation of unknown RDF elements and attributes

Limitations:

  • Only XML-based RDF serialisation is supported (not Turtle or N-Triples)
  • OWL ontology reasoning is not provided

Types 4

The kind of object carried by an RDF triple.

LITERAL
URI
BLANK_NODE

A single RDF triple consisting of subject, predicate, and object.

Fields
string subject
string predicate
string object_
OdfRdfObjectType objectType

An RDF graph containing a set of triples and an optional base URI.

Fields
OdfRdfTriple[] triples
string baseUri

A collection of RDF graphs extracted from an ODF package.

Fields
OdfRdfGraph[] graphs

Functions 12

fnOdfRdfMetadata parseRdfXml(const(ubyte)[] xmlBytes)Parses RDF/XML content from raw bytes (e.g. from `manifest.rdf`).
fnOdfRdfMetadata parseRdfXmlString(string xml)Parses RDF/XML content from a string.
fnstring serializeRdfXml(const ref OdfRdfMetadata metadata)Serialises RDF metadata back to an RDF/XML string.
fnOdfRdfTriple[] findTriples(const ref OdfRdfMetadata metadata, string predicate)Finds all triples matching the given predicate across all graphs.
fnOdfRdfTriple[] findTriplesBySubject(const ref OdfRdfMetadata metadata, string subject)Finds all triples matching the given subject across all graphs.
fnOdfRdfMetadata addTriple(ref OdfRdfMetadata metadata, string subject, string predicate, string object_, OdfRdfObjectType objectType = OdfRdfObjectType.LITERAL)Adds a triple to the first graph in the metadata, creating a default graph when none exists.
fnOdfRdfMetadata dublinCoreToRdf(const ref OdfMetadata metadata)Converts Dublin Core metadata from OdfMetadata to RDF triples.
fnvoid rdfToDublinCore(const ref OdfRdfMetadata rdf, ref OdfMetadata metadata)Reads Dublin Core triples from RDF metadata into OdfMetadata.
fnvoid parseDescription(XmlElement desc, ref OdfRdfGraph graph)
fnstring escapeAttr(string s) @safe pure
fnstring escapeText(string s) @safe pure
fnstring escapeXmlName(string s) @safe pure

Variables 1

enumvarRDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"

RDF namespace URI used in ODF RDF/XML manifests.