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

Bug in _shacl_path_to_sparql_path ? #124

Closed
Martijn-Y-ai opened this issue Feb 24, 2022 · 2 comments
Closed

Bug in _shacl_path_to_sparql_path ? #124

Martijn-Y-ai opened this issue Feb 24, 2022 · 2 comments

Comments

@Martijn-Y-ai
Copy link
Contributor

I am using pyshacl 0.17.1 and declared a shape as follows:

[] a sh:NodeShape ;
    sh:property [ a sh:PropertyShape;
            sh:path ( ex:a ex:d ex:d ) ;
            sh:sparql [ sh:select """
                SELECT $this ?value
                WHERE {
                    FILTER NOT EXISTS { 
                        $this $PATH ?value .
                        $this ex:a/ex:b/ex:c ?value .
                    }
                }
            """ ] ;
    ] ;
.

During validation, in the function _shacl_path_to_sparql_path in sparql_query_helper.py I get the following error:
AttributeError: 'ShapesGraph' object has no attribute 'items'

In the code I see

if len(sequence_list) > 0:
            all_collected = []
            for s in sg.items(sequence_list):

which indeed refers to a non-existent function items on the ShapesGraph object. Is this a bug, or am I doing something wrong?

@ashleysommer
Copy link
Collaborator

Thanks @Martijn-Y-ai
Yes, indeed I think this looks like a bug! Great reporting.

This must be coming from a section of code that is not covered by the standard W3C SHACL test suite, nor the DASH Test suite.
It is a simple fix (I think it should be sg.graph.items()) but the fact this bug code has been present in the code for at least 20 versions, means I also need to add a new test to cover that section of code.

@ashleysommer
Copy link
Collaborator

@Martijn-Y-ai Your fix for this has been merged, and is released as part of PySHACL v0.19.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants