Teester / entityshape

An api to compare a wikidata item with an entityschema
GNU General Public License v3.0
5 stars 3 forks source link

Process multiple shapes for a single entity #24

Closed Teester closed 1 month ago

Teester commented 2 months ago

With the imminent deployment of a new entityschema data type on wikidata and presumably, the approval of the Shape Expression for Class property, it should become possible to determine what shapes apply to an entity programmatically. Depending on how it is adopted, I could see the api checking items or properties associated with the queried entity for Shape Expression for Class properties and putting together a list of entity schemas to check the entity against. Then get the results of all the shapes and concatenate them so that you get a list of shapes checked and where (if at all) each property and statement fails.

For example: Simon Harris (Q7518922) is an human (E10) and a Member of the Oireachtas (E236). So if human (Q5) had a Shape Expression for Class property of E10 and Oireachtas Member ID (P4690) had a Shape Expression for Class property of E236, the api could detect E10 and E236 and run a check on Q7518922 with E10, then with E236. The script should then parse the results of both. In the summary section, the properties from both schemas should be listed in the appropriate sections.

In cases where the same property is checked in both schemas, the property should appear in the most restrictive section on the summary. i.e. if a property is necessary in one schema and optional in the other, it should appear in the necessary section only. If the property fails in either schema, it should be listed as a fail. On mousing over the properties, the breakdown from each schema should appear as a tooltip. This should be done in a similar way in the tags added to the properties and statements on the page.

It should also be possible to check a random schema in the usual way, and also to check multiple schemas from the search box, perhaps using a space or comma as a separator. Checking when there is no input in the search field should trigger automatic schema determination. The UI will need a minor update to make it clear that this will happen.

Tasks to complete