Commit d7a46ad2 authored by R.W.Majeed's avatar R.W.Majeed

allow value restrictions for modifiers

parent 193aa048
...@@ -245,6 +245,9 @@ public class Import implements AutoCloseable{ ...@@ -245,6 +245,9 @@ public class Import implements AutoCloseable{
insertModifierCount ++; insertModifierCount ++;
} }
private String generateMetadataXML(ValueRestriction vr) throws XMLStreamException, OntologyException{ private String generateMetadataXML(ValueRestriction vr) throws XMLStreamException, OntologyException{
if( vr == null ){
return null;
}
StringWriter xmlbuf = new StringWriter(); StringWriter xmlbuf = new StringWriter();
XMLOutputFactory xmlout = XMLOutputFactory.newInstance(); XMLOutputFactory xmlout = XMLOutputFactory.newInstance();
XMLStreamWriter xml = xmlout.createXMLStreamWriter(xmlbuf); XMLStreamWriter xml = xmlout.createXMLStreamWriter(xmlbuf);
...@@ -452,20 +455,11 @@ public class Import implements AutoCloseable{ ...@@ -452,20 +455,11 @@ public class Import implements AutoCloseable{
// c_metadataxml // c_metadataxml
ValueRestriction vr = concept.getValueRestriction();
if( vr == null ){
insertMeta.setString(7, null);
}else{
// build metadata xml
// set value // set value
try { try {
insertMeta.setString(7, generateMetadataXML(vr)); insertMeta.setString(7, generateMetadataXML(concept.getValueRestriction()));
} catch (XMLStreamException e) { } catch (XMLStreamException e) {
// TODO log error throw new OntologyException("Failed to generate metadata XML for concept "+concept.getID(), e);
e.printStackTrace();
insertMeta.setString(7, null);
}
} }
// c_dimcode (with concept_dimension.concept_path LIKE) // c_dimcode (with concept_dimension.concept_path LIKE)
...@@ -546,7 +540,11 @@ public class Import implements AutoCloseable{ ...@@ -546,7 +540,11 @@ public class Import implements AutoCloseable{
// c_basecode // c_basecode
insertMetaModifier.setString(6, ids[0]); insertMetaModifier.setString(6, ids[0]);
// c_metadataxml // c_metadataxml
insertMetaModifier.setString(7, null); try {
insertMetaModifier.setString(7, generateMetadataXML(modifier.getValueRestriction()));
} catch (XMLStreamException e) {
throw new OntologyException("Failed to generate metadata XML for modifier "+modifier.getID(), e);
}
// c_dimcode // c_dimcode
insertMetaModifier.setString(8, label); insertMetaModifier.setString(8, label);
// c_tooltip // c_tooltip
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment