Skip to content

Instantly share code, notes, and snippets.

@rosiel
Last active September 20, 2017 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosiel/af0aaefa586f055cd2b1d4fce3d4503b to your computer and use it in GitHub Desktop.
Save rosiel/af0aaefa586f055cd2b1d4fce3d4503b to your computer and use it in GitHub Desktop.
Analysis of a Wikidata Statement

How Wikidata uses Reification to Qualify an RDF statement

The Buffy Sainte-Marie wikidata page[1] shows a qualified spousal relationship. In English,

Buffy Sainte Marie has Spouse Jack Nitzsche with start time: 19 March 1982 and end time: 25 August 2000

[1] https://www.wikidata.org/wiki/Q467027

How is this represented in RDF? The raw data about Buffy Sainte-Marie is at a special data link [2], and the complicated reification model is illustrated in a wonderful diagram in the Data Model section of the RDF Dump Format page on the Wikidata wiki [3]

[2] https://www.wikidata.org/wiki/Special:EntityData/Q467027.ttl

[3] https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format

[2] starts with a statement that this document is about wd:Q467027, corresponding to the wiki URL -> schema:about node and edge in the diagram [3]:

wdata:Q467027 a schema:Dataset ;
	schema:about wd:Q467027 ;
	cc:license <http://creativecommons.org/publicdomain/zero/1.0/> ;
	schema:softwareVersion "0.1.0" ;
	schema:version "562195051"^^xsd:integer ;
	schema:dateModified "2017-09-19T18:31:33Z"^^xsd:dateTime ;
	wikibase:statements "68"^^xsd:integer ;
	wikibase:identifiers "22"^^xsd:integer ;
	wikibase:sitelinks "20"^^xsd:integer .

Excerpts from [2] that describe the spousal property, where Q467027 is Buffy Sainte-Marie and Q709857 is Jack Nitzsche:

wd:Q467027 wdt:P26 wd:Q709857 .

wd:Q467027 p:P26 wds:Q467027-C4233343-99BD-459B-A8A3-3B1E834F432A .

wds:Q467027-C4233343-99BD-459B-A8A3-3B1E834F432A a wikibase:Statement,
		wikibase:BestRank ;
	wikibase:rank wikibase:NormalRank ;
	ps:P26 wd:Q709857 ;
	pq:P582 "2000-08-25T00:00:00Z"^^xsd:dateTime ;
	pqv:P582 wdv:e97529e3353438ce4357cf3bf3be217f ;
	pq:P580 "1982-03-19T00:00:00Z"^^xsd:dateTime ;
	pqv:P580 wdv:8f119ec2a7201d787bb9ac4c9d389c53 .
  
wdv:e97529e3353438ce4357cf3bf3be217f a wikibase:TimeValue ;
	wikibase:timeValue "2000-08-25T00:00:00Z"^^xsd:dateTime ;
	wikibase:timePrecision "11"^^xsd:integer ;
	wikibase:timeTimezone "0"^^xsd:integer ;
	wikibase:timeCalendarModel <http://www.wikidata.org/entity/Q1985727> .

wdv:8f119ec2a7201d787bb9ac4c9d389c53 a wikibase:TimeValue ;
	wikibase:timeValue "1982-03-19T00:00:00Z"^^xsd:dateTime ;
	wikibase:timePrecision "11"^^xsd:integer ;
	wikibase:timeTimezone "0"^^xsd:integer ;
	wikibase:timeCalendarModel <http://www.wikidata.org/entity/Q1985727> .

wd:Q709857 a wikibase:Item ;
	rdfs:label "Jack Nitzsche"@en ;
	skos:prefLabel "Jack Nitzsche"@en ;
	schema:description "American musician"@en .

The simplest relation was the wdt:P26, which links the two URIs.

But there's also p:P26 which connects Buffy Ste-Marie to a wikibase:Statement. That statement has ps:P26 to Jack Nitsche's node. But that statement also has the pq:P582 (start time, directly) of an actual dateTime value, AND (similar to how Buffy Ste-Marie wdt:P26 a person and Buffy Ste-Marie p:P26 a statement) the statement also has pqv:582 (start time, value node) of a value node URI.

That value node is further expressed as having a wikibase:timeValue but also a precision, timezone, and calendar model.

There are no references attached to this node, so the wdref part of the diagram is not represented here.

Properties

And things about the properties used, skipping all non-English labels for brevity:

Spouse (P26)

wd:P26 a wikibase:Property ;
	rdfs:label "spouse"@en ;
	skos:prefLabel "spouse"@en ;
	schema:description "the subject has the object as their spouse (husband, wife, partner, etc.). Use \"partner\" (P451) for non-married companions"@en ;
	a wikibase:Property ;
	wikibase:propertyType <http://wikiba.se/ontology-beta#WikibaseItem> ;
	wikibase:directClaim wdt:P26 ;
	wikibase:claim p:P26 ;
	wikibase:statementProperty ps:P26 ;
	wikibase:statementValue psv:P26 ;
	wikibase:statementValueNormalized psn:P26 ;
	wikibase:qualifier pq:P26 ;
	wikibase:qualifierValue pqv:P26 ;
	wikibase:qualifierValueNormalized pqn:P26 ;
	wikibase:reference pr:P26 ;
	wikibase:referenceValue prv:P26 ;
	wikibase:referenceValueNormalized prn:P26 ;
	wikibase:novalue wdno:P26 .

p:P26 a owl:ObjectProperty .

psv:P26 a owl:ObjectProperty .

pqv:P26 a owl:ObjectProperty .

prv:P26 a owl:ObjectProperty .

psn:P26 a owl:ObjectProperty .

pqn:P26 a owl:ObjectProperty .

prn:P26 a owl:ObjectProperty .

wdt:P26 a owl:ObjectProperty .

ps:P26 a owl:ObjectProperty .

pq:P26 a owl:ObjectProperty .

pr:P26 a owl:ObjectProperty .

wdno:P26 a owl:Class ;
	owl:complementOf _:genid31 .

_:genid31 a owl:Restriction ;
	owl:onProperty wdt:P26 ;
	owl:someValuesFrom owl:Thing 

End date (P582)

wd:P582 a wikibase:Property ;
	rdfs:label "end date"@en ;
	skos:prefLabel "end date"@en ;
	schema:description "indicates the time an item ceases to exist or a statement stops being valid"@en ;
	a wikibase:Property ;
	wikibase:propertyType <http://wikiba.se/ontology-beta#Time> ;
	wikibase:directClaim wdt:P582 ;
	wikibase:claim p:P582 ;
	wikibase:statementProperty ps:P582 ;
	wikibase:statementValue psv:P582 ;
	wikibase:statementValueNormalized psn:P582 ;
	wikibase:qualifier pq:P582 ;
	wikibase:qualifierValue pqv:P582 ;
	wikibase:qualifierValueNormalized pqn:P582 ;
	wikibase:reference pr:P582 ;
	wikibase:referenceValue prv:P582 ;
	wikibase:referenceValueNormalized prn:P582 ;
	wikibase:novalue wdno:P582 .

p:P582 a owl:ObjectProperty .

psv:P582 a owl:ObjectProperty .

pqv:P582 a owl:ObjectProperty .

prv:P582 a owl:ObjectProperty .

psn:P582 a owl:ObjectProperty .

pqn:P582 a owl:ObjectProperty .

prn:P582 a owl:ObjectProperty .

wdt:P582 a owl:DatatypeProperty .

ps:P582 a owl:DatatypeProperty .

pq:P582 a owl:DatatypeProperty .

pr:P582 a owl:DatatypeProperty .

wdno:P582 a owl:Class ;
	owl:complementOf _:genid49 .

_:genid49 a owl:Restriction ;
	owl:onProperty wdt:P582 ;
	owl:someValuesFrom owl:Thing .

Start Date (P580)

wd:P580 a wikibase:Property ;
	rdfs:label "start date"@en ;
	skos:prefLabel "start date"@en ;
	schema:description "indicates the time an item begins to exist or a statement starts being valid"@en-gb ;
	a wikibase:Property ;
	wikibase:propertyType <http://wikiba.se/ontology-beta#Time> ;
	wikibase:directClaim wdt:P580 ;
	wikibase:claim p:P580 ;
	wikibase:statementProperty ps:P580 ;
	wikibase:statementValue psv:P580 ;
	wikibase:statementValueNormalized psn:P580 ;
	wikibase:qualifier pq:P580 ;
	wikibase:qualifierValue pqv:P580 ;
	wikibase:qualifierValueNormalized pqn:P580 ;
	wikibase:reference pr:P580 ;
	wikibase:referenceValue prv:P580 ;
	wikibase:referenceValueNormalized prn:P580 ;
	wikibase:novalue wdno:P580 .
p:P580 a owl:ObjectProperty .

psv:P580 a owl:ObjectProperty .

pqv:P580 a owl:ObjectProperty .

prv:P580 a owl:ObjectProperty .

psn:P580 a owl:ObjectProperty .

pqn:P580 a owl:ObjectProperty .

prn:P580 a owl:ObjectProperty .

wdt:P580 a owl:DatatypeProperty .

ps:P580 a owl:DatatypeProperty .

pq:P580 a owl:DatatypeProperty .

pr:P580 a owl:DatatypeProperty .

wdno:P580 a owl:Class ;
	owl:complementOf _:genid50 .

_:genid50 a owl:Restriction ;
	owl:onProperty wdt:P580 ;
	owl:someValuesFrom owl:Thing .
	
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment