2

I'm trying to retrieve entities as well as their properties that relate to Golden Gate Bridge. I used this query (https://query.wikidata.org/#SELECT%20%3Fp2%20%3Fs%0AWHERE%0A%7B%0A%20%20%09%3Fs%20%3Fp2%20wd%3AQ44440%20.%0A%7D):

SELECT ?p2 ?s
WHERE
{
    ?s ?p2 wd:Q44440 .
}

But I noticed that in the result, property "p:statement/P800" and property "wdt:P800" actually point to the same thing. They have the same id. I'm wondering why it returns both. What is their difference? How do I just get one?

I use DBpedia a lot, so I'm not familiar with they uri schemes in Wikidata, it's quite confusing.

logi-kal
  • 7,107
  • 6
  • 31
  • 43
al3xtouch
  • 491
  • 4
  • 19
  • I don't have a full answer for you, but they are not actually the same property (even though you end up on the same page when clicking the link). `p:statement/P800` expands to `http://www.wikidata.org/prop/statement/P800`, while `wdt:P800` expands to `http://www.wikidata.org/prop/direct/P800`. – Jeen Broekstra Aug 11 '16 at 04:44

1 Answers1

2

I guess it has something to do with the option to do reification on the statements itself, at least that's what I understand from the documentation here: https://www.wikidata.org/wiki/Wikidata:Glossary#Claims_and_statements That's why they use multiple namespace for the same property. You can see it better if you change your query to

SELECT ?s ?p
WHERE
{
    ?s ?p wd:Q44440 .
    ?p a owl:ObjectProperty
}

It returns, among others,

+-------------------------------------------------------------+------------------+
|                              s                              |        p         |
+-------------------------------------------------------------+------------------+
| wd:Q16803333                                                | wdt:P301         |
| wd:Q261174                                                  | wdt:P800         |
| wd:Q950029                                                  | wdt:P921         |
| wd:statement/Q16803333-12EFD280-98AF-4CA1-BEA3-5C142674827D | p:statement/P301 |
| wd:statement/Q261174-4B53E291-A47B-48E3-AE28-7FDE75849E28   | p:statement/P800 |
| wd:statement/Q950029-fd9f357a-45ff-403a-86ba-b462acb2ffbd   | p:statement/P921 |
+-------------------------------------------------------------+------------------+

In that case you can see that the subjects also have a different namespace with statement as keyword. And about those statements you could make statements as well, called reification.

UninformedUser
  • 8,397
  • 1
  • 14
  • 23
  • so can I put it this way that if I don't care about reification or a statement about a statement, I can just use items of namespace wd and properties of namespace wdt? – al3xtouch Aug 11 '16 at 17:30
  • also why do I need to add "?p a owl:ObjectProperty" to get the results displayed into a more readable table? – al3xtouch Aug 11 '16 at 17:31
  • I think you could do it that way, but to be honest I'm not a Wikidata expert. I'd suggest to ask at the Wikidata community for clarification, maybe via mailing list. – UninformedUser Aug 11 '16 at 18:14
  • btw, is there a way to get the labels of the properties? For example if I use `SELECT ?s ?sLabel ?p ?pLabel WHERE { ?s ?p wd:Q44440 . ?p a owl:ObjectProperty . SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }` I only get the urls to the properties. For property P800, the label should be "notable work" – al3xtouch Aug 11 '16 at 18:14
  • According to your 2nd comment: This was just to get rid of the triples with `schema:about` property (which is just an `rdf:Property` in the schema.org ontology. In that case is was easier to show that the subjects are also separate resources for statements. – UninformedUser Aug 11 '16 at 18:14
  • Hm, good question: the query `SELECT ?s ?p ?p2 ?o2 WHERE {?s ?p wd:Q44440 .?p ?p2 ?o2}` to get all information about the properties as well returned just the `rdf:type` statements. Maybe those labels are in a different graph which is not the default graph in the web interface. – UninformedUser Aug 11 '16 at 18:21
  • hmm, I figured I can get all the information about a property using name space `http://www.wikidata.org/entity/` `PREFIX wd: SELECT * WHERE {wd:P800 ?p ?o}`, this is so cumbersome. I just want to get all property labels and subject labels in one query – al3xtouch Aug 11 '16 at 18:38