semantalytics / xsparql

14 stars 4 forks source link

how to preserve BASE? #42

Open VladimirAlexiev opened 8 months ago

VladimirAlexiev commented 8 months ago

I want to use relative URLs for my subjects (who doesn't!). However:

XSPARQL just ignores them and doesn't output @base.

I post-process the output with this pipeline in Makefile:

%.ttl: xsparql.xsparql %.xml
    xsparql xsparql.xsparql input=$*.xml -f TEMP.ttl > /dev/null
     riot --syntax ttl --formatted ttl --base "..." TEMP.ttl |\
     perl -00e '@a=<>; print shift @a; print sort @a' > $*.ttl
    rm TEMP.ttl

It pretty-prints with riot while specifying the base, then finally sorts by "paragraph" (turtle clause)