Skip to content
Snippets Groups Projects
Commit 014cd63b authored by Dominique Marcadet's avatar Dominique Marcadet
Browse files

Merge branch '9-remove-from-id-when-rdf-about-is-used' into 'master'

Resolve "Remove # from id when rdf:about is used"

Closes #9

See merge request RiseClipseGroup/RiseClipseMetamodel_Cim!5
parents 6640d81c 5eaed4a6
No related branches found
No related tags found
1 merge request!5Resolve "Remove # from id when rdf:about is used"
Pipeline #1076 passed
......@@ -106,7 +106,7 @@ public abstract class CimResourceImpl extends XMLResourceImpl implements IRiseCl
// Merge foreign objects into originals
for( EObject object : foreignObjects ) {
EObject original = getEObjectByIDInNeighbors( this.getID( object ).substring( 1 ) );
EObject original = getEObjectByIDInNeighbors( this.getID( object ));
if( original != null ) {
EClass c = original.eClass();
for( EStructuralFeature f : c.getEAllStructuralFeatures() ) {
......@@ -118,7 +118,7 @@ public abstract class CimResourceImpl extends XMLResourceImpl implements IRiseCl
}
else {
AbstractRiseClipseConsole.getConsole().error(
"cannot find foreign object with ID " + this.getID( object ).substring( 1 ) + " in "
"cannot find foreign object with ID " + this.getID( object ) + " in "
+ this.uri.lastSegment() );
}
}
......@@ -137,7 +137,7 @@ public abstract class CimResourceImpl extends XMLResourceImpl implements IRiseCl
* search in the whole resource, and it will do it for every reference to objects in other
* resources !
*
* We implement here the folowing strategy :
* We implement here the following strategy :
* - it we are in endDocument() (not all resources are loaded), we just look in idToEObjectMap
* - if we finalize the load, we look in other resources in the same resourceSet.
*
......
......@@ -288,6 +288,24 @@ public abstract class CimXMLHandler extends SAXXMLHandler {
}
}
}
// When an rdf:about is used, it is converted to rdf:ID by CimXMLHandler.getFeature()
// However, the the value starts with a # that must be removed
if( CimConstants.nameRdfID.equals( feature.getName() )) {
try {
String id = ( String ) value;
if( id.charAt( 0 ) == '#' ) {
super.setFeatureValue( object, feature, id.substring( 1 ), position );
}
else {
super.setFeatureValue( object, feature, value, position );
}
}
catch( ClassCastException e ) {
super.setFeatureValue( object, feature, value, position );
}
return;
}
super.setFeatureValue( object, feature, value, position );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment