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

Add support for defining ranges/classes when generating a graph #291

Merged
merged 10 commits into from
Aug 13, 2024

Conversation

amercader
Copy link
Member

Starting off from some great work from @EricSoroos in #284, this PR modifies the base profile to support defining the range (rdf:type) of properties.

_add_triple_from_dict() & co now accept an optional _class parameter which is the RDF class that will get applied to the object, if it is a URIRef. Classes can not be applied to Literals, otherwise you get invalid serializations.

I added a SHACL test using the dcat-ap_2.1.1_shacl_range.ttl shapes and we almost got to full validation but not quite. There were two classes that were not added to the profiles even if the range tests where failing:

  • All the properties that have skos:Concept. Adding this class makes the range validation pass, but the shapes one fail, because we need to provide a skos:prefLabel value. This makes sense but the parser does not currently support it. It will probably have to be implemented as part of wider codelists support (which @EricSoroos also started on DCAT HVD 2.2.0 #284)
  • All the properties that have dcat:Dataset range. Again, this makes the range tests pass but the shapes fail, because a dct:title and dct:description is expected of dcat:Dataset. I'm confused by this one, as it doesn't make sense to require those for referenced datasets (things like serves_dataset or is_version_of) but maybe I'm missing something.

Both seem like not important enough to block the whole support for ranges, so until we find a way around it the range test ignores them

There are two of them that are not added:

* All the properties that have `skos:Concept`. Adding this class makes
  the range validation pass, but the shapes one fail, because we need to
  provide a `skos:prefLabel` value. This makes sense but the parser does
  not currently support it. It will probably have to be implemented as
  part of codelists support
* All the properties that have `dcat:Dataset` range. Again, this makes
  the range tests pass but the shapes fail, because a `dct:title` and
  `dct:description` is expected of `dcat:Datasets`. I actually think
  this is a mistake on the validation, as it doesn't make sense to
  require those for referenced datasets (things like `serves_dataset` or
  `is_version_of`).
TODO: add a field to handle this or guess it from the CKAN license
model
@amercader
Copy link
Member Author

@seitenbau-govdata @EricSoroos and other Semantic experts, would be good to get your take on this

@amercader amercader merged commit 7c6339d into master Aug 13, 2024
8 checks passed
@amercader amercader deleted the shacl-validation-range branch August 13, 2024 12:23
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

Successfully merging this pull request may close these issues.

1 participant