Skip to content
Snippets Groups Projects

Resolve "CellDesigner ignores all rdf description block in case it contains not-supported bqmodel:isDerivedFrom"

11 files
+ 66
11
Compare changes
  • Side-by-side
  • Inline
Files
11
@@ -30,10 +30,21 @@ public class XmlAnnotationParser {
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private Set<MiriamRelationType> supportedRelationTypes = new HashSet<>();
/**
* Default constructor.
*/
public XmlAnnotationParser() {
this(new ArrayList<>());
}
public XmlAnnotationParser(Collection<MiriamRelationType> supportedRelationTypes) {
if (supportedRelationTypes == null || supportedRelationTypes.size() == 0) {
this.supportedRelationTypes.addAll(Arrays.asList(MiriamRelationType.values()));
} else {
this.supportedRelationTypes.addAll(supportedRelationTypes);
}
}
/**
@@ -353,12 +364,20 @@ public class XmlAnnotationParser {
*/
public String miriamDataToXmlString(MiriamData data) {
StringBuilder result = new StringBuilder("");
result.append("<" + data.getRelationType().getStringRepresentation() + ">\n");
MiriamRelationType relationType;
if (supportedRelationTypes.contains(data.getRelationType())) {
relationType = data.getRelationType();
} else {
relationType = supportedRelationTypes.iterator().next();
logger.warn(data.getRelationType().getStringRepresentation() + " is not supported. Replacing with: "
+ relationType.getStringRepresentation());
}
result.append("<" + relationType.getStringRepresentation() + ">\n");
result.append("<rdf:Bag>\n");
result.append("<rdf:li rdf:resource=\"" + data.getDataType().getUris().get(0) + ":"
+ data.getResource().replaceAll(":", "%3A") + "\"/>\n");
result.append("</rdf:Bag>\n");
result.append("</" + data.getRelationType().getStringRepresentation() + ">\n");
result.append("</" + relationType.getStringRepresentation() + ">\n");
return result.toString();
}
Loading