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

Shacl shape identified with relative URI is incorrectly named after ingest #1141

Open
rorlic opened this issue Feb 5, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@rorlic
Copy link
Contributor

rorlic commented Feb 5, 2024

Describe the bug
When ingesting a shacl shape which is identified with a relative URI (instead of a blank node) then the shacl shape is identified in the LDES using a file:// scheme.

To Reproduce
Steps to reproduce the behavior:

Seed the LDES server with the following definition:

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix ldes: <https://w3id.org/ldes#> .
@prefix tree: <https://w3id.org/tree#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

</touristattractions> a ldes:EventStream ;
  ldes:timestampPath prov:generatedAtTime ;
  ldes:versionOfPath dcterms:isVersionOf ;
  tree:shape </touristattractions/shape> .

</touristattractions/shape> a sh:NodeShape ;
  sh:targetClass <https://schema.org/TouristAttraction>, <http://purl.org/dc/dcmitype/Collection> ;
  sh:closed false .

and notice that the shape is incorrectly named:

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix ldes: <https://w3id.org/ldes#> .
@prefix tree: <https://w3id.org/tree#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://localhost:9003/touristattractions> a ldes:EventStream;
        ldes:timestampPath prov:generatedAtTime;
        ldes:versionOfPath dcterms:isVersionOf;
        tree:shape <file:///touristattractions/shape> .

<file:///touristattractions/shape> a sh:NodeShape;
  shacl:targetClass <https://schema.org/TouristAttraction> , <http://purl.org/dc/dcmitype/Collection> ;
  shacl:closed false .

Expected behavior
The shacl shape should be identified by:
<http://localhost:9003/touristattractions>/shape instead of <file:///touristattractions/shape>.

@rorlic rorlic added the bug Something isn't working label Feb 5, 2024
@jobulcke
Copy link
Collaborator

jobulcke commented Feb 6, 2024

A little investigation shows that every relative URI, without setting an @base first, receives a file:// scheme. In fact, this is how the Jena model is parsed and then parsed back to a string:

@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix ldes:    <https://w3id.org/ldes#> .
@prefix prov:    <http://www.w3.org/ns/prov#> .
@prefix sh:      <http://www.w3.org/ns/shacl#> .
@prefix tree:    <https://w3id.org/tree#> .
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .

<file:///touristattractions/shape>
        a               sh:NodeShape;
        sh:closed       false;
        sh:targetClass  <http://purl.org/dc/dcmitype/Collection> , <https://schema.org/TouristAttraction> .

<file:///touristattractions/view>
        tree:viewDescription  [ tree:fragmentationStrategy  [ a              tree:ExampleFragmentation;
                                                              tree:property  "ldes:propertyPath"
                                                            ]
                              ] .

<file:///touristattractions>
        a                   ldes:EventStream;
        ldes:timestampPath  prov:generatedAtTime;
        ldes:versionOfPath  dcterms:isVersionOf;
        ldes:view           <file:///touristattractions/view>;
        tree:shape          <file:///touristattractions/shape> .

Because of the way eventstreams and views are handled in the server, the file:// scheme is just ignored. To be more detailed, this happens because of the .getLocalName() calls that happen to retrieve the collection or view name. However, this is not the case for shacl shapes, as they stay RDF/Jena models in the code base and in the db. Further investigation on how to fix this issue needs to happen

@pj-cegeka pj-cegeka self-assigned this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants