sparql

Creating a SPARQL parameterized query using append/3 predicate

旧城冷巷雨未停 提交于 2019-12-12 20:37:22
问题 Related to my previous post: How to parameterize a SPARQL query in SWI Prolog? In order to exercise, I was trying to implement a predicate that builds and executes a SPARQL query using only the append/3 predicate (differently from the solution proposed in my old post) but it doesn't work well. This is my predicate: buildQuery(Place, Query, Row) :- % Q1 = 'select COUNT(*) where {?place a dbpedia-owl:Place ; rdfs:label " Q1 = [39, 115, 101, 108, 101, 99, 116, 32, 67, 79, 85, 78, 84, 40, 42, 41,

How to get the relationship between United Kingdom and England from DBpedia?

我是研究僧i 提交于 2019-12-12 20:23:32
问题 I'm trying to write a SPARQL query to obtain the relationship between the United Kingdom and England with no success: no result is returned, as you can see here: SELECT ?property WHERE { <http://dbpedia.org/resource/England> ?property <http://dbpedia.org/resource/United_Kingdom> } Any suggestion? Is there any mistake between in the SPARQL query? How can I find through DBpedia that England is in the UK? 回答1: Your query is correct. If you get no results, there is no such relationship. DBpedia

JENA: Endpoint returned Content-Type: text/html

。_饼干妹妹 提交于 2019-12-12 18:52:31
问题 When I try to send a sparql query to some endpoint, for example: QueryExecution qe = QueryExecutionFactory.sparqlService("http://data.open.ac.uk/sparql", getStringForQuery()); ResultSet results = qe.execSelect(); I get Exception in thread "main" org.apache.jena.query.QueryException: Endpoint returned Content-Type: text/html which is not currently supported for SELECT queries at org.apache.jena.sparql.engine.http.QueryEngineHTTP.execResultSetInner(QueryEngineHTTP.java:372) at org.apache.jena

SPARQL - Find objects with the most similar properties

早过忘川 提交于 2019-12-12 18:17:01
问题 Lets say there is a RDF DB of people and each of these people has many triples defining this person's friends (so many of 'person' x:hasFriend 'otherPerson' ). How can I find people who have the most similar friends? I'm a novice at SPARQL and this seems like a really complex query. Basically, the results would be a list of people starting from the ones with the most similar friends list (to the person specified in the query) and then going down the list to the people with the least similar

How to retrieve elements of OWL enumerated datatype expression?

被刻印的时光 ゝ 提交于 2019-12-12 18:04:58
问题 What SPARQL query should I use to show all values of union of two datatypes? Additionally how can I count the number of values in this union of datatypes? Each datatype was defined with DataOneOf(...) axiom. EDIT: to start with something: what SPARQL query should I use to show all values of the selected datatype? 回答1: In the future, it would be much easier if you can provide minimal data that we can work with. It would also make the question a bit clearer. As I understand it, you've defined

Counting number of individuals in SPARQL

我是研究僧i 提交于 2019-12-12 18:01:59
问题 I am totally new to SPARQL. I would like to count the number of actors in this ontology : http://data.linkedmdb.org/directory/actor I tried the following: SELECT ?s (COUNT(*) AS ?count) WHERE { ?a <http://data.linkedmdb.org/directory/actor> ?s} GROUP BY ?s But i believe that's not the right syntax for it because it gives me 0 results.. Where I know there are several results in that data source! Could it be that the link is not the correct one? 回答1: Counting actors per film In the original

SPARQL Path between two nodes

 ̄綄美尐妖づ 提交于 2019-12-12 17:43:15
问题 Given a graph: @prefix da: <http://example.com/data/> . @prefix on: <http://example.com/on/> . da:Shenaz on:husband da:Javed . da:Rita on:friend da:Noor ; on:sister da:Tom . da:Noor on:sister da:Shenaz . da:Javed on:child da:Jaabir . da:Tom on:sister da:James . da:Jaabir on:grandFather da:Rafick . There is a path between da:Noor and da:James which is da:Noor ^on:friend/on:sister/on:sister da:James . but the following query is returning false PREFIX da: <http://example.com/data/> PREFIX on:

SPARQL query performance with rdflib-sqlalchemy

≯℡__Kan透↙ 提交于 2019-12-12 17:15:06
问题 I have 7200 or so SKOS.Concept objects created by rdflib-sqlalchemy from parsing a turtle file stored in a Postgres DB. The following SPARQL query takes over 30 seconds to respond with data: SELECT ?subject ?prefLabel WHERE { ?subject rdf:type <http://www.w3.org/2004/02/skos/core#Concept> . ?subject skos:prefLabel ?prefLabel . FILTER (lang(?prefLabel) = 'en') } order by ?prefLabel LIMIT 20 OFFSET 0 I am using the limit and offset to paginate through results. I pass in the language parameter

Sparql query gone wrong cause of incorrect geo onto + inexistence in results of a property I required

不想你离开。 提交于 2019-12-12 17:06:31
问题 I'm using ARC2 library for php to issue sparql queries, and i got stuck on this issue (I don't think it has something to do with the lib). This query works just fine - in my app, and in dbpedia snorql: PREFIX dbo:<http://dbpedia.org/ontology/> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX