sparql

SPARQL date range

╄→尐↘猪︶ㄣ 提交于 2019-12-24 02:22:05
问题 I'm trying to obtain all records between certain dates. The date field has appears in this format: 2012-01-31 . I think it is of type: <http://www.w3.org/2001/XMLSchema#date> How would I modify the query below to extract records with date greater than 2012-01-31 please? PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX lrppi: <http:/

“Timeout/query hangs” while executing SPARQL query to DBpedia from Jena

狂风中的少年 提交于 2019-12-24 01:14:28
问题 I am having trouble executing SPARQL queries against dbpedia.org using Jena. The queries are of the form: PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX p: <http://dbpedia.org/property/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?album ?name ?dateofrelease WHERE { ?album p:artist <http://dbpedia.org/resource/SomeArtist> . ?album rdf:type <http://dbpedia.org/ontology/Album> . ?album rdf:type <http://schema.org/MusicAlbum> . ?album p:name ?name . ?album <http:/

Are typed literals “tricky” in RDF4J?

心不动则不痛 提交于 2019-12-24 00:59:45
问题 In RDF, I can have an entity that is bound by a single property to multiple literal values. Those values can also be typed to add clarity. :dumpTruck :weight "heavy"^^xsd:string . :dumpTruck :weight "36000"^^xsd:integer . In SPARQL, I can query for just they type I want SELECT ?w WHERE { :dumpTruck :weight ?w FILTER ( datatype(?w) = xsd:integer ) } Is there something like getStatement in RDF4J that can be constrained by datatype like that? 回答1: There's no a priori constraint possible, but you

Using a year's natural number value in a SPARQL query

梦想与她 提交于 2019-12-24 00:57:45
问题 How do I query wikidata for a list of scientists that died in a prime-numbered year, and also were born in a prime-numbered year, using SPARQL? Here is what I have so far, which returns no results, and I'm assuming that's because people don't die in a number, but rather in a year... Also missing is the UNION statement for those born in a prime-numbered year, but we can omit that for the sake of focus. SELECT ?number ?scientist ?scientistLabel WHERE { ?number wdt:P31 wd:Q49008. ?scientist wdt

how to create aggregation on a graph from CONSTRUCT

倖福魔咒の 提交于 2019-12-24 00:54:49
问题 This is my query: PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rs: <http://www.welovethesemanticweb.com/rs#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> construct { ?subject0 rs:similarityValue ?similairty0. ?subject1 rs:similarityValue ?similairty1 } WHERE { { ?subject0 ?predicate0 ?object0. rs:Impromptu_No._1 ?predicate0 ?object0. ?predicate0 rs:hasSimilarityValue ?similairty0Helper. BIND(?similairty0Helper * (4/9) AS ?similairty0) FILTER (?subject0 != rs

How to create a parameterised query in SPARQLWrapper in python

∥☆過路亽.° 提交于 2019-12-24 00:44:32
问题 I am using the following sparql query using SPARQLWrapper as follows. from SPARQLWrapper import SPARQLWrapper, JSON sparql = SPARQLWrapper("http://live.dbpedia.org/sparql") sparql.setReturnFormat(JSON) sparql.setQuery(" ASK { dbc:Meteorological_concepts skos:broader{1,7} dbc:Medicine } ") results = sparql.query().convert() print(results['boolean']) This query returns False which is the correct output. I try to modify the aforementioned code by convering the query to a parameterised query (by

Filtering SPARQL results by day and month

只谈情不闲聊 提交于 2019-12-24 00:29:47
问题 I'm currently using the http://dbpedia.org/snorql website to launch some basic request like the one below: PREFIX dbpedia0: <http://dbpedia.org/ontology/> SELECT ?body ?value WHERE { ?body a dbpedia0:Person. ?body dbpedia0:birthDate ?value. } ORDER BY ?value I would like to find a way of filtering the results so that only people born on day X month Y are being selected (no matter the birth year). I have been trying to do so with many approaches like: 1) Basic filtering: FILTER(xsd:date(?value

Fuseki owl reasoner not working with TDB

半世苍凉 提交于 2019-12-23 23:24:31
问题 This is my configuration file # Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 ## Fuseki Server configuration file. @prefix : <#> . @prefix fuseki: <http://jena.apache.org/fuseki#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . [] rdf:type fuseki:Server ; fuseki:services ( <#service1> ) . #

How to get the terminal leaves of a Wikipedia root category

风流意气都作罢 提交于 2019-12-23 19:30:43
问题 I want to get only the leaves a wikipedia category but not sure how. I can get all the leaves by SELECT ?subcat WHERE { ?subcat skos:broader* category:Buildings_and_structures_in_France_by_city . } This gives me all intermediate leaves (such as Category:Buildings_and_structures_in_Antibes) but I want to get just the last/bottom leaves of the tree. Leaves that can not be split anymore. How can I do this? 回答1: You should be able to simply filter out the values of ?subcat that are not terminal

Sparql - query to get all triples related to a specific subject

瘦欲@ 提交于 2019-12-23 18:44:38
问题 I want all the triples in the graph from a specific subject / node. I can get all the triples... SELECT $s $p $o WHERE { $s $p $o } ... not really helpful I can get all the directly connect triples... SELECT $s $p $o WHERE { $s _some_predicate_ _some_object_specifier . $s $p $o } What I want is to start at $s (selected by predicate and object) and then get something like $s $p* $o Thoughts? Graph So I'd like to start at ID_6 and get all node below that including the nodes 1 and 2. I also need