質問

I an RDF document in RDF/XML file that I want to convert into N-Triples. How can I convert it using Jena?

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:dc="http://purl.org/dc/elements/1.1/">
  <rdf:Description rdf:about="http://www.w3.org/2001/sw/RDFCore/ntriples/">
    <dc:creator>Art Barstow</dc:creator>
    <dc:creator>Dave Beckett</dc:creator>
    <dc:publisher rdf:resource="http://www.w3.org/"/>
  </rdf:Description>
</rdf:RDF>
役に立ちましたか?

解決

Read the file using "RDF/XML" mode and convert it using write function in "N-TURTLE" mode..

ie,

m.read(new FileInputStream (new File("yourfile")),"RDF/XML");

m.write(new FileOutputStream (new File("yourfile")) , "N-TRIPLE");

That's it.

他のヒント

According to my reading of this, you should be able to do it from the command line as follows:

    java com.hp.hpl.jena.rdf.arp.NTriple filename
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top