0
我試圖按照basic tutorial從Apache Jena的網站創建基本的RDF。Apache Jena Intro RDF:NoSuchMethodError getIfPresent()
String personURI = "http://somewhere/JohnSmith";
String fullName = "John Smith";
Model model = ModelFactory.createDefaultModel();
Resource johnSmith = model.createResource(personURI);
johnSmith.addProperty(VCARD.FN, fullName);
我將3.0.1 Jena依賴項添加到我的pom.xml中,運行代碼時只發現它輸出了異常。
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.jena.atlas.lib.Cache.getIfPresent(Ljava/lang/Object;)Ljava/lang/Object;
at org.apache.jena.enhanced.EnhGraph.getNodeAs(EnhGraph.java:133)
at org.apache.jena.rdf.model.impl.IteratorFactory.asResource(IteratorFactory.java:71)
at org.apache.jena.rdf.model.impl.IteratorFactory.asResource(IteratorFactory.java:62)
at org.apache.jena.rdf.model.impl.ModelCom.getResource(ModelCom.java:888)
at org.apache.jena.rdf.model.impl.ModelCom.createResource(ModelCom.java:1338)
at com.lymba.proposal.summarizer.core.rdf.TestRdf.testRdf(TestRdf.java:15)
at com.lymba.proposal.summarizer.core.rdf.TestRdf.main(TestRdf.java:21)
爲什麼基本的例子會給我這個輸出?它直接從教程中複製。