Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove -Likes #229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Commits on Apr 23, 2024

  1. Remove -Likes

    `GraphLike` and `ConjunctiveLike` appear in several places throughout
    the pySHACL code, with these definitions in a few files named
    `pytypes.py`:
    
    ```python
    ConjunctiveLike = Union[ConjunctiveGraph, Dataset]
    GraphLike = Union[ConjunctiveLike, Graph]
    ```
    
    In RDFLib 7.0.0 (and according to `git blame`, RDFLib since 2013), the
    classes referenced in the `Union`s have these subclassing relationships:
    
    * `Dataset` is a subclass of `ConjunctiveGraph`.
    * `ConjunctiveGraph` is a subclass of `Graph`.
    
    The RDFLib `Graph` definition designates a few parameters as "-likes"
    (e.g., `source` in `graph.parse()`), to normalize behaviors around
    graphs being passed in methods as objects or strings.  The Likes in
    pySHACL do not handle the same use case pattern.
    
    This patch replaces the -Likes with their broadest `Union` members, even
    though a few methods that used `ConjunctiveLike` are described by
    documentation to prefer `Dataset`.  Narrowing this is left for future
    review.
    
    Spelling of `rdflib.Graph` was kept as `rdflib.Graph` for text search
    purposes.
    
    A little cleanup occurs in this patch as well - some type-hinting in
    comments is mooted by inheritance from function parameters
    (`validate.py`); `/pyshacl/rdfutil/pytypes.py` is deleted by merit of
    now being empty; and a `RuntimeError` message has a capitalization typo
    fixed.
    
    Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
    ajnelson-nist committed Apr 23, 2024
    Configuration menu
    Copy the full SHA
    0704f6b View commit details
    Browse the repository at this point in the history