zazuko/xrm

Serialise rdf/ttl with '@prefix'

Closed this issue · 2 comments

Rather smallish issue, nonetheless ... I have trouble running generated rml-maps in processors (namely SDM-RDFizer) because of the usage of the PREFIX directive. Would be helpful to have a @prefix directive for IRI namespaces, with a trailing dot .. All I see is, you're aligned with SPARQL, but the recomendation is to go with the "older" turtle-spec (https://www.w3.org/TR/turtle/#sec-iri).

Thank you for your feedback. Yes, currently we generate the SPARQLish way of PREFIX.

We will consider your proposal to generate @prefix instead, for better backwards compatibility with older turtle parsers.

As a workaround, you could run the generated turtle file thru rapper to have the prefix directives converted. http://librdf.org/raptor/INSTALL.html

$ rapper -i turtle -o turtle -O-  -q airport-mapping.rml.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix ex: <https://schema.example.org/> .
@prefix schema: <https://schema.org/> .
@prefix transit: <http://vocab.org/transit/terms/> .
@prefix wgs84_pos: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
...

Hi. Thanks for the hint to rapper, I didnt know that and did a bit of sed.