Reputation: 13245
This is the query I have,
PREFIX dbr: <http://dbpedia.org/resource/>
SELECT ?p ?x
WHERE
{
dbr:Australia ?p ?x
}
I need only URI in the results. x
and p
should be in the format of http://dbpedia.org/resource/something
and http://dbpedia.org/property/something
. Please help me to go through this.
Upvotes: 0
Views: 591
Reputation: 9434
This will get what you're asking for --
PREFIX dbr: <http://dbpedia.org/resource/>
SELECT ?p ?x
WHERE
{
dbr:Australia ?p ?x
FILTER ( STRSTARTS ( STR ( ?p ), "http://dbpedia.org/property/" ) )
FILTER ( STRSTARTS ( STR ( ?x ), "http://dbpedia.org/resource/" ) )
}
ORDER BY ?p ?x
The results of the following might be better, though it doesn't restrict all URIs to the two prefixes you've wished for. Note that the next update of the DBpedia dataset (partially visible now on the DBpedia-Live endpoint) will change much of the data, and http://dbpedia.org/property/
will no longer be the prefix for most of Australia's attributes/predicates --
PREFIX dbr: <http://dbpedia.org/resource/>
SELECT ?p ?x
WHERE
{
dbr:Australia ?p ?x
FILTER ( ISURI ( ?p ) )
FILTER ( ISURI ( ?x ) )
}
ORDER BY ?p ?x
Upvotes: 2