Repository navigation
Rewrite PerfectRef as an installable package with a corrected core - #1
Merged
Merged
Conversation
The 1.x code was a loose folder meant to be copied into site-packages and had several correctness problems: the entry point crashed on a missing import, the default upperlimit=None raised TypeError, role inclusions were skipped when the first argument was unbound, inverse_of was translated to P⁻ ⊑ P, "?_" written twice became a shared variable, constants broke unification, and duplicate rewritings were only detected for identical atom order. Version 2 is a pip-installable `perfectref` package: - perfectref.model: immutable terms, atoms and conjunctive queries kept in the paper's τ normal form, with canonical keys for deduplication - perfectref.tbox: DL-Lite positive inclusions indexed by right-hand side, plus a plain-text DL syntax parser - perfectref.owl: owlready2 extraction covering subclass/equivalence, some/min/exactly/value restrictions, intersections, unions on the left, general class axioms, domain/range, sub/inverse/equivalent/symmetric properties and imports; axioms outside DL-Lite are listed in tbox.skipped - perfectref.algorithm: work-list PerfectRef with gr, mgu and reduce as in the paper, head specialisation on unification, and a max_rewritings cap - perfectref.parser / formatting: Datalog-style query grammar with long variable names, constants and IRIs; text, JSON and SPARQL output - perfectref.legacy: the 1.x API (get_entailed_queries, Query, QueryBody, AtomConcept, AtomRole, Variable, ...) kept working on top of the core, with cached ontology loading and picklable results - CLI (`perfectref rewrite|tbox`), pyproject, GitHub Actions, ruff config - tests: Example 1 of the paper reproduced exactly, OWL translation, parser, legacy API and CLI (55 tests) Test ontologies move to tests/data (plus the paper's university TBox as OWL) and the Pizza ontology to examples/; redundant copies, generated output and committed bytecode are removed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U5bWLj6FhSbcAZxcBYtDut
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.
The 1.x code was a loose folder meant to be copied into site-packages and had several correctness problems: the entry point crashed on a missing import, the default upperlimit=None raised TypeError, role inclusions were skipped when the first argument was unbound, inverse_of was translated to P⁻ ⊑ P, "?_" written twice became a shared variable, constants broke unification, and duplicate rewritings were only detected for identical atom order.
Version 2 is a pip-installable
perfectrefpackage:perfectref rewrite|tbox), pyproject, GitHub Actions, ruff configTest ontologies move to tests/data (plus the paper's university TBox as OWL) and the Pizza ontology to examples/; redundant copies, generated output and committed bytecode are removed.