BlueBrain / nexus-forge

Building and Using Knowledge Graphs made easy
https://nexus-forge.readthedocs.io
GNU Lesser General Public License v3.0
38 stars 19 forks source link

Fixes deep nodeshape path eval error #393

Closed MFSY closed 6 months ago

MFSY commented 6 months ago

Currently the pySHACL throws a ReportableRuntimeError("Evaluation path too deep!\n{}".format(path_str)) exception when evaluating a shape if the length of its transitive closure of the sh:node property is bigger or equal to 30.

Give a node shape, this PR addresses this by:

Along the way, the expected data model for a shacl shape is aligned between the RDF StoreService and DirectoryService:

{
 "@context":"https://acontext"
  "@id": "http://shapes.ex/employee",
  "@type": "nxv:Schema",
  "owl:imports": [
    "http://shapes.ex/person"
  ],
  "shapes": [
    {
     "@id": "this:EmployeeShape",
      "@type": "sh:NodeShape",
       ....
    }
  ]
}
crisely09 commented 6 months ago

The problem is due to pytest incompatibility, Version: 7.2.1 works fine. I think we should move away from pytest-bdd, and re-format the tests, but not in this PR.

crisely09 commented 6 months ago

sorry about the closing comment, clicked on the wrong button

MFSY commented 6 months ago

The problem is due to pytest incompatibility, Version: 7.2.1 works fine. I think we should move away from pytest-bdd, and re-format the tests, but not in this PR.

What do you recommend ? get pytest 7.2.1 in setup ? Is t what work for you ?

crisely09 commented 6 months ago

Yes, locally I used that version and it works. At least for now we could setup forge with pytest==7.2.1, while we make the changes in the tests to remove pytest-bdd

codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 82.78867% with 79 lines in your changes are missing coverage. Please review.

Project coverage is 75.52%. Comparing base (faf2833) to head (681cb89).

Files Patch % Lines
...gforge/specializations/models/rdf/store_service.py 21.95% 32 Missing :warning:
kgforge/specializations/stores/bluebrain_nexus.py 21.21% 26 Missing :warning:
kgforge/specializations/models/rdf/service.py 93.02% 9 Missing :warning:
kgforge/core/commons/sparql_query_builder.py 90.69% 4 Missing :warning:
kgforge/specializations/models/rdf_model.py 86.95% 3 Missing :warning:
kgforge/specializations/stores/sparql_store.py 66.66% 3 Missing :warning:
...ge/specializations/models/rdf/directory_service.py 96.77% 1 Missing :warning:
tests/specializations/models/test_rdf_service.py 98.21% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #393 +/- ## ========================================== + Coverage 74.63% 75.52% +0.88% ========================================== Files 101 103 +2 Lines 6431 6643 +212 ========================================== + Hits 4800 5017 +217 + Misses 1631 1626 -5 ``` | [Flag](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/393/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/393/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain) | `75.52% <82.78%> (+0.88%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.