jena

malformed sparql delete query

﹥>﹥吖頭↗ 提交于 2019-12-25 18:38:23
问题 I would like to update a data property assertion using sparql, but I get the malformed query exception at the delete statement when I try to run this in Protege. I'm very new to sparql and I can't figure out what's wrong with this query : PREFIX m: <http://www.semanticweb.org/exemple#> DELETE { ?o owl:minQualifiedCardinality ?min. } INSERT { ?o owl:minQualifiedCardinality “2000”^^xsd:decimal. } WHERE { m:Revenu rdfs:subClassOf ?o. ?o owl:minQualifiedCardinality ?min. } 回答1: Have a look at

Can't get any results from this SPARQL query

我怕爱的太早我们不能终老 提交于 2019-12-25 18:28:44
问题 I've asked a question before here Generate an incremental SPARQL query and thank god I manage to solve it. Here is my solution: private String completeQuery(String coreQuery){ String completeQuery = ""; completeQuery += "SELECT * WHERE {"+ "\n"; completeQuery += coreQuery + "\n"; completeQuery =completeQuery + "}" + "\n" +"limit 5" ; return completeQuery; } public String link(String object1, String object2, int distance){ if(distance == 1){ String Quer = "<http://dbpedia.org/resource/"

'FILTER NOT EXISTS ' operator is not working with apache jena?

被刻印的时光 ゝ 提交于 2019-12-25 18:19:15
问题 Here my sparql query code is to find Least Common Subsumer and output of query must be 'A'. I am getting blank result here. I think my query is right but seems to be Apache Jena's "filter not exists" is not working. I have also checked with other example. Is there any alternative solution of "filter not exists" or shall i need to modify my java code for that? OWL file structure Thing: | A |_P(p1,p2) |_M(m1,m2) | B Here A,P,M and B are the concepts. p1,p2,m1 and m2 are the instances. M is

empty ResultSet on second query (despite valid results with first)

岁酱吖の 提交于 2019-12-25 18:13:12
问题 public class MainClass { public static void main(String[] args) { MainClass c = new MainClass(); c.getType("m.012x34"); System.out.println("---------------"); MainClass c1 = new MainClass(); c1.getType("m.012x34"); } public String getType(String mid){ String Type = null; try{ InputStream inputStream = null; Resource resource = null; File automake_triples = new File(".\\automake_triples.ttl"); ArrayList<String> products = new ArrayList<String>(); InputStream in = new FileInputStream(automake

Jena for java 1.7

断了今生、忘了曾经 提交于 2019-12-25 16:25:07
问题 Is there any version compatible with java 1.7v in Jena I'm getting following error and i think it is because of incompatibility Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/jena/query/QueryFactory : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass

Bind function in SPARQL with Jena API

℡╲_俬逩灬. 提交于 2019-12-25 12:48:08
问题 I use jena for android to send a query to DBpedia. This is my query: protected Vector<List> doInBackground(String... keyword) { VecDBpedia=new Vector(); vecurl= new ArrayList(); int i=0; ResultSet results,re = null ; QueryExecution exec = null ; try{ do{ if(i!=VectorKeyWords.size()) {System.out.println(keyword[i]); String sparqlQuery= "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" + "PREFIX dbo: <http://dbpedia.org/ontology/>\n" + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf

Can't read Protege ontology in Jena

我怕爱的太早我们不能终老 提交于 2019-12-25 07:26:05
问题 I'm new to onotlogy and Java. I learn it now and have some theoretical knowledge. I use "apache-jena-3.1.0" in Eclipse and Protege editor 5.0.0 beta 23. First of all, I created a simple ontology in Jena. Something like that: public static void main(String[] args) { OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM); ... OntClass gen1 = m.createClass(st + "Generation_1"); OntClass gen2 = m.createClass(st + "Generation_2"); ... ObjectProperty hasParent = m.createObjectProperty

Stardog data loading and Jena

☆樱花仙子☆ 提交于 2019-12-25 06:28:55
问题 I am using Stardog to store a bunch of triples that come from different sources. I use Jena to collect and merge the data in a single Jena graph. All these triples are part of ABoxes. I am not sure Stardog will require that the TBox is also merged with the ABox graphs. I supposed it does because otherwise I cannot see how Stardog will do reasoning over the data. I have not seen any option to store and use the TBox apart as in some others triple stores. Do I need to include the TBox in the

Stardog data loading and Jena

有些话、适合烂在心里 提交于 2019-12-25 06:27:10
问题 I am using Stardog to store a bunch of triples that come from different sources. I use Jena to collect and merge the data in a single Jena graph. All these triples are part of ABoxes. I am not sure Stardog will require that the TBox is also merged with the ABox graphs. I supposed it does because otherwise I cannot see how Stardog will do reasoning over the data. I have not seen any option to store and use the TBox apart as in some others triple stores. Do I need to include the TBox in the

Loading a .trig file into TDB?

霸气de小男生 提交于 2019-12-25 04:07:03
问题 I am currently writing some code in Java, using Jena and TDB -- on a Windows 7. I want to be able to load a (large) .trig file into TDB Dataset so that querying is a bit faster. The code that I currently have is: Dataset dataset = TDBFactory.createDataset(directoryPath); Model tdb = dataset.getDefaultModel(); RDFDataMgr.read(tdb, inputFilePath); try { String theQuery = readFile(testQueryPath, Charset.defaultCharset()); Query query = QueryFactory.create(theQuery); QueryExecution qe =