XTriples
A generic webservice to extract RDF statements from XML resources.
Quickstart
With the XTriples webservice you can crawl XML repositories and extract RDF statements using a simple configuration based on XPATH/XQuery expressions. The webservice can be used with direct POST, form-style POST or GET requests.
Example
Form-style POST requests
Example for the form-style POST API. Set your output format, input your configuration and submit the form.
Direct POST requests
You can also submit direct POST requests to https://xtriples.lod.academy/extract.xql
The request body should contain your XTriples configuration. Additionally, you need to send the Content-Type
HTTP header with a value of application/xml
and the format
HTTP header with one of the following values:
value | result |
---|---|
rdf | returns extraction result as RDF |
turtle | returns extraction result in Turtle notation |
ntriples | returns extraction result as N-Triples |
nquads | returns extraction result as N-Quads |
trix | returns extraction result as TriX named graph |
json | returns extraction result as JSON-LD |
svg | returns extraction result as SVG Graph |
xtriples | returns extraction result as XTriples XML for debugging purposes |
If you send no format header, the format defaults to rdf.
GET requests
The most compact way to use the service is with HTTP GET requests. This is the URL scheme:
https://xtriples.lod.academy/extract.xql?configuration=###YOUR_URI###&format=###FORMAT_KEYWORD###
The keywords for the format parameter are the same as for direct POST requests (see above).
Configuration Template
This is the basic structure of a XTriples configuration:
<xtriples> <configuration> <vocabularies> <vocabulary prefix="###MY_NAMESPACE_PREFIX###" uri="###MY_NAMESPACE_URI###"/> <vocabulary prefix="rdf" uri="http://www.w3.org/1999/02/22-rdf-syntax-ns#"/> </vocabularies> <triples> <statement> <subject prefix="###MY_NAMESPACE_PREFIX###">###XPATH###</subject> <predicate prefix="rdf">about</predicate> <object type="literal">###XPATH###</object> </statement> </triples> </configuration> <collection uri="###MY_COLLECTION_URI###"> <resources uri="{###XPATH###}"/> </collection> </xtriples>
Read about all configuration details in the documentation...
Design principles
- Generic - works on any XML
- Simple - easy to configure
- Powerful - for building complex statements
- Flexible - returns several formats
- RESTful - uses http for request and response
Documentation
Check out the documentation with all configuration details. If you would like to create your own instance of this service you can clone the repository on GitHub or download a prebuilt eXist-db XAR package right here.
Credits
The XTriples webservice was originally developed during the digital humanities research project IBR - Inscriptions in their spatial context (2012-2015). The project was jointly conducted by the Academy of Sciences and Literature | Mainz and the Institute for Spatial Information and Surveying Technology i3Mainz - University of Applied Sciences. It was funded by the German Federal Ministry of Education and Research.