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:
Extension | Default MIME type | Representation |
---|---|---|
jsonld | application/ld+json | JSON |
n3 | text/n3 | binary |
nq | application/n-quads | binary |
nt | application/n-triples | binary |
rdf | application/rdf+xml | XML |
rj | application/rdf+json | JSON |
rq | application/sparql-query | text |
srj | application/sparql-results+json | JSON |
srx | application/sparql-results+xml | XML |
thrift | application/rdf+thrift | binary |
trig | application/trig | binary |
trix | application/trix+xml | XML |
ttl | text/turtle | binary |
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