I'm using Jena to import a skos thesaurus and it doesn't work

rolf2

New Member
I would like to import a skos (rdf/xml) thesaurus in Jena model. The skos thesaurus is available in http://www.culturaitalia.it/pico/thesaurus/4.2/thesaurus_4.2.0.skos.xml. I copied that to a local file (in picoFileName) and I used this code to import it in a Model:\[code\] ... pico = ModelFactory.createDefaultModel(); InputStream in = FileManager.get().open(picoFileName); if (in == null) { throw new IllegalArgumentException( "File: " + picoFileName + " not found"); } pico.read(new InputStreamReader(in), ""); ... \[/code\]I receive this error:\[code\]Exception in thread "main" com.hp.hpl.jena.shared.JenaException: org.xml.sax.SAXParseException: Content is not allowed in prolog.at com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler.fatalError(RDFDefaultErrorHandler.java:60)at com.hp.hpl.jena.rdf.arp.impl.ARPSaxErrorHandler.fatalError(ARPSaxErrorHandler.java:51)at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.warning(XMLHandler.java:211)at com.hp.hpl.jena.rdf.arp.impl.XMLHandler.fatalError(XMLHandler.java:241)at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)at com.hp.hpl.jena.rdf.arp.impl.RDFXMLParser.parse(RDFXMLParser.java:155)at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:173)at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:160)at com.hp.hpl.jena.rdf.arp.JenaReader.read(JenaReader.java:199)at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:229)at it.etc.rdf.LodWithPico.<init>(LodWithPico.java:24)at it.etc.rdf.TestLodWithPico.main(TestLodWithPico.java:6) Caused by: org.xml.sax.SAXParseException: Content is not allowed in prolog.at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)... 18 more\[/code\]The skos thesaurus is validated in w3c rdf/xml validator and in skos validator. What is wrong?
 
Back
Top