Repository navigation
Reconcile, and GET asks for N-Triples then Turtle - #71
Merged
Merged
Conversation
… as a Result formal-semantics.md §4.7. A core operation over the W3C Entity Reconciliation Service API, so any service is an endpoint and Wikidata's is one of them: the manifest's identifierSpace resolves the candidate ids to URIs, the query goes as the queries form field with an optional type id and limit, and the Result binds entity, name, description, score and match per candidate, best first. The XML serialization's executor has it too; this keeps the two serializations' catalogs the same. The offline stub answers the protocol as it answers SPARQL: a manifest for a JSON GET, no candidates for a POST of queries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The RDF media types a GET accepts are ranked by quality value, in MEDIA_TYPES' order. Unranked, a server choosing among equals picked freely, and Wikidata picked RDF/XML: its rdf:nodeIDs are hashes that start with a digit, not the XML NCNames RDF/XML requires, and rdflib refused every entity (Wikimedia T252731, declined in 2020 in favour of T244341, still open). The same blank nodes are fine in N-Triples and Turtle. A GET of a Wikidata entity now reads it, so a Reconcile candidate's description is a GET away. Co-Authored-By: Claude Opus 5.5 <[email protected]>
namedgraph
force-pushed
the
feat/reconcile
branch
from
October 29, 2026 12:59
a09a79d to
541cb86
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The XML serialization's executor has a core
Reconcilethat matches names such as a place of birth, a home, an employer or a school against Wikidata. This PR puts the same operation into the spec and the Python implementation, so the two serializations keep the same catalog (§5).What
formal-semantics.md§4.7 Reconciliation specifiesReconcileas a query effect,URI × Literal × Maybe Literal × Maybe Literal → Result:endpoint; Wikidata's is one of them.identifierSpaceresolves the candidate ids to URIs.queriesform field, with an optionaltypeid andlimit.entity,name,description(when the service gives one),score(xsd:decimal) andmatch(xsd:boolean), best first.ValueError; a non-2xx answer propagates as transport, as forGET.operations/reconcile.py, a READ operation.ReconciliationClientinclient.py, with the same constructor as the other clients.prompts/system.mdwith a runnable example, and an Unreleased CHANGELOG entry.Tests
tests/unit/test_reconcile.py(7) covers:tests/http_stub.pyanswers the protocol offline, as it answers SPARQL: a manifest for a JSON GET, and no candidates for a POST ofqueries.test_system_promptroutes a reconciliation POST to that default handler.uv run --with pytest python -m pytest tests -m "not network": 1120 passed.Also:
GETasks for N-Triples, then TurtleGETnow ranks the RDF media types it accepts:application/n-triples, text/turtle;q=0.9, application/ld+json;q=0.8, application/rdf+xml;q=0.7.rdf:nodeIDs as hashes, and most of them start with a digit. RDF/XML requires XML NCNames, which can't, so rdflib refused every Wikidata entity:rdf:nodeID value is not a valid NCName. The same blank nodes are fine in N-Triples and Turtle.Reconcilefollowed byGETof the chosen?entitynow works in Python, as it already did in the Java executor (Jena is lenient).tests/unit/test_get.pycovers the header, and a liveGETofhttp://www.wikidata.org/entity/Q25319returns 7060 statements, coordinates included. The suite passes: 1121.🤖 Generated with Claude Code