Hi,
I'm trying to get to grips with using Wikidata as a Linked Data resource, and would welcome some guidance.
Using the SPARQL end-point [1], I submit a query which looks for people:
PREFIX ps: http://www.wikidata.org/prop/statement/ PREFIX wd: http://www.wikidata.org/entity/ describe ?s where {?s ps:P31 wd:Q5 . } limit 100
The results give a set of wd:statement URLs (e.g. [2]), each of which has the required 'P31 Q5' property and four others (wikibase:rank, rdf:type and a couple of 'derived from' properties). So this looks like a simple statement, which is in some sense a property of the person I am looking for. I would then expect to refine my SPARQL query to pick up the person about whom this statement was made, and thereby get access to their other properties.
However, when I dereference the statement URL, I find that I have magically arrived at the URL of the person themselves [3].
While this is all very clever, it leaves me at a loss as to how I can access the properties of the person using SPARQL.
Thanks,
Richard
[1] https://query.wikidata.org/ [2] http://www.wikidata.org/entity/statement/q23-935f9100-47ca-f387-7946-45f9db0... [3] https://www.wikidata.org/wiki/Q23 when accessed through the browser, or https://www.wikidata.org/wiki/Special:EntityData/q23 when accessed through curl with a suitable Accept header
Hi,
To respond (partially) to my own question: SPARQL does do the job for me, e.g.:
select distinct ?person where {?person ?p ?prop . ?prop ps:P31 wd:Q5 . } limit 100
returns a list of person URLs. So I'm happy. However, I am still intrigued as to the logic behind the redirection of the statement URL to the URL for the person about whom the statement is being made.
Thanks,
Richard
On 2016-06-13 10:51 AM, Richard Light wrote:
Hi,
I'm trying to get to grips with using Wikidata as a Linked Data resource, and would welcome some guidance.
Using the SPARQL end-point [1], I submit a query which looks for people:
PREFIX ps: http://www.wikidata.org/prop/statement/ PREFIX wd: http://www.wikidata.org/entity/ describe ?s where {?s ps:P31 wd:Q5 . } limit 100
The results give a set of wd:statement URLs (e.g. [2]), each of which has the required 'P31 Q5' property and four others (wikibase:rank, rdf:type and a couple of 'derived from' properties). So this looks like a simple statement, which is in some sense a property of the person I am looking for. I would then expect to refine my SPARQL query to pick up the person about whom this statement was made, and thereby get access to their other properties.
However, when I dereference the statement URL, I find that I have magically arrived at the URL of the person themselves [3].
While this is all very clever, it leaves me at a loss as to how I can access the properties of the person using SPARQL.
Thanks,
Richard
[1] https://query.wikidata.org/ [2] http://www.wikidata.org/entity/statement/q23-935f9100-47ca-f387-7946-45f9db0... [3] https://www.wikidata.org/wiki/Q23 when accessed through the browser, or https://www.wikidata.org/wiki/Special:EntityData/q23 when accessed through curl with a suitable Accept header
-- *Richard Light*
Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
Am 13.06.2016 um 12:12 schrieb Richard Light:
returns a list of person URLs. So I'm happy. However, I am still intrigued as to the logic behind the redirection of the statement URL to the URL for the person about whom the statement is being made.
The reason is a practical one: the statement data is part of the data about that person. It's stored and addressed as part of that person's information. We currently do not have an API that would return only the statement data itself, so if you dereference the statement URI, you get all the data we have on the subject, which includes the statement.
This is formally acceptable: dereferencing the statement URI should give you the RDF representation of that statement (and possibly more - which is the case here). The statement URI does not resolve to the the subject or the object, but to Statement itself, which is an RFC resource in it's own right.
Perhaps the confusion arises from the fact that the SPARQL endpoint offers two views on Statements: the "direct" or "naive" mapping (using the wds prefix) in which a Statement is modeled as a single triple, and does not have a URI of it's own. And the "full" or "deep" mapping, where the statement is a resource in it's own right, and we use several triples to describe its type, value, rank, qualifiers, references, etc.
wikidata-tech@lists.wikimedia.org