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:class validation doesn't seem to observe inheritance #735

Open
chrisdostert opened this issue Feb 27, 2024 · 1 comment
Open

shacl:class validation doesn't seem to observe inheritance #735

chrisdostert opened this issue Feb 27, 2024 · 1 comment

Comments

@chrisdostert
Copy link

chrisdostert commented Feb 27, 2024

repro

  1. create a class "Offering"
  {
    "@id": "Offering",
    "@type": [
      "rdfs:Class",
      "shacl:NodeShape"
    ],
    "shacl:property": [
      {
        "shacl:maxCount": 1,
        "shacl:minCount": 1,
        "shacl:dataType": {
          "@id": "xsd:string"
        },
        "shacl:path": {
          "@id": "name"
        }
      }
    ]
  }
  1. create a child class "ServiceOffering" that is rdfs:subClassOf Offering
  {
    "@id": "ServiceOffering",
    "@type": [
      "rdfs:Class",
      "shacl:NodeShape"
    ],
    "rdfs:subClassOf": {
      "@id": "Offering"
    },
    "shacl:property": [
      {
        "shacl:maxCount": 1,
        "shacl:minCount": 1,
        "shacl:dataType": {
          "@id": "xsd:integer"
        },
        "shacl:path": {
          "@id": "price"
        }
      }
    ]
  }
  1. create a "Charge" class
  {
    "@id": "Charge",
    "@type": [
      "rdfs:Class",
      "shacl:NodeShape"
    ],
    "shacl:targetClass": {
      "@id": "Charge"
    },
    "shacl:property": [
      {
        "shacl:class": {
          "@id": "Offering"
        },
        "shacl:maxCount": 1,
        "shacl:minCount": 1,
        "shacl:path": {
          "@id": "for"
        }
      }
    ]
  }
  1. Create a ServiceOffering
  2. Create a Charge referencing the ServiceOffering

expected

it works with no errors

actual

{"error":"db/shacl-validation","cause":"SHACL PropertyShape exception - sh:class: class(es) #{211106232533039} must be same set as #{211106232533465}."}

Of note: if you change the shacl constraint in Charge Class from

        "shacl:class": {
          "@id": "Offering"
        },

to

        "shacl:class": {
          "@id": "ServiceOffering"
        },

the error goes away so it seems It's not observing inheritance.

@chrisdostert
Copy link
Author

possibly related to #706 ?

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