You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Grant Pax <gr...@fwep.twostewards.com> on 2014/12/30 23:44:35 UTC

convert catalog.xml to location-mapping.n3

I’ve searched and cannot find a full script. I’ve used rdfcat to get it from xml to n3 but it’s still a mess. Anyone done this?

Fwd: convert catalog.xml to location-mapping.n3

Posted by Grant Pax <gr...@fwep.twostewards.com>.
So I brute-forced the solution…

rdfcat -x catalog-v001.xml -out n3|sed -Ef owlcat2locmap.pat > location-mapping.n3

where .pat file contains…

/WARN/d
s/\@prefix :/\@prefix lm:/
s|<urn:oasis:names:tc:entity:xmlns:xml:catalog>|<http://jena.hpl.hp.com/2004/08/location-mapping#>|
s/\[ *a *:catalog *;/\[\] lm:mapping/
/<prefer>/d
/:group/,/\] \;/d
/Imports Wizard Entry/d
s/\] ;/] ,/
s/\] \././
s/ *<name> *(".*")/  [ lm:name \1/
s| *<uri> *"(.*)"|     lm:altName "./\1” |

It ain’t pretty but it works for me. YMMV. 

> Begin forwarded message:
> 
> From: Grant Pax <gr...@fwep.twostewards.com>
> Subject: convert catalog.xml to location-mapping.n3
> Date: December 30, 2014 at 5:44:35 PM EST
> To: "users@jena.apache.org" <us...@jena.apache.org>
> 
> I’ve searched and cannot find a full script. I’ve used rdfcat to get it from xml to n3 but it’s still a mess. Anyone done this?