Converting Turtle to RDF/XML
I wanted to experiment with converting my little test acronym file to Turtle or RDF and looked around and found a tool, RDF Validator and Converter on the rdf:about Web site run by Joshua Tauberer, that can in fact convert Turtle to raw XML/RDF. I tried it out with that simple Turtle example from my last blog post:
ex:animals rdf:type skos:Concept;
skos:prefLabel "animals".
But the validator complained that the "ex:" prefix was undefined. I went back to the SKOS Primer, and found that you define the prefixes with "@prefix", and you need that for the "ex:", "rdf:", and "skos:" prefixes, like so:
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix skos: <http://www.w3.org/2008/05/skos#>.
@prefix ex:<http://www.example.com/>.ex:animals rdf:type skos:Concept;
skos:prefLabel "animals".
The validator accepted that and informs me that the equivalent XML/RDF is:
<?xml version="1.0"?>
<rdf:RDF
xmlns:skos="http://www.w3.org/2008/05/skos#"
xmlns:ex="http://www.example.com/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<skos:Concept rdf:about="http://www.example.com/animals">
<skos:prefLabel>animals</skos:prefLabel>
</skos:Concept>
</rdf:RDF>
So, the core XML/RDF for that one SKOS concept is:
<skos:Concept rdf:about="http://www.example.com/animals">
<skos:prefLabel>animals</skos:prefLabel>
</skos:Concept>
The validator also tells me that there are two underlying triples here, one for the "Concept" and one for the "prefLabel":
<http://www.example.com/animals>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://www.w3.org/2008/05/skos#Concept> .
<http://www.example.com/animals>
<http://www.w3.org/2008/05/skos#prefLabel>
"animals" .
So, it actually is not so difficult, once somebody gives you a bunch of the clues.
Now on to converting my raw XML acronym test into Turtle.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home