General Notes about RDF Support

RDF support is built on top of the Apache Jena libraries.

Jena supports many formats for reading, writing, and storing RDF data. These are exposed in XML Calabash with additional content types. When the RDF extensions are enabled, the following additional MIME type mappings are enabled by default:

Table 1Additional MIME type mappings
ExtensionDefault MIME typeRepresentation
jsonldapplication/ld+jsonJSON
n3text/n3binary
nqapplication/n-quadsbinary
ntapplication/n-triplesbinary
rdfapplication/rdf+xmlXML
rjapplication/rdf+jsonJSON
rqapplication/sparql-querytext
srjapplication/sparql-results+jsonJSON
srxapplication/sparql-results+xmlXML
thriftapplication/rdf+thriftbinary
trigapplication/trigbinary
trixapplication/trix+xmlXML
ttltext/turtlebinary

These additional content types effect the behavior of p:load, p:document, and p:cast-content-type.

Loading RDF

When RDF is enabled, p:load and p:document can read any of the RDF content types. When the underlying content types are XML or JSON, that’s what is passed through the pipeline. For all other content types, including the text ones, what is passed through the pipeline is a binary representation of the graph, an application/rdf+thrift document.

The application/rdf+thrift format is an efficient representation suitable for queries.

Casting RDF media types

When RDF is enabled, the p:cast-content-type step will cast between any of the RDF content types.

It will also cast from the SPARQL result formats to text/plain.

Dependencies

These steps are included in the XML Calabash application. If you are getting XML Calabash from Maven, you will also need to include the extension dependency:

  • com.xmlcalabash:rdf:3.0.0-alpha24

The following third-party dependencies will also be included transitively:

  • org.apache.jena:jena:5.3.0
  • org.apache.jena:jena-arq:5.3.0
  • org.apache.jena:jena-core:5.3.0
  • org.apache.jena:jena-iri:5.3.0
  • org.semarglproject:semargl-core:0.7
  • org.semarglproject:semargl-rdfa:0.7