Hi Parsa,

On 12/13/2012 01:20 PM, Parsa Ghaffari wrote:
Hi folks,

What's the best way to retrieve types (rdf:type) of a large amount of
concepts, in association with the concept itself? For instance:

[Barack_Obama:Person, United_States:Place,...]

I came up with this query:

SELECT ?c ?t {
     {<concept1> a ?t. <concept1> foaf:isPrimaryTopicOf ?c} UNION
     {<concept2> a ?t. <concept2> foaf:isPrimaryTopicOf ?c} UNION
     .
     .
     .          <== repeat for all concepts
}

Which outputs the desired result but: 1. it's slow (takes ~2.3s for
200 concepts) 2. it doesn't go beyond 200-something concepts because
apparently there's a limit on the number of nested subqueries in a
query.

Is there a better way to accomplish this?

Try to use the "IN" operator, that might help, as follows:

   SELECT ?article ?type where {
        {?resource a ?type. ?resource foaf:isPrimaryTopicOf ?article
   .filter(?resource IN (dbpedia:Barack_Obama, dbpedia:United_States,
   ....)}
   }



Regards,

Parsa


--
Kind Regards
Mohamed Morsey
Department of Computer Science
University of Leipzig

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Dbpedia-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to