Project

General

Profile

Task #7120

Fix DataPackage.insertRelationship() to handle any URI for external identifiers

Added by Chris Jones over 6 years ago. Updated over 6 years ago.

Status:
Testing
Priority:
Normal
Assignee:
Category:
d1_libclient_java
Target version:
Start date:
2015-05-21
Due date:
% Done:

50%

Story Points:
Sprint:

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

Revision 15684
Added by Chris Jones over 6 years ago

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

Revision 15684
Added by Chris Jones over 6 years ago

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

Revision 15685
Added by Chris Jones over 6 years ago

Cleanup unused imports. refs #7120

Revision 15685
Added by Chris Jones over 6 years ago

Cleanup unused imports. refs #7120

Revision 15686
Added by Chris Jones over 6 years ago

Remove the createSparseResourceMap() method that was commented out (and copied from ResourceMapFactory). Clean up some Javadoc. refs #7120

Revision 15686
Added by Chris Jones over 6 years ago

Remove the createSparseResourceMap() method that was commented out (and copied from ResourceMapFactory). Clean up some Javadoc. refs #7120

Revision 15687
Added by Chris Jones over 6 years ago

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

Revision 15687
Added by Chris Jones over 6 years ago

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

Revision 15688
Added by Chris Jones over 6 years ago

Remove the createResourceMap() method, which was copied from ResourceMapFactory, and is redundant. Use the resourceMapFactory.createResourceMap() methods instead. refs #7120

Revision 15688
Added by Chris Jones over 6 years ago

Remove the createResourceMap() method, which was copied from ResourceMapFactory, and is redundant. Use the resourceMapFactory.createResourceMap() methods instead. refs #7120

Revision 15708
Added by Chris Jones over 6 years ago

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

Revision 15708
Added by Chris Jones over 6 years ago

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

Revision 15709
Added by Chris Jones over 6 years ago

Fix minor copy/paste typo. refs #7120

Revision 15709
Added by Chris Jones over 6 years ago

Fix minor copy/paste typo. refs #7120

Revision 15714
Added by Chris Jones over 6 years ago

Add a preliminary testCreateResourceMapWithProvONE() test to exercise the ProvResourceMapBuilder class. Will add to this with assertions. refs #7120

Revision 15714
Added by Chris Jones over 6 years ago

Add a preliminary testCreateResourceMapWithProvONE() test to exercise the ProvResourceMapBuilder class. Will add to this with assertions. refs #7120

Revision 15716
Added by Chris Jones over 6 years ago

Use the PROV vocabulary class to build predicates. refs #7120

Revision 15716
Added by Chris Jones over 6 years ago

Use the PROV vocabulary class to build predicates. refs #7120

Revision 15719
Added by Chris Jones over 6 years ago

Make the namespace and properties fields public in scope so they are easily readable. refs #7120

Revision 15719
Added by Chris Jones over 6 years ago

Make the namespace and properties fields public in scope so they are easily readable. refs #7120

Revision 15720
Added by Chris Jones over 6 years ago

Fix minor reversal of URI names. refs #7120

Revision 15720
Added by Chris Jones over 6 years ago

Fix minor reversal of URI names. refs #7120

Revision 15721
Added by Chris Jones over 6 years ago

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

Revision 15721
Added by Chris Jones over 6 years ago

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

Revision 15722
Added by Chris Jones over 6 years ago

Add a getModel() method that returns the RDF model as a ResourceMap. Use this method during the call to insertRelationship(). refs #7120

Revision 15722
Added by Chris Jones over 6 years ago

Add a getModel() method that returns the RDF model as a ResourceMap. Use this method during the call to insertRelationship(). refs #7120

Revision 15723
Added by Chris Jones over 6 years ago

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

Revision 15723
Added by Chris Jones over 6 years ago

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

Revision 15725
Added by Chris Jones over 6 years ago

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

Revision 15725
Added by Chris Jones over 6 years ago

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

Revision 15734
Added by Chris Jones over 6 years ago

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

Revision 15734
Added by Chris Jones over 6 years ago

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 6 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.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 14.8 MB)