How to query sparql by value - sparql

I have ontology data (ontobible.owl) and its ready to download in https://teamtrainit.com/ontobible.owl
I have open it in Protege (Protege-5.5.0) like this screenshot
how to sparql query to select data where Verse is 1CH11_1 or 1CH11_2 and display verse_text, hasPerson,hasPlace?
Edit:
i've learn about sparql and try with dbpedia, I run this query in dbpedia,
SELECT * WHERE {
?person rdfs:label "Jesus"#en;
dbo:abstract ?abstract
}
its works
but when I try similar query with ontobible.owl in protege, it doesnt works

Related

How to get 'is dct:subject of' property from dbpedia using SPARQL [duplicate]

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?
Your direction was wrong.
select distinct *
where {
?x dbpedia-owl:wikiPageRedirects <http://dbpedia.org/resource/Paris>
}
Artemis's answer is right; the "direction" in the query is wrong. It's worth explaining that a bit more, though. On the DBpedia "page", you'll see lots of data like:
dbpedia-owl:area 105400000.000000 (xsd:double)
dbpedia-owl:country dbpedia:France
dbpedia-owl:inseeCode 75056 (xsd:integer)
dbpedia-owl:mayor dbpedia:Anne_Hidalgo
These mean that DBpedia contains triples where these are the predicates and objects. That is, DBpedia contains a triple:
dbpedia:Paris dbpedia-owl:country dbpedia:France
On other hand, you'll also see things like "is … of":
is dbpedia-owl:beatifiedPlace of dbpedia:Daniel_Brottier
is dbpedia-owl:billed of dbpedia:René_Duprée
These mean that dbpedia:Paris the object of triples with these subjects and predicates. E.g., DBpedia contains the triple
dbpedia:René_Duprée dbpedia-owl:billed dbpedia:Paris
The redirects properties that you're seeing are like this:
is dbpedia-owl:wikiPageRedirects of dbpedia:City_of_Love_(city)
dbpedia:Département_de_Paris
dbpedia:Departement_de_Paris
dbpedia:FRPAR
That means that there are a bunch of triples of the form:
?something dbpedia-owl:wikiPageRedirects dbpedia:Paris
and that means that your query needs to be
select ?resource where {
?resource dbpedia-owl:wikiPageRedirects dbpedia:Paris
}
SPARQL results

Sparql Select all different languages appear on Warehouse

I am trying to select all different language tags that appear on a sparql endpoint (like DBpedia) and display them as a list, but with no luck until now.
A simple Example of Triples on Endpoint.
<person1> rdfs:label "name1"#en
<person1> rdfs:label "name2"#fr
<person2> rdfs:comment "comment"#en
<person2> rdfs:label "name3"#el
The goal is to create a sparql query that returns:
fr
en
el
Is there any way to select languages tags efficiently?
Is there a solution for any sparql version(1.0,1.1) ?
Given your tags include SPARQL, you could try this:
SELECT DISTINCT ?lang
WHERE {
?s ?p ?o .
BIND (lang(?o) AS ?lang)
}

sparql empty result for dbpedia-owl:influenced property

I am trying to retrieve the value of the dbpedia-owl:influenced in this page e.g: Andy_Warhol
The query I write is:
PREFIX rsc : http://dbpedia.org/resource
PREFIX dbpedia-owl :http://dbpedia.org/ontology
SELECT ?o WHERE {
rsc:Andy_Warhol dbpedia-owl:infuenced ?o .
}
but it is EMPTY.
Strange is that when I have the same query for another property from the ontology type like "birthPlace", the sparql engine gives the result back:
SELECT ?o WHERE {
rsc:Andy_Warhol dbpedia-owl:birthplace ?o .
}
which is a link to another resource:
dbpedia.org/resource/Pittsburgh
I am just confused how to write this query?
besides several formal errors addressed in the answer of #Joshua, there is also the semantic problem that the properties you are looking for - in this case - seem to be found on the entities that were influenced.
this query might give you the desired results
PREFIX rsc: <http://dbpedia.org/resource/>
PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
SELECT ?s WHERE {
?s dbpedia-owl:influencedBy rsc:Andy_Warhol .
}
run query
There are a few issues here. One is that the SPARQL, as presented, isn't correct. I edited to make the prefix syntax legal, but the prefixes were still wrong (they didn't end with a final slash). You don't want to be querying for http://dbpedia.org/resourceAndy_Warhol after all; you want to query for http://dbpedia.org/resource/Andy_Warhol. Some standard namespaces for DBpedia are listed on their SPARQL endpoint. Using those namespaces and the SPARQL endpoint, we can ask for all the triples that have http://dbpedia.org/resource/Andy_Warhol as the subject with this query:
SELECT * WHERE {
dbpedia:Andy_Warhol ?p ?o .
}
In the results produced there, you'll see the one using http://dbpedia.org/ontology/birthPlace (note the captial P in birthPlace), but you won't see any triples with the predicate http://dbpedia.org/ontology/infuenced, so it makes sense that your first query has no results. Do you have some reason to suppose that there should be some results?

dbpedia SPARQL query for finding artist properties

I'm trying to get details about an artist via DBPedia and the SPARQL query language, however, it seems almost impossible (with my understanding) of how to get certain pieces of information.
I'm trying to get an Artist and pull information such as their Hometown. I'm guessing the query should be something similar to that of:
SELECT ?c WHERE {
?b <http://dbpedia.org/property/Artist> <http://dbpedia.org/resource/Arctic_Monkeys>.
?b <http://www.w3.org/2002/07/owl#ObjectProperty> <http://dbpedia.org/ontology/hometown>.
?b rdfs:label ?c.
}
If anyone could enlighten me to how it should be done, that would be amazing.
I've been trying out the queries at:
http://dbpedia.org/sparql
If you want to find the label of their hometown, try this:
SELECT ?hometownLabel WHERE {
<http://dbpedia.org/resource/Arctic_Monkeys> <http://dbpedia.org/ontology/hometown> ?hometown .
?hometown <http://www.w3.org/2000/01/rdf-schema#label> ?hometownLabel .
}
Maybe you don't have a good understanding of SPARQL syntax. Unlike SQL, SPARQL search results by writing some triples with unknow variables in the WHERE clause.
you can try:
prefix dbpedia-owl:<http://dbpedia.org/ontology/>
SELECT ?c
WHERE {
<http://dbpedia.org/resource/Arctic_Monkeys> dbpedia-owl:hometown ?c.
}
With this search, you will get Arctic_Monkeys' hometown.
SELECT ?hometown
WHERE {
dbr:Arctic_Monkeys dbo:hometown ?label.
?label rdfs:label ?hometown.
FILTER(langMatches(lang(?hometown), "en"))
}

Problem with a select SPARQL query on dbpedia

I try to get some data about a city using Sparql query on DBpedia. The problem is I can't get the query to work.
Currently I do something like this:
SELECT ?title,?name,?abs WHERE {
?title skos:subject
<http://dbpedia.org/resource/Category:Cities%2C_towns_and_villages_in_Slovenia>.
?title dbpprop:officialName ?name.
?title dbpprop:abstract ?abs
}
I get all the towns, villages from Slovenia with all the data. The problem is, I would like to get the data (officialName and/or abstract) only for one town, for example Ljubljana. So I tried some things like this:
SELECT ?name WHERE {
?name dbpprop:officialName
<http://dbpedia.org/resource/Ljubljana>.
}
Of course it does not work. I don't exactly know why, though :), but I've been experimenting a bit and noticed some things like if I put
?name skos:subject <http://dbpedia.org/resource/Category:Ljubljana>.
I get some results (which are not relevant to me, but anyway), but if I put
?name skos:subject <http://dbpedia.org/resource/Ljubljana>.
there are no results for anything though element skos:subject exists on the page http://dbpedia.org/resource/Ljubljana.
Could someone please explain why the second example does not work and how to get the result I would like to have?
Thanks,
Ablak
Thanks
You want to query for <http://dbpedia.org/resource/Ljubljana> as a subject, not an object; this would replace your ?title binding in the SPARQL query, for example:
SELECT ?name, ?abs WHERE {
<http://dbpedia.org/resource/Ljubljana>
skos:subject <http://dbpedia.org/resource/Category:Cities%2C_towns_and_villages_in_Slovenia> ;
dbpprop:officialName ?name ;
dbpprop:abstract ?abs .
}
This is why your graph match ?name skos:subject <http://dbpedia.org/resource/Ljubljana> does not return the expected results; the URI for Ljubljana should be the subject of the statement(s) you want to match.