Questions tagged [sparql]

SPARQL (pronounced "sparkle", a recursive acronym for SPARQL Protocol and RDF Query Language) is a set of specifications by W3C that provide languages and protocols to query and manipulate RDF graph content on the Web or in an RDF store.

sparql
Filter by
Sorted by
Tagged with
2 votes
1 answer
149 views

How to specify a specific class in SPARQL?

I am trying to learn ontologies and SPARQL using Protégé. I'm trying to figure out SPARQL code to show subclasses of a given class: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> ...
ChrisH's user avatar
  • 21
2 votes
0 answers
97 views

Select single ontology class and all of its axioms and annotations as a subset

Is there a SPARQL or other method to extract a single class and all of its associated axioms and annotations from an ontology? For example, assume one had a list of classes from one ontology that they ...
There's user avatar
  • 506
2 votes
1 answer
72 views

How to return subgraph from rdf graph

I have an RDF graph G with several classes assuming for simplicity (Person and Parrot). The class Person is connected to the class Parrot by the property hasAnimal, e.g.: @PREFIX : <http://example....
ChrisDelClea's user avatar
2 votes
0 answers
46 views

How do you exclude values with "potential issues" from a Wikidata query

I am querying for companies to see what other organizations they own. Some of the returned items have "potential issues" that show up on the Wikidata page for the parent company. How do I ...
Korimako's user avatar
  • 389
2 votes
0 answers
91 views

Verify rdf:Container(rdf:Seq) using shacl constraints

I am currently trying to build a constraint validation shape for an incoming object of the type rdf:Seq. The shacl shapes I have used, use the path to identify triple and then add additional ...
Shri's user avatar
  • 51
2 votes
2 answers
258 views

SPARQL query to remove "@en"

I have a large skos taxonomy that has some incorrect notation properties. Most of the properties are xsd:string but some appear with a "@en" language string. I want to modify the triples so ...
Ian Piper's user avatar
2 votes
0 answers
121 views

Apache Jena SPARQL query will not abort

I'm having a problem in my Java application where Apache Jena will never stop a SPARQL query until it's finished, even if I explicitly tell it to stop. Here's the code that gets called to run a query: ...
water490's user avatar
2 votes
1 answer
72 views

SQL Lag() in SPARQL

I was wondering if there is a way to get the functionality of SQL LAG() in my SPARQL query. More specifically, I have a set of states like <http:\\stateA> p:start "2014-05-23T10:20:13+05:30&...
Bahar's user avatar
  • 790
2 votes
0 answers
520 views

SPARQL Update (DELETE/INSERT) with WHERE Condition Referencing Multiple Graphs [closed]

I'm trying to do a SPARQL update in Jena Fuseki, but I can't seem to get it to work. The following is the issue: I have triples in a graph (named freetest), and those triples need to be changed. And ...
Balduin's user avatar
  • 435
2 votes
0 answers
190 views

Format dates based on date precision

I am using Wikidata Query Service to get the dates of population of some places. The output gives a raw result in the format 2010-01-01T00:00:00Z (as an example). I have also retrieved the date ...
JAT86's user avatar
  • 1,025
2 votes
0 answers
214 views

How to use simple vocabulary line with GeoSPARQL:sfWithin and polygon?

RDF: prefix ex: <http://www.example.org/> prefix geo: <http://www.opengis.net/ont/geosparql#> ex:b7 a sf:Line ; geo:asWKT "<http://www.opengis.net/def/crs/EPSG/0/4326> ...
There's user avatar
  • 506
2 votes
0 answers
409 views

Avoiding HTTP "too many requests" error when using SPARQLWrapper and Wikidata

I have a list of approximately 6k wikidata instance IDs (beginning Q#####) I want to look up the human-readable labels for. I am not too familiar with SPARQL, but following some guidelines have ...
cookie1986's user avatar
2 votes
0 answers
45 views

Display qualifier value as column and display only a single unique item

I am trying to get some municipalities and their population (P1082) over the years using SPARQL in Wikidata. The query I am using works, but I do not know how to convert the years of the population ...
JAT86's user avatar
  • 1,025
2 votes
1 answer
624 views

Sparql query to read from all named graphs without knowing the names

I am looking to run a SPARQL query over any dataset. We dont know the names of the named graphs in the datasets. These are lots of documentation and examples of selection from named graphs when you ...
Harper2021's user avatar
2 votes
0 answers
226 views

GeoSPARQL: Calculate distance between two linestrings

Does GeoSPARQL provide functionality to calculate the distance between two linestrings? (Edit: I'm using Jena Fuseki with the GeoSPARQL extension.) The results are not working as expected. Linestring ...
There's user avatar
  • 506
2 votes
0 answers
172 views

How to define the triplets a SPARQL query consider during its execution? (creating self-contained examples)

Prologue In SQL, it is possible to define the data a SELECT statement consider during its execution. I call these type of examples "self-contained examples" because they create the data the ...
rdrg109's user avatar
  • 275
2 votes
0 answers
146 views

stSPARQL / GeoSPARQL ERROR - Problem with Intersection between Spatial data - Geometries

Hello everyone and have a Happy New Year!! I am using an StSparql/Geosparql endpoint and I have a spatial dataset which has geometries for lakes and rivers. My goal is to try and find all the lakes ...
George Bal-rog's user avatar
2 votes
1 answer
441 views

How to write a sparql query with variable predicate?

Please have a look at the following example: @prefix : <#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . :Bob :score 78 . :John :score 50 . :rule1 :condition [ ...
joylix's user avatar
  • 117
2 votes
0 answers
185 views

How do I deduce all of a person's descendants?

Here is my example.owl: @prefix : <#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3....
joylix's user avatar
  • 117
2 votes
1 answer
292 views

Retrieve objects from RDF triples

With the following snippet from the pizza ontology: <owl:Class rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#Pizza"> <rdfs:subClassOf rdf:resource="http://www....
gedman's user avatar
  • 63
2 votes
0 answers
114 views

How can I insert data to Fuseki server via php with SPARQL QUERY?

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/aungyekyaw/ontologies/2020/8/DL_lib#Book_3"> <rdf:type rdf:resource="http://www.semanticweb.org/aungyekyaw/...
Ye Kyaw's user avatar
  • 25
2 votes
0 answers
640 views

getting HTTP 406 querying GraphDB using SPARQLWrapper

I'm querying a database in GraphDB using SPARQLWrapper. Insert is working fine but when the query is SELECT, I get HTTP 406 using GET method and HTTP 415 using POST. Similar Select query works on ...
Eli's user avatar
  • 21
2 votes
0 answers
147 views

Named subquery slow in Wikidata Query Service

I am wondering why the following SPARQL query with a named subquery is slow on Blazegraph instance Wikidata Query Service. Taking out the subquery and executing that alone completes in around a second ...
Finn Årup Nielsen's user avatar
2 votes
0 answers
1k views

Sparql Query round a floating number to third digit after decimal point

I have a query which I receive a string value (?result) which is between 0-1 range (e.g. 0.99994787) and I multiply it by 100 to have a percentage view. Finally, I would like to round it to the third ...
Erwarth's user avatar
  • 557
2 votes
1 answer
116 views

Is there a way to rewrite INSERT, MODIFY or DELETE sparql using ARQ Jena Algebra?

I found some SPARQL query manipulation only for SELECT, ASK, CONSTRUCT https://jena.apache.org/documentation/query/manipulating_sparql_using_arq.html and https://jena.apache.org/documentation/query/...
Guillermo Coscarelli's user avatar
2 votes
1 answer
102 views

Duplicates in SPARQL clause VALUES lead to unexplainable result

I accidentaly noticed that if you write SPARQL query like this SELECT ?id ?idLabel WHERE{ VALUES ?id { wd:Q1 wd:Q1 }. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } ...
elfinorr's user avatar
  • 189
2 votes
0 answers
228 views

Performant method to get triple statistic or count in a Apache Jena Fuseki repository

I have a requirement where I need to count/estimate number of triples in a repository. At the moment I am using SPARQL query to count number of triples in a repository but this is slowing down as size ...
user1566434's user avatar
2 votes
0 answers
81 views

SPARQL paths where the subject and object are not of the same class

For some data in this sample schema, I want to find all possible "trip lineages". For example: trips 2-4 form a lineage when the passenger of the previous trip is the driver of the next trip....
mkk's user avatar
  • 963
2 votes
1 answer
560 views

Is there a WITH clause in SPARQL?

Is there any analog of view creation or WITH clause from SQL in SPARQL? I want to: Select some data from table; Select data which is not in the first selection (by subject) from the same table. This ...
DenisNovac's user avatar
2 votes
0 answers
166 views

Sparql query from java code to retrieve result from owl file

I am new to sparql query. I have the following query. I am trying to retrieve range and domain from owl file. I am getting output in protege. But for the same query I am not getting any output in ...
anitha's user avatar
  • 29
2 votes
0 answers
282 views

How to get normal rank "instance of"(wdt:P31) entry on Wikidata SPARQL query?

I'm trying to get Normal Rank "instance of"(wdt:P31) entry but the query results with only Preferred Rank result. Following is the code to get "instance of"(wdt:P31) of "Tokyo"(wd:Q1490). This code ...
Yukihisa Yonemochi's user avatar
2 votes
1 answer
214 views

Why is the SPARQL regex() function ignoring the "q" flag?

I'm trying to test if a string is contained in another in a case-insensitive way. The SPARQL expression REGEX ( ?str, ?tok, "iq" ) should do that. The q flag is needed in addition to the i ...
Jaccoud's user avatar
  • 99
2 votes
0 answers
120 views

How to unit test django application using jena-fuseki?

My django application uses sparql with jena-fuseki RDF-database. How should I run my unit tests as thete's hardly any information in availble for creatig in-memory jena database for a django ...
Jaana's user avatar
  • 296
2 votes
0 answers
282 views

list of 2000 random football players using from wikidata

I tried to get 2000 random soccer players with additional information (name, team, team number, apperances, goals) from wikidata with this query: SELECT ?SoccerPlayerLabel ?Teams ?TeamsLabel ?...
amine4392's user avatar
2 votes
1 answer
245 views

How to count the number of distinct values, their names and the number of times each appeared per data property SPARQL

I m trying to make a SPARQL query that returns the number of distinct values of each data property of a Turtle file. I would like to know what the name of each value is and how many time each were ...
DjSh's user avatar
  • 2,774
2 votes
0 answers
80 views

SPARQL over custom representation of semantic data

I have a non-standard way of storing and representing semantic data, and I was looking into some possibilities of supporting SPARQL queries. It seems that the best solution is to implement a so-called ...
Tuff's user avatar
  • 51
2 votes
0 answers
604 views

SPARQL: Converting CONSTRUCT Query w/ Named Graph to SELECT Query

You are not able to specify a GRAPH in a CONSTRUCT query with SPARQL 1.1 CONSTRUCT { GRAPH <graph:1> { ?s rdf:type ?o . } } WHERE { GRAPH <graph:1> { ?s rdf:type ?o . } VALUES (?o) {...
Neil Graham's user avatar
2 votes
0 answers
559 views

Dynamic FROM IRI in SPARQL query

I'm doing a task in SPARQL where I want to link my ontology to dbpedia to get the publishing date of various games. For each game in my ontology I've added properties linking to the dbpedia resource (:...
Mr. Eivind's user avatar
2 votes
1 answer
358 views

How to return a full tree using SPARQL?

I am trying to build a POC search engine for an internal site at my company. I am using GraphDB and have put some base data in that looks like this: Page -hasField-> Field Field -hasOption-> ...
jmblackmer's user avatar
  • 1,247
2 votes
0 answers
122 views

How to force Jena API's findShortestPath method to do BFS on <owl#onProperty> instead of <owl#someValuesFrom>?

I am trying to find the shortest path or a path between two nodes in an ontology using Jena's above mentioned method. Given any two nodes of the ontology, my eventual goal is to create a SPARQL query ...
elixir's user avatar
  • 183
2 votes
1 answer
242 views

R SPARQL Wikidata: "Opening and ending tag mismatch"

My aim is to query wikidata using R. I just realized that Wikidata Query Service offers code examples in order to so: Go to https://w.wiki/AkK Execute query Click on </> Code next to the ...
kalakaru's user avatar
  • 131
2 votes
0 answers
117 views

SPARQL: slow processing of result of subquery

I'm currently learning SPARQL, and I can't wrap my head around why what seems to me like a very straightforward query takes a large amount to time. I'm trying to count the number of articles per ...
swhalemwo's user avatar
  • 107
2 votes
0 answers
316 views

SPARQL Join ttl to dbpedia in Python

So I know that in order to run SPARQL statements against a local ttl file I use rdflib. In order to run SPARQL statements against dbpedia I run Sparqlwrapper. But how do I do both? i.e. suppose I ...
Dano13's user avatar
  • 149
2 votes
1 answer
523 views

Wikidata SPARQL multiple filters

I am trying to find cast members who appear together in different films. For example: "Find all the actors who appeared in Empire Strikes Back and Temple of Doom" should return Harrison Ford. "Find ...
Terence Eden's user avatar
  • 14.2k
2 votes
0 answers
620 views

SPARQL syntax for matches to multiple predicates

I am querying a Protege OWL file and would like to get results for multiple predicates. For example the following 2 patterns work: ?restriction owl:onProperty :has_part ; owl:someValuesFrom ?t . and ...
Fiver's user avatar
  • 10.1k
2 votes
0 answers
470 views

Angular http.post() gives: "error 415 unsupported MIME type"

Hello and thanks for reading, The context of the problem is that I'm trying to send a SPARQL query from an Angular web application to a GraphDB server (on a specific URL:128.199.58.129:7200 using a ...
Andrew Malcolm's user avatar
2 votes
0 answers
141 views

How to retrieve the categorical details in Wikidata

I have a list of instances as follows. myinstances = ['word2vec', 'tf-idf', 'dijkstra's algorithm'] For each myinstance in the above list, I want to find: 1. What are the other instances of `...
EmJ's user avatar
  • 4,518
2 votes
1 answer
622 views

wikidata query missing out countries in Europe

I am using the following query against wikidata; SELECT ?country ?countryLabel WHERE { ?country wdt:P30 wd:Q46; wdt:P31 wd:Q6256. SERVICE wikibase:...
nishant's user avatar
  • 766
2 votes
1 answer
168 views

Extract rules from RDF file using Sparql

This is the rule i want to extract in RDF/XML format : <rdf:Description rdf:about="http://www.semanticweb.org/myCompany/ontologies#x"> <rdf:type rdf:resource="http://www.w3.org/2003/11/...
Dauflo's user avatar
  • 31
2 votes
0 answers
365 views

SparqlWrapper error - urllib.error.HTTPError: HTTP Error 406: Unacceptable

Please find below query, which gives 406 error when I try to query the sparql endpoint. I am not sure why. Could anyone help me with this? Thanks in advance. from SPARQLWrapper import SPARQLWrapper, ...
Swaroop's user avatar
  • 109

1
32 33
34
35 36
124