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

Shape inheritance only works when single dataset is used #60

Open
tpluscode opened this issue Apr 18, 2021 · 5 comments
Open

Shape inheritance only works when single dataset is used #60

tpluscode opened this issue Apr 18, 2021 · 5 comments

Comments

@tpluscode
Copy link
Collaborator

The validator supports shape hierarchies using rdfs:subClassOf but they are not applied correctly if the data graph and shapes graph are separate instances of Dataset

Consider this example.

The result is false-positive, even though the validated instance should be validated as foaf:Agent.

The correct results is returned if a single dataset is populated, for example using actual named graphs:

const dataset = $rdf.dataset()
const dataGraph = clownface({ dataset, graph: $rdf.namedNode('data-graph') })
const shapesGraph = clownface({ dataset, graph: $rdf.namedNode('shapes-graph') })
@martinmaillard
Copy link
Contributor

For inheritance to work, your "ontology" (rdfs:subClassOf) must be included in the "data" dataset. I think it makes sense, doesn't it?

@tpluscode
Copy link
Collaborator Author

No, I don't think it does. Class hierarchy is not property of data itself but of the its meta model (classes).

Holger suggest to run the validation over the union graphs which does work already as I mention above. The only problem is when the two RDF/JS datasets are separated.

I would consider merging them in memory (maybe opt-in, to prevent copying large amounts of data). That would be transparent to the caller, whether they use one or two datasets as input.

@martinmaillard
Copy link
Contributor

I like the idea of merging the datasets inside the validator, but I'm afraid of the consequences, mostly regarding blank nodes.

We're back to the same considerations: if we can agree that users should not expect blank nodes to keep their ID in the final "validation report" dataset, changing these IDs during validation shouldn't be an issue.

@tpluscode
Copy link
Collaborator Author

I think blank nodes will not be a problem if the "merging" happened in named graphs inside the joint dataset.

The only requirement would be address them as (bnode, graph). If clownface is used, that would already be taken care of by using pointers to specific graph

@martinmaillard
Copy link
Contributor

I tried to evaluate how easy this change would be and I think it will require a major refactoring: mostly passing clownface pointers around instead of nodes without context.

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

2 participants