Page MenuHomePhabricator

[ES-M2]: Add EntitySchema URI to RDF output
Closed, ResolvedPublic8 Estimated Story Points

Description

As a Wikidata reuser, I want to have a canonical URI for EntitySchemas in order to identify them as concepts and access them in various formats e.g. RDF.

Problem:
Although a URI scheme for EntitySchemas is being created in T225778, for it to be useful we will need to add the EntitySchema URIs in the RDF output of Items, Properties and Lexemes where EntitySchemas are addressed in the statements.

Before this is merged we will need to send an Item with a statement linking to an EntitySchema in .ttl format to @dcausse at WMF that can then be loaded into the Wikidata Query Service to see if it all is fine. (P49105)

BDD
GIVEN an EntitySchema
AND an RDF export for a Wikibase entity (Item, Lexeme etc.)
WHEN the value of a statement is an EntitySchema
THEN the EntitySchema ID in the RDF output is prefixed by wd:

Acceptance criteria:

  • A .ttl file has been sent to the WMF and has been confirmed that it doesn't break the Query Service
  • The EntitySchema ID in the RDF output is prefixed by wd: when the value of a statement is an EntitySchema

Event Timeline

In a disucssion with @Arian_Bozorg as this has potential effects on the WDQS, it is important that T336054: [ES-M2]: Confirm new the EntitySchema data type's queryability is done before any of this is merged to production, as such we will associate it to this task as a subtask.

Task Breakdown Notes:

  • In the data type registration for EntitySchema we can add a key for a rdf-builder-factory-callback and create a class to return a similar representation to https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase/+/master/repo/includes/Rdf/Values/CommonsMediaRdfBuilder.php
  • Return from this callback the full canonical URI for an EntitySchema

Change 928001 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/extensions/EntitySchema@master] Add EntitySchema URI to RDF output

https://gerrit.wikimedia.org/r/928001

Change 928001 abandoned by Hoo man:

[mediawiki/extensions/EntitySchema@master] Add EntitySchema URI to RDF output

Reason:

doh

https://gerrit.wikimedia.org/r/928001

Change 928000 had a related patch set uploaded (by Hoo man; author: Hoo man):

[mediawiki/extensions/EntitySchema@master] Add EntitySchema URI to RDF output

https://gerrit.wikimedia.org/r/928000

@hoo I tested this but some work (hopefully trivial) is required before the WDQS munger is able to interpret these URIs properly in the RDF output (created a subtask to track this work).

@hoo I tested this but some work (hopefully trivial) is required before the WDQS munger is able to interpret these URIs properly in the RDF output (created a subtask to track this work).

Please ignore, this was me not setting the test correctly, these URIs should not cause any issues, I added some tests in the codebase.

Change 928000 merged by jenkins-bot:

[mediawiki/extensions/EntitySchema@master] Add EntitySchema URI to RDF output

https://gerrit.wikimedia.org/r/928000

Michael subscribed.

This can be verified as working correctly on beta wikidata.

The Property P253078 has a Statement with linking to an EntitySchema semantic Entity.
The RDF-data for P253078 can be accessed via Special:EntityData: https://wikidata.beta.wmflabs.org/wiki/Special:EntityData/P253078.ttl

There one finds the section about that Statement. Notice the prefix in wd:E1:

s:P253078-a216dc88-4f3b-d2b3-c08b-d06bf7d15179 a wikibase:Statement,
		wikibase:BestRank ;
	wikibase:rank wikibase:NormalRank ;
	ps:P253078 wd:E1 .

That refers to

@prefix wd: <https://wikidata.beta.wmflabs.org/entity/> .

Looks good :)
Thanks so much!