FAQ Database Discussion Community


apparently unnecessary SPARQL filter

sparql,linked-data
Given the graph http://example.org/ as: @prefix foaf:<http://xmlns.com/foaf/0.1/purl>. <uri:alice> foaf:name "Alice". <uri:bob> foaf:name "Bob". <uri:carl> foaf:name "Carl". Why this SPARQL query works: PREFIX foaf:<http://xmlns.com/foaf/0.1/purl> SELECT * WHERE { GRAPH <http://example.org/> { ?model_ic foaf:name ?name. FILTER (?name = "Bob") } } Whereas this one don't (well, technically it works but returns 0...

Get value from a SPARQL query

rdf,sparql,semantic-web,rdfa
The following query is sufficient for me to get the name of a recipe and the amount of ingredients in it. I would like to get the ingredients in the recipe as well. How can I modify my query to do this? PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs:...

SPARQL query not displaying results

sparql,owl,virtuoso
I'm very new to Semantic Web programming. I have an OWL file that I've loaded into Virtuoso server at the URI http://myexample.com . Now when I open the Virtuoso SPARQL query editor (http://localhost:8890/sparql), and run the following query, I get no results: SELECT ?class FROM <myexample.com> WHERE{?class a owl:class} Order...

select the negative of a SPARQL query

sparql
Is possible to select the "negative" of a sparql query? For instance, consider the following RDF data, query and desired result: knowledge base: @prefix gr:<http://purl.org/goodrelations/v1#>. @prefix rdfs:<http://www.w3.org/2000/01/rdf-schema#>. :prod_A :hasProp :propA. :prod_B :hasProp :propB. :propB rdfs:label "Hello". :prod_C :hasProp :propC. :prod_D :hasProp :propD. Imaginary Query: PREFIX gr:<http://purl.org/goodrelations/v1#> SELECT ?prod WHERE {...

How can I retrieve the wikipageID if the page is not in english using sparql and dbpedia

python,sparql,dbpedia
I want to retrieve the wikipageID for the same query name in different languages. For example: select * where { <http://dbpedia.org/resource/Mike_Quigley_(footballer)> dbpedia-owl:wikiPageID ?wikiID } ====>Mike_Quigley_(footballer) 17237449 en select * where { <http://dbpedia.org/resource/Theodore_Roberts> dbpedia-owl:wikiPageID ?wikiID } ====>Theodore_Roberts 6831454 en select * where { <http://de.dbpedia.org/resource/Theodore_Roberts> dbpedia-owl:wikiPageID ?wikiID } ====>Theodore_Roberts de select *...

RDF SPARQL query multiple types

java,rdf,sparql
I am trying to parse a rdf graph using SPARQL. Naturally in a graph my entities can be more than one type at a time. How does a SPARQL query have to look like so that I can check for both types? How my graph looks like: <ns0:TrainArrival rdf:about="http://my.url.com/ontologies/mash-up#TrainArrival-7a60055b-1e7f-464d-b42e-b1839d623b69"> <ns0:arrivalTime...

How to do a count and select variables in Sparql

sparql
Is there a way to select variables and get a count of the total variables in one Sparql query ? I want to return ?s and get a count of all the ?s matches I tried variations of the query below but I keep getting errors SELECT (COUNT(*) as ?cnt)...

Can SPARQL handle blank results for specific cells?

web-scraping,sparql,scrape,dbpedia
I am writing a SPARQL query and cant figure out how to allow blank results for specific columns. My current request is: select * where { ?game a dbpedia-owl:Game ; dbpprop:name ?name ; dbpedia-owl:publisher ?publisher . } Some Games have an owl for publisher while others do not. The above...

why is Sparql endpoint on local sever not returning the full set of entities for a given type?

c++,sparql,freebase
Introduction I have freebase uploaded to Virtuoso open-source. The databaset is located on the following server: http://SERVER_SPARQL:8890/sparql. I want to extract the description of all the entities that have the type common.topic. C++ class In order to access the database I am using curlpp and c++. I am pretty sure...

How to retrieve person names from DBPedia in different language versions?

r,sparql,dbpedia
I am currently querying DBPedia for a list of person names by using the SPARQL package in R. I noticed that when I use SPARQL query for English DBPedia like this: endpoint = "http://live.dbpedia.org/sparql" query= "SELECT *{ dbpedia:Veit_Dietrich ?p ?o }" qd=SPARQL(endpoint,query) df=qd$results Everything is fine, but if I want...

sparql insert with where clause

curl,sparql,4store
How to insert insert query with "where" condition in 4store sparql As far as I have searched I got to know that we have to use curl command for the same.I tried using this Process p = Runtime.getRuntime().exec(new String[]{"bash","-c","curl -i -d 'update=INSERT+DATA+{+?subject2+<http://www.w3.org/2002/07/owl/sameAs>+?subject3+.+}+WHERE+{+?subject2+<http://localhost:2020/vocab/Schema_feature>+\""+first[0]+"\"+.+?subject3+<http://localhost:2020/vocab/Schema_feature>+\""+first[1]+"\"+.+}' http://localhost:8000/update/"});...

Representing a class diagram using protege

sparql,ontology,class-diagram,protege
I'm developing an ontology for a searching laboratory and I need to represent my class diagram with "Protege". I don't know how to represent relations cardinals. How can I do it for this one for example? And what about the cardinals : 0...* 2..5 3..* 0..1 etc Thank you very...

What is the difference between a temporal and a non-temporal query

sql,database,sparql
I have read some resources that talk about temporal and non-temporal queries, specifically with SPARQL. What is the difference between these two kinds of queries?

Matching optional triples without using OPTIONAL

sparql
I want to query records where not all records have all properties. Is it possible to get them with blank values by just using basic graph patterns in the query and without using optional?

Use a numeric value as string value in SPARQL

sparql,linked-data
Is possible to use somehow a numeric value as a string value in a SPARQL query? For instance, consider the following RDF data, query, and desired result: Knowledge base @prefix gr: <http://purl.org/goodrelations/v1#>. @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. :o a gr:QuantitativeValueFloat; gr:hasMinValueFloat "1,0"^^xsd:float gr:hasMaxValueFloat "10,0"^^xsd:float Query PREFIX gr: <http://purl.org/goodrelations/v1#> SELECT ?o ?v WHERE...

Count a specific relationship in OWL File using sparql query

sparql,jena,owl,ontology
I want to count assertions of a specific relationship in OWL file. if following is my whole Ontology:- <owl:NamedIndividual rdf:about="file:/C:/myOnt.owl#comfort"> <SynonymOf rdf:resource="file:/C:/myOnt.owl#impunity"/> <SynonymOf rdf:resource="file:/C:/myOnt.owl#sooth"/> <SynonymOf rdf:resource="file:/C:/myOnt.owl#ease"/> </owl:NamedIndividual> <owl:NamedIndividual rdf:about="file:/C:/myOnt.owl#population"> <SynonymOf rdf:resource="file:/C:/myOnt.owl#habitation"/>...

“if” in a SPARQL query

sparql,linked-data
my problem is very simple: I have a source my:g1 that contains: my:a1 my:b "literal 1" Then I have a second source my:g2 that contains: my:a2 my:b my:c. my:c rdfs:label "literal 2" how can I set a SPARQL query that produces something like: | ?a | ?b | ?literal |...

SPARQL query for partial match of statement (contains)

sparql
I would like to know if there is a way in SPARQL to query for partial matches of statements. So if for example in the triple store I have an object containing "blablablaUsefulblablabla" I would like to be able to query for Useful, so I want to say that the...

How to get all nouns in a certain language from Wiktionary using SPARQL

sparql,wiktionary
I'm trying to query Wiktionary with SPARQL to get all the terms that are nouns of a certain language (for example German) and as output: the string of the noun the grammatical gender (genus): male, female, neutral I am using the SPARQL-Endpoint: http://wiktionary.dbpedia.org/sparql and I found an example but I...

Connect Topbraid Composer to Stardog with Sesame

rdf,sparql,sesame,stardog,topbraid-composer
I'm failing to connect Topbraid Composer 4.6.3 to Stardog 3.0 with the help of a Sesame 2.8.1 repository. These are the steps I'm following: Create a new RDF/OWL Sesame2 Repository Connection Entered a File name, Base URI and Service URL. The available repositories are correctly shown. Select the Stardog repository...

kill the nearly duplicate results that came from the 1:n relations in SPARQL [duplicate]

sparql,linked-data
This question already has an answer here: Aggregating results from SPARQL query 1 answer Is possible to concatenate equivalent results in a SPARQL query? For instance, consider the following RDF data and desired result: knowledge base: @prefix gr:<http://purl.org/goodrelations/v1#>. :prod_A gr:color "Red"; gr:color "Blue". :prod_B gr:color "Green". Ideal Result: |...

How to use the ASK WHERE statement with multiple conditions (sparql)

sparql,freebase
I want to check if an entity has one of the types listed below. If it does then the query must return true. PREFIX basekb:<http://rdf.basekb.com/ns/> basekb:music.release_track basekb:book.written_work basekb:book.book basekb:music.release basekb:music.album basekb:tv.tv_series.episode basekb:music.composition basekb:music.recording basekb:film.film basekb:fictional_universe.fictional_character Entity m.0109yb6 has the following types. The sparql query should return true http://rdf.basekb.com/ns/common.topic...

DISTINCT only on one value with SPARQL

rdf,sparql,dbpedia,linked-data
I want to retrieve with SPARQL the list of the italian cities with more than 100k of population and I'm using the following query: PREFIX dbo: <http://dbpedia.org/ontology/> SELECT ?city ?name ?pop WHERE { ?city a dbo:Settlement . ?city foaf:name ?name . ?city dbo:populationTotal ?pop . ?city dbo:country ?country . ?city...

Consequence of restrictions in ontology on SPARQL end results

rdf,sparql,semantics,owl,ontology
I am concerned about two classes (SensingDevice and Property) of my ontology (dgo.owl) as shown in the below figure. These two classes are connected by observes property: and the related ontology portion is as: <owl:Class rdf:about="http://www.iiitd.edu.in/~haroonr/ontologies/DGO#TemperatureSensor_Livingroom"> <rdfs:subClassOf rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#SensingDevice"/> <rdfs:subClassOf> <owl:Restriction> <owl:onProperty rdf:resource="http://purl.oclc.org/NET/ssnx/ssn#observes"/>...

OpenRdf Exception when parsing data from DBPedia

java,rdf,sparql,dbpedia,sesame
I use OpenRdf with Sparql to gather data from DBPedia but I encounter some errors on the following query ran against the DBPedia Sparql endpoint: CONSTRUCT{ ?battle ?relation ?data . } WHERE{ ?battle rdf:type yago:Battle100953559 ; ?relation ?data . FILTER(?relation != owl:sameAs) } LIMIT 1 OFFSET 18177 I modified the...

Ontologies, OWL, Sparql: Modelling that “something is not there” and performance considerations

performance,sparql,modeling,ontology,sesame
we want to model that "something is not there" as opposed to missing information, e.g. an explicit statement that "a patient did not get chemotherapy" or that "a patient does not have dyspnea" is different from missing information about whether a patient has dyspnea. We thought about several approaches, e.g....

SPARQL query: How to use wikiPageDisambiguates for redirect

sparql,dbpedia
I'm trying to retrieve thumbnail links for a given entity name. My current query looks like the following and works for most of the cases. select ?value { <http://dbpedia.org/resource/Angela_Merkel> dbpedia-owl:thumbnail ?value } However, for some cases e.g "CDU" it fails, because the entity is ambiguous. See this Example in the...

Print dateTime without specifying datatype in Sparql output

java,rdf,sparql,jena,ontology
I am using following sparql Query in Jena to print some information: String qr = "PREFIX : <http://www.example.com/tempsensor#>\n" + "PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> \n"+ "SELECT \n"+ "?Place ?Temperature ?Date \n"+ "WHERE\n"+ "{ ?ind :locatedIn ?Place .\n " + "?ind :measures ?Temperature .\n " + "?ind :onDate ?Date .\n " + "FILTER(regex(str(?Place),'Delhi',...

Rename a graph with sparql update

sparql,linked-data
Is possible to rename a graph using sparql update? The only way through that I see is this: INSERT {GRAPH uri:graphNEW {?s ?p ?o}} WHERE {GRAPH uri:graphOLD {?s ?p ?o}}; DROP GRAPH uri:graphOLD but I'm not 100% sure that all the triples and attributes (like langue tags and xsd format)...

Query multiple models within same Dataset in TDB Jena

rdf,sparql,jena,ontology,tdb
I have an ontology (say dgo.owl) and another file containing individuals for same ontology stored in rdf format. I have stored both (ontology and instances/individual file) files in TDB under different named models (say dgo_ont and homedata). Now, I want to fire different SPARQL queries on a combination of these...

Select All That Has The Same Prefix SPARQL [duplicate]

sparql
This question already has an answer here: How to check prefix of variables in SPARQL? 1 answer I would like to return all triples where all subjects have the same prefix. PREFIX dv: <http://example.org/example_vocabulary:> SELECT DISTINCT * FROM <http://example.org/dataset.example> WHERE { ?s ?p ?o . } ...

querying RDFs using SPARQL query

sql,rdf,sparql,virtuoso
Assuming we have a dataset including the following 3 RDF triples. I want to retrieve all these three triples using sparql query. http://test.com/11/META_C1-INST predicate1 http://test.com/NO_CONTEXT/META_C0059714-INST http://test.com/23/META_C1-INST predicate1 http://test.com/NO_CONTEXT/META_C0059714-INST http://test.com/43/META_C1-INST predicate1 http://test.com/NO_CONTEXT/META_C0142817-INST Here is the query I wrote but I know it is not right: prefix pred:<http://test.com/> select distinct * where...

SPARQL: selecting people by country

sparql,dbpedia
toI am trying to select all people born in some country (e.g. Portugal) from DBPedia. I could use such request SELECT DISTINCT ?person WHERE { ?person dbpedia-owl:birthPlace dbpedia:Portugal. } But the problem is that not all people has dbpedia:Portugal as birthPlace. About 30% of people has just a town name...

URLError with SPARQLWrapper at sparql.query().convert()

python,sparql,ipython-notebook,fuseki,sparqlwrapper
I try a small python script to test my SPARQL request. However, just the next simple code doesn't work. from SPARQLWrapper import SPARQLWrapper, JSON import rdflib #connect to the sparql point sparql = SPARQLWrapper("http://localhost:3030/sparql") #SPARQL request sparql.setQuery(""" 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 xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX...

MarkLogic 8 - Node.js Client API - Can I do a SPARQL Query?

node.js,sparql,marklogic
As the title says, I want to know if I can do a SPARQL query in the node.js client API or if I need to use the Server Side Javascript API.

Replace variables within a SPARQL query in Jena

rdf,sparql,jena
I need to replace some variables(indx, placx, datx, tempx) within a SPARQL query and for the same I am using following code: ParameterizedSparqlString ps = new ParameterizedSparqlString(); ps.setCommandText("INSERT DATA" + "{" + ":indx :locatedIn :placx ;" + ":onDate datx ;" + ":measures tempx ." + "}"); ps.setIri(":","http://www.example.com/tempsensor#"); ps.setLiteral("indx",ind); ps.setLiteral("placx",plac); ps.setLiteral("datx",dat);...

Simple SPARQL query on dbpedia results doesn't match expectations

sparql,dbpedia
I am struggling with the following SPARQL query executed via at DBpedia's SPARQL endpoint: select (count(?abstract) as ?count) where { <http://dbpedia.org/resource/Linked_Data> dbpedia-owl:abstract ?abstract . } SPARQL seems pretty simple and when I look at the linked data page, it appears that expected result would be 9. But the actual response...

Can I merge an unknown named graph with an other in a SPARQL query?

syntax,merge,rdf,sparql
I want to query on two different named graphs as the default graph with SPARQL : SELECT * FROM <graph1> FROM <graph2> WHERE{ ... } My problem is that I don't know the URI of graph1, but I know a specific triple of graph1 allowing me to find his URI....

How to filter DBpedia results in SPARQL

java,sparql,jena,dbpedia
I have a little problem... if I have this simple SPARQL query SELECT ?abstract WHERE { <http://dbpedia.org/resource/Mitsubishi> <http://dbpedia.org/ontology/abstract> ?abstract. FILTER langMatches( lang(?abstract), 'en')} I have this result: SPARQL Result and it has a non-English character... is there any idea how to remove them and retrieve just English words?...

Sparql Construct on a service

rdf,sparql,semantic-web
Is it possible to perform a sparql construct out of a Where clause on a remote enpoint ? CONSTRUCT { ?idbcountry skos:definition ?def . } WHERE { ?idbcountry a skos:Concept . ?idbcountry rdfs:label ?label . FILTER(lang(?label) = "en") Service <http://dbpedia.org/sparql> { ?s a <http://dbpedia.org/ontology/Country> . ?s rdfs:label ?label . ?s...

SPARQL: Unresolved prefixed name: dbpprop:author

java,sparql,dbpedia
I'm running this query. It works fine on DBpedia (http://dbpedia.org/sparql), but it doesn't work in my Java code: PREFIX res: <http://dbpedia.org/resource/> PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> SELECT ?book WHERE { ?book a dbpedia-owl:Book . ?book dbpprop:author ?author . ?author dbpprop:name ?name FILTER regex(?name, "Agatha Christie", "i") } Infact, as stated by the...

getting all dbpedia predicate list [duplicate]

rdf,sparql,dbpedia
This question already has an answer here: SPARQL query to get all class label with namespace prefix defined 2 answers I am trying to get all dbpedia predicate (labels of property). Check this link http://dbpedia.org/page/Akshay_Kumar I wan to get, dbpedia-owl:abstract dbpedia-owl:birthDate dcterms:subject dc:description rdfs:label owl:sameAs foaf:givenName in short, all...

How to write a SPARQL query for retrieving data from OWL file

java,sparql,jena,owl,protege
I have generated an owl file using Protege. Now I wish to access all the stationCode property values of all instances of a class RailwayStation from it. My OWL file contains the following format <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:swrlb="http://www.w3.org/2003/11/swrlb#" xmlns:xsp="http://www.owl-ontologies.com/2005/08/07/xsp.owl#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:protege="http://protege.stanford.edu/plugins/owl/protege#"...

Fuseki indexed (Lucene) text search returns no results

rdf,sparql,jena,owl,fuseki
I have a very large ontology RDF file (almost 4M instances) that I'm currently streaming via Fuseki v2.0.0. My assembler file looks like this: @prefix : <#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix text: <http://jena.apache.org/text#> . @prefix myprefix:...

Sparql query to get all classes that are subclass of a “property class”

sparql,semantic-web,owl,protege
I need to "annotate" some classes by adding a property to them. I need to do that in order to let the view layer of my application extract the correct classes. What I have done is: create an object property called uiProperty and edit these classes to make them subclass...

Select property from an Individual SPARQL

sparql,ontology
I need to get a property value from an individual in an ontology. How can I do it? I have this code, but I have to filter because I need an certain individual. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 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 oc: <http://localhost:8080/OntoSakaiWS/OntoCompetence.owl#> SELECT distinct...

How to add dot '.' in the name of individuals in Sparql?

sparql
Is it possible to have . (dot) in the name of the individuals? Something like this? SELECT ?tableName ?fieldName WHERE { ?fieldName hrdata:relatedField hrdata:ps_ti0002.EMPLID. } The dot in ps_ti0002.EMPLID is problematic....

SPARQL - Max() isn't working

sparql,semantic-web,protege
I'm trying to execute this SPARQL query in PROTEGE 2000, but the MAX function isn't working. it's like Max() isn't accepting the type of ?cpt. SELECT ?searcher (COUNT(?publication) AS ?cpt) WHERE {ont:GradeP ont:isFor ?searcher. ?publication ont:isPublishedBy ?searcher.} GROUP BY ?searcher HAVING (MAX(?cpt)) here's the exception : SparqlReasonerException: org.openrdf.query.QueryEvaluationException: Unsupported value...

dbpedia fetch entitites in language other than english

sparql,owl,wikipedia,dbpedia,foaf
I'm trying to extract entity dictionary contains person name etc. from dbpedia using sparql. PREFIX owl: <http://dbpedia.org/ontology/> PREFIX dbpprop: <http://dbpedia.org/property/> SELECT ?name WHERE { ?person a owl:Person . ?person dbpprop:name ?name . FILTER(lang(?name) = "en") } The query above did succeed, but when I change the language name to fr,...

MarkLogic 8 - SPARQL - Follow synonym chain

sparql,semantics,marklogic
Let's say I have lots of ontologies with synonyms. <term> <word>cat</word> <synonyms> <synonym>feline</synonym> </synonyms> </term> <term> <word>feline></word> <synonyms> <synonym>kitty</synonym> <synonyms> </term> How can I write a SPARQL query such that I can give it the word cat and it will give me all the synonyms of cat as well as...

Graph Databases vs Triple Stores - when to use which?

neo4j,sparql,graph-databases,orient-db,triplestore
I know that there are similar questions around on Stackoverflow but I don't feel they answer the following. Graph Databases to my understanding store data following mostly this schema: Table/Collection 1: store nodes with UID Table/Collection 2: store relations referencing nodes via UID This allows storing arbitrary types of graphs....

How to check prefix of variables in SPARQL?

sparql,dbpedia,virtuoso
I want to find how many resource is there in an RDF but I can't find any tutorial to explain how can I check the prefix of variables in my SPARQL. I have tried this: select count(?x) where { res:?x ?p ?v } but it has syntax error. I am...

Filter SELECT output by string in Spaql

filter,sparql
I have a Sparql query like this : PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX hrdata:<http://www.hrdata.com/ontologies/hrdata.owl#> SELECT ?tableName2 ?fieldName ?primaryKey1 ?primaryKey2 ?tableName1 WHERE { ?tableName1 hrdata:hasField hrdata:EFFDT. ?fieldName hrdata:relatedField hrdata:EFFDT. ?tableName2 hrdata:hasField ?fieldName....

sparql with extended characters

sparql,dbpedia,virtuoso
I am trying to query dbpedia using sparql and running into a problem with extended characters for accents etc. For example this query for Albrecht_Dürer select ?abstract ?thumbnail where { dbpedia:Albrecht_D%C3%BCrer dbpedia-owl:abstract ?abstract ; dbpedia-owl:thumbnail ?thumbnail . filter(langMatches(lang(?abstract),"en"))} I read a post on here suggesting using the \u switch for...

Optimize SPARQL Query

sparql
I have query that finds similar tastes in movies. Such that the absolute value of difference between average rankings of users over same genre is less that 1: SELECT ?p ?p1 ?genre WHERE{ ?p movies:hasRated ?rate. ?p1 foaf:knows ?p. ?rate movies:ratedMovie ?mov. ?rate movies:hasRating ?rating. ?mov movies:hasGenre ?genre. ?p1 movies:hasRated...

Counting with SPARQL: how to get results in one row?

rdf,sparql,sesame
Trying to get three (or more count result in the same SPARQL query: SELECT ?cs ?bs ?ws WHERE { { SELECT (COUNT(?c) AS ?cs) WHERE { ?c a :OneThing . }} UNION { SELECT (COUNT(?b) AS ?bs) WHERE { ?b a :AnotherThing . } } UNION { SELECT (COUNT(?w) AS...

Error while querying DBPedia using Apache Jena

java,sparql,semantic-web,dbpedia,apache-jena
import java.sql.ResultSet; import java.sql.SQLException; import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.QueryExecutionFactory; import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSetFormatter; public class sparq { public static void main (String[] args) throws SQLException { String queryString= "PREFIX dbpedia: <http://dbpedia.org/resource/>"+ "PREFIX category: <http://dbpedia.org/resource/Category:>"+ "PREFIX skos:...

SPARQL algebra: Excluding nodes based on triples they have

sparql,semantic-web,linked-data,turtle,triples
Take this graph: :thing1 a :Foo ; :has :A ; :has :B . :thing2 a :Foo ; :has :B ; :has :A . :thing3 a :Foo ; :has :A ; :has :B ; :has :C . I want to select :thing1 and :thing2, but NOT :thing3. Here is the SPARQL...

SPARQL Group-Concat not working

rdf,sparql,jena
I've got an RDF graph element looking like this using Android & Jena: <ns0:CalendarItem rdf:about="http://my.url.com/ontologies/mash-up#CalendarItem-uh0cjvnuehhvfjpgppiggmpjac"> <ns0:attendee rdf:resource="http://my.url.com/ontologies/mash-up#Person-2de52a85-3107-4d82-a361-cca11afabdc8" /> <ns0:attendee rdf:resource="http://my.url.com/ontologies/mash-up#Person-3b0e0333-5693-43e7-bb6e-af06f7df9b12" /> <ns0:attendee...

sparql - use of curly braces

rdf,sparql,semantic-web
Hello I have a simple question regarding sparql queries. does the curly braces have any effect in where clause ? For ex: Is there a difference between { ?s1 ab:wasBornIn "Berlin". ?s1 ?p1 ?o1 } { ?s2 ab:someProperty "SomeLiteral". ?s2 ?p2 ?o2 } AND { ?s1 ab:wasBornIn "Berlin". ?s1 ?p1...

Protege Equivalent to query

sparql,semantics,semantic-web,protege4
Please help to list all Mealcourse from the wine Ontology or happy to receive useful links like this one :Sparql query on restriction list (Equivalent To) in protégé MealCourse and (hasFood value Pizza) and(hasDrink value Wine) Thank you...

Why does STRAFTER return blank data in json binding in angular?

json,string,sparql
I am using angular to bind the results of a SPARQL query. It works nicely until I attempt to bind data returned from queries using the SPARQL "STRAFTER" or "REPLACE" functions (code below) which returns blank data in $scope. But the same query works fine if I run it directly...

Does Jena support enforcing OWL constraints during a SPARQL Update query?

sparql,jena,jena-rules
I'm trying to figure out if Jena (or any other SPARQL Update server) will enforce ontological constraints. For example, I want to enforce that only entities which have type x are allowed to have property y and the value of the property must have type z. I think this is...

Why am I getting “GC overhead limit exceeded” when I use “arq” to query local rdf files

rdf,sparql,freebase
I am using ARQ in order to query local RDF files. The command that I am using is the following: ./arq --data /home/datasets/a-m-00027.nt --results CSV --query myQuery.sparql myQuery.sparql contains the query: PREFIX basekb:<http://rdf.basekb.com/ns/> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?x FROM </home/data/a-m-00027.nt> WHERE {?x rdf:type basekb:music.release} LIMIT 10 Exception Exception in thread "main"...

Does ARQ support SPARQL 1.1 Date and Time Functions?

java,rdf,sparql,jena,arq
I have been trying to do some formatting of date/time values to make them display as string literals in the result. I am using Jena ARQ from apache-jena-2.11.0 . PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX prov: <http://www.w3.org/ns/prov#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?activity ?agent ?time ?time (YEAR(?time) as ?year )...

sparql rdf fuseki how can i filter date in graph name

rdf,sparql,fuseki
I got a lot of graph names on jena fuseki rdf store, These are the names of my graph: | <http://stormsmacs/tests/2015-03-03T04:27:57Z> | | <http://stormsmacs/tests/2015-03-03T05:20:59Z> | | <http://stormsmacs/tests/2015-03-03T05:22:29Z> | | <http://stormsmacs/tests/2015-03-03T05:25:03Z> | | <http://stormsmacs/tests/2015-03-03T05:27:01Z> | | <http://stormsmacs/tests/2015-03-03T05:30:37Z> | | <http://stormsmacs/tests/2015-03-03T05:44:02Z> | | <http://stormsmacs/tests/2015-03-03T05:52:19Z> | |...

Federated query with secured SPARQL endpoint

sparql,jena,triplestore,federated,stardog
I'm trying to use federated queries with Jena via a Fuseki endpoint. With the SERVICE keyword in my SPARQL query, I'm connecting to a Stardog endpoint. As it's a secured URL, the endpoint is specified as follows: http://admin:[email protected] As this is not secure, Jena shows the following message: Code: 36/HAS_PASSWORD...

Get geographical coordinates of a particular place from DbPedia

sparql,semantics,ontology,dbpedia
I need to get the co-ordinates of some particular places from DbPedia. For the same I am using following snippet: PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> PREFIX dbo: <http://dbpedia.org/ontology/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT * WHERE { ?x foaf:name 'Mumbai'. ?x dbo:Place 'Mumbai'. ?x geo:lat ?lat . ?x geo:long ?long . } On running...

SPARQL why are there both DELETE and WHERE conditions?

rdf,sparql,triplestore,sparul
Recently I was deleting some data according to a matching pattern ?s a :answers and I notices that I could only get the deletion to correctly proceed if I had both condition blocks as the same: PREFIX : <http://localhost:2020/vocab/> DELETE { ?s a :answers } WHERE { ?s a :answers...

SPARQL: union on dbpedia changes birthdate

union,sparql,dbpedia
I'm facing a strange behavior by using "union" on the endpoint http://de.dbpedia.org/sparql. By using SELECT distinct * WHERE { { ?name dcterms:subject category-de:Haus_Liechtenstein. ?name rdf:type foaf:Person. ?name <http://dbpedia.org/ontology/birthDate> ?birthdate. Optional {?name dbpedia-owl:deathDate ?deathDate.} Optional {?name <http://de.dbpedia.org/property/gnd> ?gnd.} } filter (!bound(?deathDate)) } Order BY ASC (?birthdate) the birthdate of "Marie Kinsky"...

SPARQL - Order By “duplicates”/“rename” property, why?

order,rdf,sparql,semantic-web,virtuoso
In my Virtuoso (07.00.3203) SPARQL endpoint: http://opendata.caceres.es/sparql If I make this simple query: select ?uri ?label ?itineraPaso where { ?uri a om:Procesion. ?uri rdfs:label "Amor el jueves santo."@es . ?uri om:itineraPaso ?itineraPaso. ?itineraPaso rdfs:label ?label. } order by (?label) I get this output: It is like the labels of the...

Counting numbers of DBpedia wikilink and external link using SPARQL

r,sparql,dbpedia,linked-data
I am currently querying DBPedia for a list of person names by using the SPARQL package in R. And now I am working on counting of different categories for one person, such as the number of wikilink or external_link. But I only know to count all the items together per...

Why is dbpedia-owl:wikiPageRedirects not returning the full set of redirect links? (Sparql)

sparql,dbpedia
I am using the following query : select ?value where { <http://dbpedia.org/resource/Paris> dbpedia-owl:wikiPageRedirects* ?value } in order to retrieve the wikiPageRedirects property of Paris. Based on dbpedia Paris has more than 20 redirect links. Why am I only retrieving the first one? ...

Datatype dataTime insertion in ontology with SPARQL queries

java,rdf,sparql,jena,ontology
I am manually trying to insert the data in owl file with following SPARQL command: qry = "PREFIX : <http://www.example.com/tempsensor#>" + "INSERT DATA" + "{" + ":ind1 :locatedIn :Delhi ;" + ":onDate "+ "2014-10-01T00:10:10"^^xsd:dateTime +" ;" + ":measures 13 ;" + " :hasUnit Celsius ." + "}" ; UpdateAction.parseExecute(qry,ontmod); On...

Unexpected End of Stream while trying to tokenise sparql query

rdf,sparql,xml-namespaces
i have this my rdf file and i try to get all triples from specific namespace 'ns1' <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:ns1="http://www.w3.org/TR/rdf-schema/#" xmlns:property="http://www.SyrianDNA.com/property#" xmlns:info="http://www.SyrianDNA.com/info#"> <rdf:Description rdf:about="http://www.SyrianDNA.com/resource/monuments"> <ns1:be rdf:resource="http://www.SyrianDNA.com/resource/Syria"/>...

How to get a single name for multiple name properties in DBPedia with SPARQL?

sparql,owl,dbpedia
I need to get persons' names from DBPedia, but the problem is that not every person has the dbpprop:fullname property, sometimes it only has the dbpprop:name or the rdfs:label property. To clarify: I want to query for the name with a preference for the first property, if that doesn't exist...

SPARQL query restric answer

rdf,sparql,ontology
I have the following query: PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX rec:<http://www.receta.org#> SELECT ?r (count(distinct ?Ingrediente) as ?oi) { ?r rec:Ingrediente ?Ingrediente. filter not exists { ?r rec:Ingrediente ?other_ingredient filter( ?other_ingredient not in ( rec:Aceite, rec:Cebolla ) ) } } GROUP BY ?r...

Get position of item in rdf type sequence with sparql

sequence,rdf,sparql
i have a sequence encoded like this in rdf: _:blanknode <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq>. _:blanknode <http://www.w3.org/1999/02/22-rdf-syntax-ns#_0> uri:a. _:blanknode <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1> uri:b. _:blanknode <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2> uri:c. now i want to have the position of a given uri within this list. is there something like: SELECT ?position WHERE { _:blanknode...

Virtuoso Jena provider query alias syntax

java,alias,sparql,jena,virtuoso
I have in Java the following code, that uses the Virtuoso Jena provider API. I would like to do a query using an alias. I tried putting parenthesis but nothing worked. If I put the same query in the endpoint directly it works. query = "select ?a AS ?count where...

Sparql query not showing results

rdf,sparql,jena,owl,ontology
I have an ontology (dgo.owl) and a simple program (SparqlQuery.java) to query the same ontology. On running the query I do not get any results. After debugging for a long time I thought it would be good to put it in the community. The query script is as: OntModel ontmodque...

Is it possible to Filter Graphs in a way that they at most contain requested Data?

sparql
Let me start with an example query to explain my problem: SELECT ?g ?s ?p ?o WHERE { {GRAPH ?g { ?s ?p ?o. OPTIONAL{ ?s ab:temperature ?temperature.} FILTER (?temperature = 20) FILTER NOT EXISTS {?s ab:person ?person} } } } This query gives me all graphs (in this case...

Virtuoso 37000 Error SP030

sparql,semantics,semantic-web,virtuoso
why is showing this error, i see in the sparql query is correct, i don't see any mistake in prefix. PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> PREFIX type: <http://dbpedia.org/class/yago/> PREFIX prop: <http://dbpedia.org/property/> SELECT ?country_name ?population WHERE { ?country rdf:type dbpedia-owl:Country; rdfs:label ?country_name ; prop:populationEstimate ?population . FILTER (?population > 2334456) . FILTER ( lang(?country_name)...

sparql to retreive the value of a min constraint

sparql,jena
How can I retreive a min constraint on a class' attribute using sparql? I have value min 1000 decimal, and I would like to get 1000 Thanks...

How to query multiple tables using ARQ jena?

sparql,jena,arq
Overview I am using ARQ in order to query local RDFfiles. The query is applied on 5 files which are: a_m.nt, description.nt, labels.nt, links.nt, literals.nt Information is modeled as a set of triples: subject predicate object Algorithm First I want to select specific topics from a_m.nt file. Second I want...

SPARQL subquery in DBpedia

sparql,dbpedia
I want to filter a resource that is used as "join" in the query. For example, given a DBpedia resource, i need to return the label of resources linked by sameAs property and has "pt" in its URI. I am using the following query: SELECT ?label { <http://dbpedia.org/resource/Category:Algorithms> owl:sameAs ?nomePT....

SPARQL combine - concatenate two columns into one

sparql,sparqlwrapper
I'm a newbie to SPARQL, and I would like to combine two columns into one initial table a|b|1 c|d|2 wanted table a|b c|d b|1 d|2 its like creating two different tables and putting them one on the other. I need that to make a visualisation using d3sparql which takes this...

Regex SPARQL query

java,regex,sparql,turtle
Here is my SPARQL query: String queryString = "SELECT ?URI " + "WHERE{ ?URI ?predicate ?object ." + "FILTER regex(?URI, \"p\", \"i\")}"; Query query = QueryFactory.create(queryString); QueryExecution qexec = QueryExecutionFactory.create(query, model); try { ResultSet results = qexec.execSelect(); while(results.hasNext()) { QuerySolution soln = results.nextSolution(); Resource z = (Resource) soln.getResource("URI"); System.out.println(z.toString()); }...

Storing separately individuals and ontology in sesame store

sparql,semantic-web,sesame
I have an ontology that I imported in a sesame repository. I want to add individuals for the classes that are defined in my ontology. Is it possible to add the individuals into another repository and not in the one that has stored the ontology? If this is possible how...

Why do we need Fuseki Server?

sparql,jena,semantic-web,fuseki,tdb
I am developing an application, which is using triple store (Jena TDB). It is clealy mentioned that TDB Supports SPARQL update and Query. Also, I understood that Fuseki is SPARQL server, that supports Update and Query as well. I do not find answer do the following questions: If TDB supports...

Compare average - SPARQL

sparql
There is a dataset of users ranking movies. Need to find the users with similar taste to user1. Similar taste defined as follows: consider the average rank for genre from user1 as avgr1 and for the same genre from user2 as avgr2, then user1 and user2 have similar taste is...

return full wikipedia page for a query using dbpedia

python,sparql,dbpedia
I am using the following Code to retrieve disambiguation pages for a given query. #disambiguation function def disambiguation(name, sparql): query = "SELECT DISTINCT ?syn WHERE { { ?disPage dbpedia-owl:wikiPageDisambiguates <http://dbpedia.org/resource/"+name+"> . ?disPage dbpedia-owl:wikiPageDisambiguates ?syn . } UNION {<http://dbpedia.org/resource/"+name+"> dbpedia-owl:wikiPageDisambiguates ?syn . } }" sparql.setQuery(query) sparql.setReturnFormat(JSON) results_list = sparql.query().convert() return results_list...

Getting dates from DBPedia

sparql,dbpedia
It's my first time using DBpedia and I need to check whether a page is representing a person and if so, I need to extract his birthdate. The examples on the net have shown where the result outputs entire pages as a result and not single properties. My input is...

Count resources having a property of a certain type in SPARQL

rdf,sparql
I have data in a triple store and would like to compute the following: how many resources 'x' have the object property 'op' with at least 2 different resources 'r' of similar type 'R' as values? here is a example of such data in turtle syntax: PREFIX ex: <http://example.com> ex:doc1...

SPARQL: How do I List and count each data type in an RDF dataset?

types,count,sparql
I am trying to count the instances of each datatype in a dataset. It is a simple dataset with only three data types: integer, string and dateTime. I can get the number of datatypes (3) by querying: SELECT (COUNT(DISTINCT datatype(?o)) AS ?dTypeCount) {?s ?p ?o. FILTER (isLiteral(?o)) } GROUP BY...

SPARQL types convert uri to/from literal

sparql,sparqlwrapper
I want to write a cross ontologies request, so it takes information from two ontologies per say onto1 and onto2: select x y z where { x onto1:hasY y y onto2:hasZ Z } the problem is that the y differs in term of uri, from onto1 you get this y...

How to create a SPARQL endpoint using Virtuoso?

sparql,owl,endpoint,virtuoso
I have just setup Virtuoso and I have loaded an OWL file (created with Protege software) present on my local machine in to Virtuoso using the following code: SQL> DB.DBA.RDF_LOAD_RDFXML_MT (file_to_string_output ('antibiotics.owl'), '', 'http://myexample.com'); Now, my question is how do I access the URI myexample.com ? How do I create...

How can I retrieve a list of specific person names from DBPedia by using SPARQL query in R

r,iteration,sparql,dbpedia
I am currently using the SPARQL package in R to query DBPedia and get the information for a list of specific person names. But I only know how to query one person or the "person category", such as query= "SELECT *{ dbpedia:Veit_Dietrich ?p ?o }" qd=SPARQL(endpoint,query) df=qd$results Is there anyway...

SPARQL query to return matches on satisfied restrictions

rdf,sparql,owl
I am trying to write a query on a class with a restriction defined on it, that will determine whether the restriction has been satisfied and, if it has, return it. An example class is defined as follows: :ThingB a owl:Class ; rdfs:subClassOf :ThingA ; rdfs:subClassOf [ a owl:Restriction ;...

setting soft limit for 4store client

sparql,4store
While running the sparql queries I get the warning # hit complexity limit 20 times, increasing soft limit may give more results and this is not dependent to any particular query but for all.I wanted to know how can I increase the soft limit if I am not using the...

how to read SPARQL query and pass via $http.get

angularjs,sparql
I am trying to get some data from land registry API (http://landregistry.data.gov.uk/app/hpi/qonsole) and it uses SPARQL query. I am new to sparql queries and not sure what to pass in my param.query object and how to pass prefixes required. //myCode var req = { method: 'GET', url: 'http://landregistry.data.gov.uk/landregistry/query', headers: {...