jena programming error while reading from an input file .rdf.......Please guide me
package sample;
import java.io.InputStream;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.util.FileManager;
public class ReadRDF extends Object {
static final String fileName = "foaf-ijd.rdf";
public static void main(String[] args) {
Model model = ModelFactory.createDefaultModel();
InputStream in = FileManager.get().open(fileName);
if (in == null) {
throw new IllegalArgumentException("File: " + fileName
+ " not found");
}
model.read(in, "");
model.write(System.out);
}
}
Errors getting populated
Exception in thread "main" java.lang.NoSuchMethodError: org.slf4j.Logger.isTraceEnabled()Z at com.hp.hpl.jena.util.LocatorFi开发者_JAVA技巧le.open(LocatorFile.java:118) at com.hp.hpl.jena.util.FileManager.openNoMapOrNull(FileManager.java:527) at com.hp.hpl.jena.util.FileManager.openNoMap(FileManager.java:510) at com.hp.hpl.jena.util.LocationMapper.initFromPath(LocationMapper.java:132) at com.hp.hpl.jena.util.LocationMapper.get(LocationMapper.java:61) at com.hp.hpl.jena.util.FileManager.makeGlobal(FileManager.java:116) at com.hp.hpl.jena.util.FileManager.get(FileManager.java:82) at sample.ReadRDF.main(ReadRDF.java:17)
This error can apper, if you don't add to CLASSPATH
all jar file from /lib
dir in Jena ditrib.
Also, if version's slf4j
, which you use, an d jena's slf4j is differenf, this error can appear.
精彩评论