jena

sparql group by and order by: not ordered

雨燕双飞 提交于 2019-12-02 08:14:10
问题 I follow up on query where the schema.org database is used to find the number of children of a class - as a simpler database than my application. I want to get the names of the children concatenated in alphabetic order. The query prefix schema: <http://schema.org/> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> select ?child (group_concat (?string) as ?strings) where { ?child rdfs:subClassOf schema:Event . ?grandchild rdfs:subClassOf ?child . bind (strafter(str(?grandchild), "http:/

object property for a class

风格不统一 提交于 2019-12-02 08:04:06
How can I determine object properties for a class in Jena . I can get the all objects properties, but I want to get the object properties for a particular class. Code for getting all the objectProperties: ExtendedIterator objects = m.listObjectProperties(); while (objects.hasNext()) { Property essaProperty = (Property) objects.next(); System.out.println("Propiedad: " + essaProperty.getLocalName()); } Also, how I can get the related class to the object property, I mean, knowing A how I can get the object property "---->" and how I can get "B" has (A---------->B) Thanks Joshua Taylor You might

How to get a list of resources linked to a resource in Jena?

為{幸葍}努か 提交于 2019-12-02 06:54:37
I created a Model using the Jena APIs: public static void main(String[] args) { Model model = ModelFactory.createDefaultModel(); Resource alice = ResourceFactory.createResource("http://example.org/alice"); Resource bob = ResourceFactory.createResource("http://example.org/bob"); Resource charlie = ResourceFactory.createResource("http://example.org/charlie"); model.add (alice, RDF.type, FOAF.Person); model.add (alice, FOAF.name, "Alice"); model.add (alice, FOAF.mbox, ResourceFactory.createResource("mailto:alice@example.org")); model.add (alice, FOAF.knows, bob); model.add (alice, FOAF.knows,

sparql group by and order by: not ordered

╄→尐↘猪︶ㄣ 提交于 2019-12-02 05:47:37
I follow up on query where the schema.org database is used to find the number of children of a class - as a simpler database than my application. I want to get the names of the children concatenated in alphabetic order. The query prefix schema: <http://schema.org/> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> select ?child (group_concat (?string) as ?strings) where { ?child rdfs:subClassOf schema:Event . ?grandchild rdfs:subClassOf ?child . bind (strafter(str(?grandchild), "http://schema.org/") as ?string) } group by ?child order by asc(?string) limit 20 gives schema:PublicationEvent

Querying named RDF graphs in TDB using tdbquery

吃可爱长大的小学妹 提交于 2019-12-02 04:57:26
I am trying to query my newly created TDB database use the tdbquery program. However, I am having a hard time writing a query that targets the correct named graph. I am doing the following: First a create a new dataset and add a name graph called "facts" Dataset dataset = TDBFactory.createDataset("/tdb/"); dataset.begin(ReadWrite.WRITE) ; try { Model facts = RDFDataMgr.loadModel("lineitem.ttl") ; dataset.addNamedModel("facts", facts); dataset.commit(); TDB.sync(dataset); dataset.end(); } finally { dataset.close(); } When I query all graphs in my TDB database it looks fine. ./tdbquery --loc

Java - Using Jena APi - Get data from RDF file

一个人想着一个人 提交于 2019-12-02 04:51:09
My question concerns the class Person with the datatype properties hasFirstName , hasLastName , hasDateOfBirth , hasGender . I'm using Java and Jena API. Here is how one person is represented in my RDF file. <rdf:Description rdf:about="http://www.fam.com/FAM#Bruno04/02/1980 "> <j.0:FAMhasGender>H</j.0:FAMhasGender> <j.0:FAMhasDateOfBirth>04/02/1980</j.0:FAMhasDateOfBirth> <j.0:FAMhasLastName>DS </j.0:FAMhasLastName> <j.0:FAMhasFirstName> Bruno</j.0:FAMhasFirstName> </rdf:Description> I want to write this line below if gender is female : [label= \"" +firstName+ " \"\n\n\"D.Naiss:"+dnai1+"\", "

Matching strings with at least one word in common

非 Y 不嫁゛ 提交于 2019-12-02 03:48:37
I'm making a query to get the URIs of documents, that have a specific title. My query is: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?document WHERE { ?document dc:title ?title. FILTER (?title = "…" ). } where "…" is actually the value of this.getTitle() , since the query string is generated by: String queryString = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> " + "PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?document WHERE { " + "?document dc:title ?title." + "FILTER (?title = \"" + this.getTitle() + "\

fuseki webinterface does not show datasets

两盒软妹~` 提交于 2019-12-02 02:36:16
问题 I have installed fuseki and start the server with #!/bin/sh cd /home/frank/localInstall/jena/apache-jena-fuseki-2.5.0 exec /home/frank/localInstall/jena/apache-jena-fuseki-2.5.0/fuseki-server -v --update --mem /testDB The server is working and programs can store data in /testDB, but the webinterface does not show the datasets and I cannot add a dataset. When I try to query the interface says Please select a dataset. I think I had this problem before and solved it by reinstalling the fuseki

fuseki webinterface does not show datasets

核能气质少年 提交于 2019-12-02 02:04:25
I have installed fuseki and start the server with #!/bin/sh cd /home/frank/localInstall/jena/apache-jena-fuseki-2.5.0 exec /home/frank/localInstall/jena/apache-jena-fuseki-2.5.0/fuseki-server -v --update --mem /testDB The server is working and programs can store data in /testDB, but the webinterface does not show the datasets and I cannot add a dataset. When I try to query the interface says Please select a dataset. I think I had this problem before and solved it by reinstalling the fuseki folder. I would like to understand what I did wrong and how to avoid this problem. Thank you! the config

writing Jena built-ins

徘徊边缘 提交于 2019-12-02 01:42:47
问题 I'm trying to write a Jena built-in to return a value from an algorithm I have been given and then do a comparison against that value, e.g., String rule = "[exRule: (?d rdf:type ex:abc)" + "<-" + // ...extract ?a, ?b to use as inputs to the rule "greaterThan(myBuiltIn(?a, ?b), 1)" + // Is return value greater than 1 "]"; So, first the Jena documentation says that the easiest way to experiment with this is to look at the examples in the builtins directory, however I don't seem to have this in