sparql

getting a graph path using SPARQL [duplicate]

荒凉一梦 提交于 2019-12-31 03:43:10
问题 This question already has an answer here : Querying a Graph path in SPARQL (1 answer) Closed 4 years ago . We have the following turtle dataset representing a graph where we want to observe some properties. @prefix v1: <http://localhost:9091/graphe/> . @prefix v2: <http://localhost:9091/graphe#> . v1:a v2:p v1:b. v1:a v2:q v1:f. v1:a v2:p v1:g. v1:b v2:p v1:c. v1:c v2:q v1:h. v1:c v2:p v1:i. v1:c v2:p v1:d. v1:d v2:p v1:e. v1:f v2:p v1:g. v1:f v2:q v1:l. v1:f v2:p v1:k. v1:g v2:p v1:c. v1:g

How to list and count the different types of node and edge entities in the graph data using SPARQL query?

江枫思渺然 提交于 2019-12-31 03:02:52
问题 I'm looking to provide some summary stats for a data set and I want to list the different types of edge entities and node(vertex) entities in the graph. For example: -> In Twitter Social network graph of users and following relationship (Homogeneous graph), there is only one type of vertex entity (user), but in heterogeneous graphs such as ConceptNet data, it will have multiple values. -> The edge entities can be computed by just counting the different number of predicates I believe using the

exploratory SPARQL queries?

不打扰是莪最后的温柔 提交于 2019-12-28 01:42:13
问题 whenever i start using sql i tend to throw a couple of exploratory statements at the database in order to understand what is avaliable, and what form the data takes. eg. show tables describe table select * from table could anyone help me understand the way to complete a similar exploration of an rdf datastore using a SPARQL endpoint? Thanks :) 回答1: Well, the obvious first start is to look at the classes and properties present in the data. Here is how to see what classes are being used: SELECT

How to group array based on the same values

删除回忆录丶 提交于 2019-12-26 17:30:11
问题 Please, confused with array in python. I want to group array based on the same values. Code: enter image description here id_disease = ['penyakit_tepung','hawar_daun'] for id_disease in id_disease: qres = acacia.query( """ PREFIX tst: <http://www.semanticweb.org/aalviian/ontologies/2017/1/untitled-ontology-10#> SELECT ?disease ?patogen WHERE { ?disease tst:caused_by ?patogen . FILTER regex(str(?disease), "%s") . } """ % id_disease ) for row in qres: for r in row: print(r.replace('http://www

Query DBpedia with Sparql using VALUES

邮差的信 提交于 2019-12-25 18:43:27
问题 When I run this code in java I am getting error, I think the error occurred because of "String values". I am not sure about adding it but I got this idea from my previous question's answer which I asked in this site Query DBpedia to get abstract for different inputs public static void DbpediaResultSparql() { String values = "New York"; String service = "http://dbpedia.org/sparql"; String sparqlQueryString2 = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>"+ "PREFIX dbpedia-owl: <http:/

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

how to find classes from dbpedia?

三世轮回 提交于 2019-12-25 18:33:51
问题 I need a sparql query that given a free text (user input), it finds me from dbpedia all the classes related to it. How do it? 回答1: Also asked here. Accepted answer said -- When you say classes, are you mean about types? If yes, try something like SELECT ?uri ?label ?type WHERE { ?uri rdfs:label ?label . ?uri <http://dbpedia.org/ontology/type> ?type . FILTER regex(str(?label), "Leipzig") . } limit 10 I couldn't let this go... PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX virtdrf:

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/"

SPARQL: Choose one triple from multiple match?

左心房为你撑大大i 提交于 2019-12-25 18:25:28
问题 I have a kind of interesting problem with SPARQL query. I am querying for a triple and I have multiple match - maybe 2. But I need the code to choose only one. It absolutely doesn't matter which one. For example: I am querying for a book for 5-years old and it founds 2 books in the database but I need to have only one saved in variable (doesn't matter which one). Is this even possible in SPARQL? Please let me know if you need any other information. Thank you all in advance for your time! The

Trying to get the name of charity organisations with their locations-SPARQL

烂漫一生 提交于 2019-12-25 18:24:56
问题 I am trying to create a SPARQL query which gets the charity organisations and their location from DBpedia. Here is the link to one charity -- http://dbpedia.org/page/Stonewall_(charity). I am trying to get all the charities that exist with the names and location. I want to retrieve dbp:name along with dbo:headquarter . 回答1: You could try this: select distinct ?name (group_concat(?headquarter;separator=",")) where {?s a dbo:Organisation. ?s dbo:status "Charity". ?s dbp:name ?name. ?s dbo