I am trying to retrieve the titles of movies on http://id.dbpedia.org/page/Daftar_film_Indonesia but there is nothing on the list
I tried this queries, it runs but with no results.
SELECT DISTINCT * WHERE{
?p dbpedia-owl:Movies <http://id.dbpedia.org/resource/Daftar_film_Indonesia>.
}
what queries i can use to retrive all title of the movies ?
Related
Here is my query:
prefix dbc: <http://dbpedia.org/resource/Category:>
SELECT COUNT (?x) AS ?numberIn_Horror, COUNT (?y) AS ?numberIn_Action
WHERE { ?x dct:subject dbc:Horror_film .
?y dct:subject dbc:Action_film .}
I get a numeric output for this query however, it does not match the actual value for the number of movies present in these genres.
Is there a way to change the query so it returns the number of movies accurately.
Additionally, I am unsure as to what value it is currently returning.
Added Picture
Game look-up
Is there a way to lookup publication dates quickly in Wikidata Query Service's SPARQL to find publications of a certain date, e.g., today?
I was hoping that something like this query would be quick:
SELECT * WHERE {
?work wdt:P577 ?datetime .
BIND("2018-09-28T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> as ?now_datetime)
FILTER (?datetime = ?now_datetime)
}
LIMIT 10
However, it times out when using it on the SPARQL endpoint at https://query.wikidata.org
A range query seems neither to be quick. The query below returns after almost 30 seconds:
SELECT * WHERE {
?work wdt:P577 ?datetime .
FILTER (?datetime > "2018-09-28T00:00:00Z"^^xsd:dateTime)
}
LIMIT 1
The trick is to avoid full scan and use indexes:
VALUES:
SELECT * WHERE {
VALUES (?datetime) {("2018-09-28T00:00:00Z"^^xsd:dateTime)}
?work wdt:P577 ?datetime .
} LIMIT 10
Try it!
hint:rangeSafe:
SELECT * WHERE {
VALUES (?datetime) {("2018-09-28T00:00:00Z"^^xsd:dateTime)}
?work wdt:P577 ?date_time .
hint:Prior hint:rangeSafe true .
FILTER (?date_time > ?datetime)
} LIMIT 10
Try it!
[The rangeSafe hint] declare[s] that the data touched by the query for a specific triple pattern is strongly typed, thus allowing a range filter to be pushed down onto an index.
I'd like to have a list of most used properties in a SPARQL endpoint. The most straightforward query would be:
select ?p ( count ( distinct * ) as ?ct )
{
?s ?p ?o.
}
group by ?p
order by desc ( ?ct )
limit 1000
The problem is that there are too many triples (1.6 billions) and the server times out. So, after googling, I've also tried this, to get at least a sample statistics (yes, it's Virtuoso-specific and it's fine in my case):
select ?p ( count ( distinct * ) as ?ct )
{
?s ?p ?o.
FILTER ( 1 > <SHORT_OR_LONG::bif:rnd> (0.0001, ?s, ?p, ?o) )
}
group by ?p
order by desc ( ?ct )
limit 1000
But it times out anyway, I guess because it still has to group, count and then order. So, how can I do it? I have access to the Virtuoso relational DB (i.e., iSQL), but I cannot find docs about SQL syntax and how to select random triples from the table db.dba.rdf_quad.
EDIT: I've fixed the queries, initially they were wrong, thanks for the comments. The versions above still don't work.
OK, I've found a way, at least a partial one: Virtuoso has a command line administration tool, isql. This accepts SPARQL queries as well, in the form: SPARQL <query>;. And they're executed without timeout or result size restrictions.
This is still not good if you can only access an endpoint via HTTP, I don't quite know if that way it is possible at all.
I want to query DBpedia and use Virtuoso. In some queries which their results are too much, it returns only part of the results. For example, in the query below, the predicate http://dbpedia.org/ontology/birthplace is missing. Is there any way to get all results either from Virtuoso or any other endpoint ?
SELECT DISTINCT ( ?p AS ?outEdge )
( ?q AS ?inEdge )
( ?px AS ?dest )
( ?qx AS ?source )
WHERE {
{ <http://dbpedia.org/resource/England> ?p ?px . }
UNION
{ ?qx ?q <http://dbpedia.org/resource/England> . }
}
I want to query DBPeida and use virtuoso. In some queries which their results are too much it returns only part of the results for example in the below query the predicate http://dbpedia.org/ontology/birthplace is missing. Is there anyway to get all results either from virtuoso or any other endpoint ?
While I don't detect anything malicious or mean-spirited in your question, you're essentially asking how circumvent DBpedia's defenses against intentional and unintentional denial of service attacks. Internal limits help to ensure that too many resources aren't consumed by any particular query. The right way to get all the results from a SPARQL query, if they aren't all returned at once, is to use limit, offset, and order by, and to use multiple queries. E.g.,
#-- get first 10 results
select ... where ...
order by ?name
limit 10 offset 0
#-- get next 10 results
select ... where ...
order by ?name
limit 10 offset 10
#-- get more resuls
select ... where ...
order by ?name
limit 10 offset 20
I want to retrieve blank nodes with a SPARQL query. I am using DBpedia as my dataset. For example, when I use the following query, I got a count of about 3.4 million results.
PREFIX prop:<http://dbpedia.org/property/>
select count(?x) where {
?x prop:name ?y
}
SPARQL results
When I use the DISTINCT solution modifier, I get approximately 2.2 million results.
PREFIX prop:<http://dbpedia.org/property/>
select count(DISTINCT ?x) where {
?x prop:name ?y
}
SPARQL results
I have two questions:
Are the 1.2 million records eliminated in the second query duplicates or blank nodes or something else?
How can I retrieve blank nodes and their values from DBpedia?
Getting Blank Nodes
A query like this could be used to retrieve (up to 10) blank nodes:
select ?bnode where {
?bnode ?p ?o
filter(isBlank(?bnode))
}
limit 10
However, I get no results. It doesn't look like there are blank nodes (as subjects, anyhow) in the DBpedia data.
Using DISTINCT and duplicate results
The reason that your queries return a different number of results is that ?x's have more than one name. A query like your first one:
select count(?x) where { ?x prop:name ?y }
on data like:
<somePerson> prop:name "Jim" .
<somePerson> prop:name "James" .
would produce 2, since there are two ways to match ?x prop:name ?y. ?x is bound to <somePerson> in both of them, but ?y is bound to different names. In a query like your second one:
select count(DISTINCT ?x) where { ?x prop:name ?y }
you're explicitly only counting the distinct values of ?x, and there's only one of those in my sample data. This is one way that you can end up with different numbers of results, and it doesn't require any blank nodes.