One thing though: the shorthand prefixed URI format (e.g. dbpedia:United_States) raises a syntax error when there's a % or () in the query (e.g. dbpedia:Archive_(band)) is there a way to get around that? It obviously shortens the query significantly.
Thanks. On Thu, Dec 13, 2012 at 1:56 PM, Parsa Ghaffari <[email protected]> wrote: > Mohamed, > > That's gorgeous. After I sent the first email, I came up with: > > SELECT ?c ?t {?c a ?t. FILTER(?c = dbpedia:Barack_Obama || ?c = > dbpedia:United_States || ...)} > > But this seems even faster (is that known as a fact?). Thanks a lot. > > Dimitris, > > Thanks but I need to serve the data through Virtuoso. > > On Thu, Dec 13, 2012 at 1:09 PM, Mohamed Morsey > <[email protected]> wrote: >> 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 > > > > -- > Parsa Ghaffari > Twitter | LinkedIn | AYLIEN -- Parsa Ghaffari Twitter | LinkedIn | AYLIEN ------------------------------------------------------------------------------ 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
