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

Incomplete SHACL export of any_of range #179

Open
jsheunis opened this issue Aug 28, 2024 · 3 comments
Open

Incomplete SHACL export of any_of range #179

jsheunis opened this issue Aug 28, 2024 · 3 comments

Comments

@jsheunis
Copy link
Contributor

I picked this up in shacl-vue and traced it back to the following:

https://github.com/psychoinformatics-de/datalad-concepts/blob/main/src/prov/unreleased.yaml#L165-L177:

  influencer:
    slot_uri: dlprov:influencer
    description: >-
      Reference the resource (Entity, Agent, or Activity) whose influence is
      being qualified in a qualified influence pattern.
    any_of:
      - range: Activity
      - range: Agent
      - range: Entity
    exact_mappings:
      - prov:influencer
    broad_mappings:
      - dcterms:relation

It looks like the any_of range doesn't get propagated correctly to the SHACL export. I need to investigate whether LinkML's shaclgen actually deals with this.

@jsheunis
Copy link
Contributor Author

jsheunis commented Sep 3, 2024

SHACL's Logical Constraint Components can be used to achieve this. The resulting SHACL shape should be something like:

@prefix ex: <http://example.org/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

ex:InfluencerShape
    a sh:NodeShape ;
    sh:property [
        sh:path ex:influencer ;
        sh:or (
            [ sh:class ex:Activity ]
            [ sh:class ex:Agent ]
            [ sh:class ex:Entity ]
        ) ;
    ] ;
    sh:description "Reference to the resource (Entity, Agent, or Activity) whose influence is being qualified in a qualified influence pattern." .

@jsheunis
Copy link
Contributor Author

jsheunis commented Sep 3, 2024

Actually looks like shaclgen is trying to account for any_of here: https://github.com/linkml/linkml/blob/4a2e6f7af1130c9837b46231f2d4d5145985d2fc/linkml/generators/shaclgen.py#L136C39-L136C46

@jsheunis
Copy link
Contributor Author

jsheunis commented Sep 4, 2024

Updated to latest version of linkml and this seems to be resolved:

sh:property [ sh:description "Reference the resource (Entity, Agent, or Activity) whose influence is being qualified in a qualified influence pattern." ;
            sh:maxCount 1 ;
            sh:or ( [ sh:class dlprov:Activity ] [ sh:class dlprov:Agent ] [ sh:class dlprov:Entity ] ) ;
            sh:order 0 ;
            sh:path dlprov:influencer ],

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

1 participant