Hello Ivan,
On 22/giu/2012, at 18.02, Ivan Mikhailov wrote:
> Hello Stefano.
>
> On Fri, 2012-06-22 at 17:41 +0100, Stefano Ortona wrote:
>
>>>> my query is very simple:
>>>>
>>>> "
>>>> 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
the following query:
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion