when I run the the query SELECT ?s ?t ... on http://dbpedia.org/sparql
pairs for each subject. All you need to do is collect all the types
for each subject.
[1] http://dbpedia.org/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=SELECT+%3Fs+%3Ft%0D%0AWHERE%0D%0A%7B+%3Fs+a+%3Ft+.+FILTER+%28+%3Fs+IN+%28%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FBerlin%3E%2C+%3Chttp%3A%2F%2Fdbpedia.org%2Fresource%2FGermany%3E%29%29+%7D&format=text%2Fhtml&timeout=0&debug=on
Post by Stefano OrtonaHello Ivan,
Hello Stefano.
"
select distinct ?0 ?1 ...?x ...?100
WHERE
{
{ <certain-dbpedia-resource> rdf:type ?x.}
}
"
Query
SELECT ?s ?t
from some graph if it is known
WHERE
{ ?s a ?t . FILTER ( ?s IN (<resource1>, <resource2>, <resource3> ...)) }
(maybe with ORDER BY by ?s for client's convenience). You can't preserve the
mapping if you return only dependent part of the mapping but not the key.
Anyway the original query is wrong, esp. if many resources have more than
one type or if at least one resource has no type at all.
Maybe I didn't explain myself properly, let's go through an example. Suppose
I have 3 resource uri, <http://dbpedia.org/resource/Spain>,
<http://dbpedia.org/resource/Cambridge>,
<http://dbpedia.org/resource/Batman>. I want to retrieve the rdf:type for
every uri. I don't want just a list of union of all types, i wanna find
every type for every single entity, so i want to able to say: types of Spain
are t11,t12,t13...t1n, types of Cambdrige are t21,t22,t23..t2n, types of
Batman are t31,t32,t33...t3n.
Using the query you suggested, the final result will contain in variable ?t
the union of all types, therefore i'm not able to distinguish types of
Spain, Cambridge and Batman.
The solution is to use a different variable for every resource, so i'm using
select distinct ?x ?y ?z
WHERE
{
{<http://dbpedia.org/resource/Spain> rdf:type ?x.}
UNION
{<http://dbpedia.org/resource/Cambridge> rdf:type ?y.}
UNION
{<http://dbpedia.org/resource/Batman> rdf:type ?z.}
}
With this query, x contains all types of Spain, y will contains all types of
Cambridge and z all types of Batman. It works also if a resource has a
multiple types, (variable will contain multiple values) and if a resource
doesn't have any type (variable will be empty).
Problem is, using that query with 97 different resources I got the line of
code limit error, any suggestion about?
Stefano
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Dbpedia-discussion mailing list
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion