List,
Within a few hours I got very helpful responses on Stackoverflow. See
the link.
Thanks!
Mike
On 8/18/2018 4:20 PM, Mike Bergman wrote:
List,
Here is a question I posed on Stackoverflow
(
https://stackoverflow.com/questions/51912599/get-records-for-a-list-of-mult…).
Can anyone give me pointers?
I am mapping multiple entities (Q entries) in
Wikidata for which I
need the same record of properties (P entries). For sake of this
question, say I have a list of five Wikidata entities (Q1, Q2, Q3, Q4,
Q5) for which I want to retrieve the same property records (say, P1,
P2, and P3). I know all Q and P in advance.
I understand how to pose a SPARQL query for an individual record (say
for Q1), and I also understand how to specify the return of labels
using the special SERVICE wikibase:label function for P1, P2, and P3.
First question, is there a way to loop over a list of entities (Q1 to
Q5) with a given SPARQL query using only SPARQL?
If the answer is No, does any example Python or pseudocode exist for
issuing single SPARQL queries looping over a list of external
identifiers (Q1 to Q5), say provided as an external text or CSV file?
If there is a simple way to approach this, I'd love to hear.
Thanks!
Best, Mike