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

# remove from id when rdf:about is used

parent 6640d81c
No related branches found
No related tags found
1 merge request!5Resolve "Remove # from id when rdf:about is used"
Pipeline #1102 passed
...@@ -106,7 +106,7 @@ public abstract class CimResourceImpl extends XMLResourceImpl implements IRiseCl ...@@ -106,7 +106,7 @@ public abstract class CimResourceImpl extends XMLResourceImpl implements IRiseCl
// Merge foreign objects into originals // Merge foreign objects into originals
for( EObject object : foreignObjects ) { for( EObject object : foreignObjects ) {
EObject original = getEObjectByIDInNeighbors( this.getID( object ).substring( 1 ) ); EObject original = getEObjectByIDInNeighbors( this.getID( object ));
if( original != null ) { if( original != null ) {
EClass c = original.eClass(); EClass c = original.eClass();
for( EStructuralFeature f : c.getEAllStructuralFeatures() ) { for( EStructuralFeature f : c.getEAllStructuralFeatures() ) {
...@@ -118,7 +118,7 @@ public abstract class CimResourceImpl extends XMLResourceImpl implements IRiseCl ...@@ -118,7 +118,7 @@ public abstract class CimResourceImpl extends XMLResourceImpl implements IRiseCl
} }
else { else {
AbstractRiseClipseConsole.getConsole().error( 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() ); + this.uri.lastSegment() );
} }
} }
...@@ -137,7 +137,7 @@ public abstract class CimResourceImpl extends XMLResourceImpl implements IRiseCl ...@@ -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 * search in the whole resource, and it will do it for every reference to objects in other
* resources ! * 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 * - 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. * - if we finalize the load, we look in other resources in the same resourceSet.
* *
......
...@@ -288,6 +288,24 @@ public abstract class CimXMLHandler extends SAXXMLHandler { ...@@ -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 ); 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