Task #7120
Fix DataPackage.insertRelationship() to handle any URI for external identifiers
50%
Description
DataPackage currently provides two insertRelationship() methods - one to add ORE relationships between metadata and data members of the aggregation, and a second to provide any relationship using predicates from other namespaces (such as PROV). The latter method assumes that all identifiers should be treated as objects using the CN Base URL when constructing the subject and object URIs. This isn't always the case. Change or override the method to accept any URI as subject and object components of the triple, and fix any tests that use this method.
Associated revisions
ProvResourceMapBuilder is a 'straight up' copy of ResourceMapFactory, but as a builder, it doesn't need to provide all methods provided by ResourceMapFactory. Remove parseResourceMap() methods, serializeResourceMap() methods, deserializeResourceMap() methods, getOREModel(), validateResourceMap(), and validateD1Resource().
refs #7120
ProvResourceMapBuilder is a 'straight up' copy of ResourceMapFactory, but as a builder, it doesn't need to provide all methods provided by ResourceMapFactory. Remove parseResourceMap() methods, serializeResourceMap() methods, deserializeResourceMap() methods, getOREModel(), validateResourceMap(), and validateD1Resource().
refs #7120
Cleanup unused imports. refs #7120
Cleanup unused imports. refs #7120
Remove the createSparseResourceMap() method that was commented out (and copied from ResourceMapFactory). Clean up some Javadoc. refs #7120
Remove the createSparseResourceMap() method that was commented out (and copied from ResourceMapFactory). Clean up some Javadoc. refs #7120
Change the testCreateResourceMapWithPROV() test to first acquire a resource map from the ResourceMapFactory(), and then use the ProvResourceMapBuilder to augment the resource map with PROV statements. refs #7120
Change the testCreateResourceMapWithPROV() test to first acquire a resource map from the ResourceMapFactory(), and then use the ProvResourceMapBuilder to augment the resource map with PROV statements. refs #7120
Remove the createResourceMap() method, which was copied from ResourceMapFactory, and is redundant. Use the resourceMapFactory.createResourceMap() methods instead. refs #7120
Remove the createResourceMap() method, which was copied from ResourceMapFactory, and is redundant. Use the resourceMapFactory.createResourceMap() methods instead. refs #7120
Add a PROV vocabulary class that assists in building URI strings for terms and Predicates for object properties defined in the model. These are just a subset of PROV terms that are relevant to ProvONE (so far anyway). refs #7120
Add a PROV vocabulary class that assists in building URI strings for terms and Predicates for object properties defined in the model. These are just a subset of PROV terms that are relevant to ProvONE (so far anyway). refs #7120
Fix minor copy/paste typo. refs #7120
Fix minor copy/paste typo. refs #7120
Add a preliminary testCreateResourceMapWithProvONE() test to exercise the ProvResourceMapBuilder class. Will add to this with assertions. refs #7120
Add a preliminary testCreateResourceMapWithProvONE() test to exercise the ProvResourceMapBuilder class. Will add to this with assertions. refs #7120
Use the PROV vocabulary class to build predicates. refs #7120
Use the PROV vocabulary class to build predicates. refs #7120
Make the namespace and properties fields public in scope so they are easily readable. refs #7120
Make the namespace and properties fields public in scope so they are easily readable. refs #7120
Fix minor reversal of URI names. refs #7120
Fix minor reversal of URI names. refs #7120
Use the Jena RDF model to add statements to a resource map that are out of the scope of the ORE API. Change init() to initialize the RDF model, and to set the PROV and ProvONE namespace prefixes. Add a setModel() method that adds the triple statements from the resource map into the model. refs #7120
Use the Jena RDF model to add statements to a resource map that are out of the scope of the ORE API. Change init() to initialize the RDF model, and to set the PROV and ProvONE namespace prefixes. Add a setModel() method that adds the triple statements from the resource map into the model. refs #7120
Add a getModel() method that returns the RDF model as a ResourceMap. Use this method during the call to insertRelationship(). refs #7120
Add a getModel() method that returns the RDF model as a ResourceMap. Use this method during the call to insertRelationship(). refs #7120
Add a setNamespacePrefixes() method to try to reset the default prefixes set by Jena (like j.0, j.1). Use this in getModel().
refs #7120
Add a setNamespacePrefixes() method to try to reset the default prefixes set by Jena (like j.0, j.1). Use this in getModel().
refs #7120
Overload the insertRelationship() method to provide a version that takes a blank node id string for the subject, and then the usual Predicate and object URI list. This will allow us to create blank nodes in the RDF graph. refs #7120
Overload the insertRelationship() method to provide a version that takes a blank node id string for the subject, and then the usual Predicate and object URI list. This will allow us to create blank nodes in the RDF graph. refs #7120
The testCreateResourceMapWithProvONE() test was intermittently failing because of the lack of ordering provided by the tripleMap backing implementation. A HashMap will be iterated over effectively in a random order. When one triple statement in the map must be added to the RDF model before another (to avoid orphaned nodes in the model), we need to ensure ordering. The test creates the statements in the correct order, but they aren't inserted into the model in that order consistently.
Change the tripleMap implementation to a LinkedHashMap in order to preserve insertion order, and entries inserted first will be iterated over first. Un-ignore the test now - seems to be working fine. refs #7120
The testCreateResourceMapWithProvONE() test was intermittently failing because of the lack of ordering provided by the tripleMap backing implementation. A HashMap will be iterated over effectively in a random order. When one triple statement in the map must be added to the RDF model before another (to avoid orphaned nodes in the model), we need to ensure ordering. The test creates the statements in the correct order, but they aren't inserted into the model in that order consistently.
Change the tripleMap implementation to a LinkedHashMap in order to preserve insertion order, and entries inserted first will be iterated over first. Un-ignore the test now - seems to be working fine. refs #7120
History
#1 Updated by Chris Jones over 9 years ago
- Status changed from In Progress to Testing
- % Done changed from 30 to 50
DataPackage.insertRelationship() now takes URIs and a Predicate as arguments. This uses both ResourceMapFactory.createResourceMap() (to get the base map) and ProvResourceMapBuilder.insertRelationship(), which handles any URIs for the subject and object list. Putting this into the testing phase.