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 <[email protected]>
> Subject: convert catalog.xml to location-mapping.n3
> Date: December 30, 2014 at 5:44:35 PM EST
> To: "[email protected]" <[email protected]>
> 
> 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?

Reply via email to