Reputation: 171
Am trying to parse a simple rdf file using InputStream. I will have a huge file to read, so I need to reading it from input stream.
My code :
public static void main(String args[]) throws Exception{
String file = "/Users/rdf_files/testRDF.rdf";
InputStream in = new FileInputStream(file);
if (in == null) {
System.out.println("file not found");
}
Model model = ModelFactory.createDefaultModel();
model.read(in, null);
model.write(System.out);
System.out.println("read the file");
}
My file :
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cd="http://www.recshop.fake/cd#">
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Empire Burlesque">
<cd:artist>test 1</cd:artist>
<cd:country>USA</cd:country>
<cd:company>Columbia</cd:company>
<cd:price>10.90</cd:price>
<cd:year>1985</cd:year>
</rdf:Description>
<rdf:Description
rdf:about="http://www.recshop.fake/cd/Hide your heart">
<cd:artist>test 2</cd:artist>
<cd:country>UK</cd:country>
<cd:company>CBS Records</cd:company>
<cd:price>9.90</cd:price>
<cd:year>1988</cd:year>
</rdf:Description>
</rdf:RDF>
I am getting exception like :
java.lang.ClassNotFoundException: com.ibm.icu.text.StringPrepParseException
Can anyone tell me what am doing wrong?
Upvotes: 1
Views: 300
Reputation: 1
slm, Ihad the same problem and i fixed it by adding "com.ibm.icu_3.4.4.1.jar" to my classPath i hope that this can help you :)
Upvotes: 0