-
Notifications
You must be signed in to change notification settings - Fork 666
GH-3507: RDFS testing/wrapping framework. #3508
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
base: main
Are you sure you want to change the base?
Conversation
5aeced7 to
68eb6fa
Compare
| @TestFactory | ||
| @Disabled("Needs investigation!") | ||
| public List<DynamicTest> testSubPropertyOfRdfType01() { | ||
| String schemaStr = """ | ||
| PREFIX : <http://ex.org/> | ||
| PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | ||
| PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
| :directType rdfs:subPropertyOf rdf:type . | ||
| """; | ||
|
|
||
| String dataStr = """ | ||
| PREFIX : <http://ex.org/> | ||
| :fido :directType :Dog . | ||
| """; | ||
|
|
||
| return prepareRdfsFindTests(schemaStr, dataStr).build(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This produces the failing test cases.
ea1fcca to
bacb1bb
Compare
204dd42 to
d7da2a5
Compare
5e65298 to
3538860
Compare
|
I added a test case that uses the infrastructure to perform a simple RDFS inference on the NodeId level. It's limited because it requires the ontology and the built-in properties to be present in the graph. Rdfs and owl terms would have to be pre-populated in the NodeTable. At least things can now be wired up in the way that seemed to be the intended once by having the generic X, and one can play around with it. The relevant snippet is this: // Add wrapping on NodeId level.
Dataset baseDsg = TDB2Factory.createDataset().asDatasetGraph();
MapperX<NodeId, Tuple3<NodeId>> mapper = MapperXTDB.create(baseDsg);
ConfigRDFS<NodeId> configRDFS = RDFSFactory.setupRDFS(schema, mapper);
DatasetGraph rdfsDsg = new DatasetGraphWithGraphTransform(baseDsg,
g -> GraphMatch.adapt(g, new MatchRDFSWrapper<>(configRDFS, MatchTDB.wrap(g))));Note, that this only demonstrates a working wiring with the NodeId realm - it does not leverage QueryEngineTDB to run filters and aggregates on the NodeID level - that tighter integration would be future work. |
| derive(o, rdfType, c, out); | ||
| subClass(o, rdfType, c, out); | ||
| }); | ||
| if (!mapper.isLiteral(o)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is how to minimize materialization in this check. One can check for whether a NodeId is an inlined value and return early. But not sure if from the NodeId alone it can be decided whether it's a literal or not.
7bfcbe7 to
5f8ffbc
Compare
9592a5e to
26593dd
Compare
26593dd to
d3e311a
Compare
d3e311a to
1746776
Compare
GitHub issue resolved #3507
Pull request Description: This is mainly infrastructure work to further assess RDFS reasoning - and any future changes to it.
Fixed literals-in-subject inferences due to range declarations (easy fix). Added
MapperX.isLiteralto allow for testing onXpossibly bypassing Node-materialization.Fixed bug in
IteratorConcatwhich would raiseIndexOutOfBoundsExceptionifclose()was called withouthasNext.Added testing framework that compares all combinations of invoking find(). (I hope I didn't overlook an existing system for that). Added
commons-math4as a test-scoped dependency for theCombinationsclass.There is a disabled test in
AbstractTestRDFS_Extrawhich fails. It uses:directType rdfs:subPropertyOf rdf:type. How to solve this is a separate issue - I don't think it's straight forward, so the contribution here is the test case that reveals it.Added infrastructure to ease wrapping
Matchimplementations. Factored outDatasetGraphWithGraphTransformbase class fromDatasetGraphRDFSthat can transform any Graph with a Match. There is a TDB2 test case that performs a simple RDFS inference on the NodeId level. The schema must be loaded into the graph though for the NodeIds to be present.Added initial benchmark class for the RDFS reasoner.[update] Removed the benchmark due to lack of scope. Can be added with a later PR to benchmark impact of specific changes.Added
Iter.distinctCachedin preparation to filter out some duplicates of MatchRDFS. However, this PR does not change any existing behavior. The goal is to extend AssemblerRDFS with an option for distinct/reduced behavior.[ ] Documentation change and updates are provided for the Apache Jena websiteBy submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.
See the Apache Jena "Contributing" guide.