jena

Can SPARQL (Jena) UPDATEs be parameterized by collections of literals (instead of literals)?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 09:56:32
问题 Can I call a parameterized SPARQL UPDATE (as in Jena's ParameterizedSparqlString ) to set a property to several e.g. literal values? For instance, I have: Set<String> object = new HashSet<String>(Arrays.asList("literal1", "literal2")); and would like to use a SPARQL update such as: INSERT { [] property ?object } WHERE {} to build these RDF statements: _:SUBJECT property "literal1" . _:SUBJECT property "literal2" . Does Jena support this kind or parametrization (the signature of

How to get nested RDF/XML from Jena?

混江龙づ霸主 提交于 2019-12-10 04:38:57
问题 I need to create RDF that looks like this: <rdf:Description rdf:about='uri1'> <namespace:level1> <rdf:Description> <namespace:blankNode rdf:resource='uri2'/> <namespace:text></namespace:text> </rdf:Description> </namespace:level1> </rdf:Description> <rdf:Description rdf:about="uri2"> some properties here </rdf:Description> As you can see, there are nested structures, as well as blank nodes. (I don't know if that's the exact terminology for the "blankNode" property in my structure.) If I use

Using jena for creating RDF from XMl file [duplicate]

橙三吉。 提交于 2019-12-09 01:16:27
This question already has answers here : Closed 7 years ago . Possible Duplicate: create RDF from XML I am sorry for asking this question for the second time, I am still still having problem in generating rdf from the following xml file. <xml> <person> <name>Joe</name> <website url="www.example1.com">contact1</website > <vote>20</vote> </person> <person> <name>Anna</name> <website url="www.example2.com">contact2</website> <vote>80</vote> </person> </xml> I think using jena might solve the issue , but I am not sure how to do so, since each has got three properties and I would like the out put

Error when I load RDF triples in TDB Triple Store

杀马特。学长 韩版系。学妹 提交于 2019-12-08 14:48:49
问题 I have a question for you: I have loaded my file RDF in TDB Triple Store: Dataset dataset = TDBFactory.createDataset(directory); Model model = dataset.getNamedModel("http://nameFile"); TDBLoader.loadModel(model, file ); Now, I would like to realize a procedure which checks whether the graph is on the Triple Store or not. I have written this code: String queryStr = "select * {graph <http://nameFile> { ?s ?p ?o }}"; Dataset dataset = TDBFactory.createDataset(directory); Query query =

rdf using apache jena on net beans

£可爱£侵袭症+ 提交于 2019-12-08 11:40:38
问题 I want to create a simple RDF graph and then try simple querying using SPARQL. Since I'm familiar with java and net beans, I want to use Apache Jena on NetBeans. I downloaded the related files from http://www.apache.org/dist/jena/ . What should I do next to write RDF codes on net beans? i.e Should I install something or add lib files/jar files somewhere? 回答1: (Too long for a comment on Ian's reply) Maven is easy on netbeans, and a good way to get started with everything you need (as Ian says)

Unexpected NullPointerException while accessing results of a query [duplicate]

偶尔善良 提交于 2019-12-08 11:03:37
问题 This question already has an answer here : DBpedia Jena Query returning null (1 answer) Closed 6 years ago . I have this code and I don't understand why I'm getting a NullPointerException: public static ArrayList<String> retrieveObject(String istance,String property){ String sparqlQueryString= "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf- syntax-ns#> "+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "+ "PREFIX dbpedia: <http://dbpedia.org/resource/> "+ "PREFIX o: <http://dbpedia.org

Using jena for creating RDF from XMl file [duplicate]

♀尐吖头ヾ 提交于 2019-12-08 09:48:03
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: create RDF from XML I am sorry for asking this question for the second time, I am still still having problem in generating rdf from the following xml file. <xml> <person> <name>Joe</name> <website url="www.example1.com">contact1</website > <vote>20</vote> </person> <person> <name>Anna</name> <website url="www.example2.com">contact2</website> <vote>80</vote> </person> </xml> I think using jena might solve the

how to associate a resource to an other using Jena API

六月ゝ 毕业季﹏ 提交于 2019-12-08 09:00:26
问题 I have created an ontology containing two classes, the first one is named Father and the second is a subclass named Son . I would like to set the following conditions to the class father using Jena Has only son. Has some son. Then I would do the same for class Son : has exactly some father. My second issue is that I don't know how to associate the instance of class Son to the class Father using also Jena. I know it's possible to manipulate my classes using Protégé, but I want to explore Jena.

Fuseki config for 2 datasets + text index : how to use turtle files?

…衆ロ難τιáo~ 提交于 2019-12-08 06:09:20
问题 I'm new to fuseki and want to use 2 TDB datasets for our project : a small one for our own data, and a large one (168 M triples, imported data from http://data.bnf.fr). We need to index the data because SPARQL queries using "FILTER(CONTAINS())" don't work on the large dataset ("BnF_text"). Therefore, I've built a text index for "BnF_text", following this post : Fuseki indexed (Lucene) text search returns no results (but I had to modify the turtle config file to get the text:query working). It

Adding more individuals to existing RDF ontology

风格不统一 提交于 2019-12-08 05:46:18
问题 I have a RDF ontology which is about 20MB. I tried to add individuals as in the below code. FileManager.get().addLocatorClassLoader(RDFWriter.class.getClassLoader()); OntModel model = ModelFactory.createOntologyModel(OntModelSpec.RDFS_MEM_RDFS_INF); model.read("Ontology/LocationOntology_New2.owl"); String preFix = "LocationOntology_New.owl#"; OntClass Region = model.getOntClass(preFix+"Region"); Individual sabara = model.createIndividual(preFix+"Sabaragamuwa",Region); try { PrintStream p =