Revision 892efc69
Added by Andreas Kohlbecker almost 14 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/SDDDescriptionIO.java | ||
---|---|---|
229 | 229 |
String label = (String)ImportHelper.getXmlInputValue(elRepresentation, "Label",sddNamespace); |
230 | 230 |
String detail = (String)ImportHelper.getXmlInputValue(elRepresentation, "Detail",sddNamespace); |
231 | 231 |
|
232 |
sec.setTitleCache(label); |
|
232 |
sec.setTitleCache(label, true);
|
|
233 | 233 |
|
234 | 234 |
if (detail != null) { |
235 | 235 |
Annotation annotation = Annotation.NewInstance(detail, datasetLanguage); |
... | ... | |
352 | 352 |
labDet = langLabDet.get(langLabDet.keySet().iterator().next()); |
353 | 353 |
} |
354 | 354 |
|
355 |
ie.setTitleCache(labDet.get(0)); |
|
355 |
ie.setTitleCache(labDet.get(0), true);
|
|
356 | 356 |
|
357 | 357 |
if (labDet.size()>1) { |
358 | 358 |
Annotation annotation = null; |
... | ... | |
497 | 497 |
if ((authors != null)||(editors != null)) { |
498 | 498 |
Team team = Team.NewInstance(); |
499 | 499 |
if (authors != null) { |
500 |
for (Iterator<Person> author = authors.values().iterator() ; author.hasNext() ;){
|
|
501 |
team.addTeamMember(author.next());
|
|
502 |
}
|
|
500 |
for (Iterator<Person> author = authors.values().iterator() ; author.hasNext() ;){ |
|
501 |
team.addTeamMember(author.next()); |
|
502 |
} |
|
503 | 503 |
} |
504 | 504 |
if (editors != null) { |
505 | 505 |
Marker marker = Marker.NewInstance(); |
... | ... | |
509 | 509 |
edit.addMarker(marker); |
510 | 510 |
team.addTeamMember(edit); |
511 | 511 |
} |
512 |
} |
|
512 |
}
|
|
513 | 513 |
sec.setAuthorTeam(team); |
514 | 514 |
sourceReference.setAuthorTeam(team); |
515 | 515 |
} |
... | ... | |
1108 | 1108 |
stateData.addModifier(modifier); |
1109 | 1109 |
} |
1110 | 1110 |
} |
1111 |
categoricalData.addState(stateData); |
|
1112 |
} |
|
1113 |
taxonDescription.addElement(categoricalData); |
|
1111 |
categoricalData.addState(stateData); |
|
1114 | 1112 |
} |
1113 |
taxonDescription.addElement(categoricalData); |
|
1114 |
} |
|
1115 | 1115 |
} |
1116 | 1116 |
// <Quantitative ref="c2"> |
1117 | 1117 |
List<Element> elQuantitatives = elSummaryData.getChildren("Quantitative", sddNamespace); |
... | ... | |
1481 | 1481 |
|
1482 | 1482 |
for (Element elDescriptiveConcept : listDescriptiveConcepts){ |
1483 | 1483 |
try { |
1484 |
String id = elDescriptiveConcept.getAttributeValue("id");
|
|
1484 |
String id = elDescriptiveConcept.getAttributeValue("id"); |
|
1485 | 1485 |
Feature feature = Feature.NewInstance(); |
1486 | 1486 |
feature.setKindOf(Feature.DESCRIPTION()); |
1487 | 1487 |
if (!id.equals("")) { |
1488 |
// <Representation>
|
|
1489 |
// <Label>Body</Label>
|
|
1490 |
importRepresentation(elDescriptiveConcept, sddNamespace, feature, id, sddConfig);
|
|
1488 |
// <Representation> |
|
1489 |
// <Label>Body</Label> |
|
1490 |
importRepresentation(elDescriptiveConcept, sddNamespace, feature, id, sddConfig); |
|
1491 | 1491 |
features.put(id, feature); |
1492 | 1492 |
getTermService().save(feature);//XIM |
1493 | 1493 |
descriptiveConcepts.add(feature); |
1494 | 1494 |
// imports the modifiers |
1495 | 1495 |
Element elModifiers = elDescriptiveConcept.getChild("Modifiers", sddNamespace); |
1496 |
if (elModifiers !=null){
|
|
1497 |
List<Element> listModifiers = elModifiers.getChildren("Modifier", sddNamespace);
|
|
1496 |
if (elModifiers !=null){ |
|
1497 |
List<Element> listModifiers = elModifiers.getChildren("Modifier", sddNamespace); |
|
1498 | 1498 |
TermVocabulary<Modifier> termVocabularyState = new TermVocabulary<Modifier>(); |
1499 |
for (Element elModifier : listModifiers) {
|
|
1499 |
for (Element elModifier : listModifiers) { |
|
1500 | 1500 |
Modifier modif = Modifier.NewInstance(); |
1501 | 1501 |
String idmod = elModifier.getAttributeValue("id"); |
1502 | 1502 |
importRepresentation(elModifier, sddNamespace, modif, idmod, sddConfig); |
... | ... | |
1504 | 1504 |
//termVocabularyStates.add(termVocabularyState); |
1505 | 1505 |
getVocabularyService().save(termVocabularyState);//XIM |
1506 | 1506 |
modifiers.put(idmod, modif); |
1507 |
} |
|
1508 |
feature.addRecommendedModifierEnumeration(termVocabularyState); |
|
1509 | 1507 |
} |
1508 |
feature.addRecommendedModifierEnumeration(termVocabularyState); |
|
1509 |
} |
|
1510 | 1510 |
|
1511 | 1511 |
} |
1512 | 1512 |
} |
... | ... | |
1534 | 1534 |
String label = (String)ImportHelper.getXmlInputValue(elRepresentation,"Label",sddNamespace); |
1535 | 1535 |
//Element elDesignedFor = elCharacterTree.getChild("DesignedFor",sddNamespace);//TODO ? |
1536 | 1536 |
|
1537 |
FeatureTree feattree = FeatureTree.NewInstance(); |
|
1538 |
importRepresentation(elCharacterTree, sddNamespace, feattree, "", sddConfig); |
|
1539 |
FeatureNode root = feattree.getRoot(); |
|
1540 |
List<Element> listelNodes = elCharacterTree.getChildren("Nodes", sddNamespace); |
|
1537 |
FeatureTree feattree = FeatureTree.NewInstance();
|
|
1538 |
importRepresentation(elCharacterTree, sddNamespace, feattree, "", sddConfig);
|
|
1539 |
FeatureNode root = feattree.getRoot();
|
|
1540 |
List<Element> listelNodes = elCharacterTree.getChildren("Nodes", sddNamespace);
|
|
1541 | 1541 |
|
1542 | 1542 |
//Nodes of CharacterTrees in SDD always refer to DescriptiveConcepts |
1543 |
for (Element elNodes : listelNodes) { |
|
1544 |
List<Element> listNodes = elNodes.getChildren("Node", sddNamespace); |
|
1545 |
if (listNodes != null) { |
|
1546 |
for (Element elNode : listNodes){ |
|
1547 |
String idN = elNode.getAttributeValue("id"); |
|
1548 |
FeatureNode fn = null; |
|
1543 |
for (Element elNodes : listelNodes) {
|
|
1544 |
List<Element> listNodes = elNodes.getChildren("Node", sddNamespace);
|
|
1545 |
if (listNodes != null) {
|
|
1546 |
for (Element elNode : listNodes){
|
|
1547 |
String idN = elNode.getAttributeValue("id");
|
|
1548 |
FeatureNode fn = null;
|
|
1549 | 1549 |
Feature dc = null; |
1550 | 1550 |
if (idN!=null) { |
1551 | 1551 |
// DescriptiveConcepts are used as nodes in CharacterTrees |
1552 |
Element elDescriptiveConcept = elNode.getChild("DescriptiveConcept", sddNamespace); |
|
1553 |
if (elDescriptiveConcept != null){ |
|
1554 |
String refDC = elDescriptiveConcept.getAttributeValue("ref"); |
|
1552 |
Element elDescriptiveConcept = elNode.getChild("DescriptiveConcept", sddNamespace);
|
|
1553 |
if (elDescriptiveConcept != null){
|
|
1554 |
String refDC = elDescriptiveConcept.getAttributeValue("ref");
|
|
1555 | 1555 |
dc = features.get(refDC); |
1556 | 1556 |
fn = FeatureNode.NewInstance(dc); |
1557 |
} |
|
1557 |
}
|
|
1558 | 1558 |
if (fn==null){ |
1559 |
fn = FeatureNode.NewInstance(); |
|
1560 |
} |
|
1561 |
Element elParent = elNode.getChild("Parent", sddNamespace); |
|
1559 |
fn = FeatureNode.NewInstance();
|
|
1560 |
}
|
|
1561 |
Element elParent = elNode.getChild("Parent", sddNamespace);
|
|
1562 | 1562 |
// in SDD links between Nodes are referenced by the <Parent> tag |
1563 |
if (elParent!=null){ |
|
1564 |
String refP = elParent.getAttributeValue("ref"); |
|
1563 |
if (elParent!=null){
|
|
1564 |
String refP = elParent.getAttributeValue("ref");
|
|
1565 | 1565 |
if (refP!=null) { |
1566 | 1566 |
FeatureNode parent = featureNodes.get(refP); |
1567 | 1567 |
if (parent==null){ |
... | ... | |
1572 | 1572 |
} |
1573 | 1573 |
} |
1574 | 1574 |
} |
1575 |
else { |
|
1575 |
else {
|
|
1576 | 1576 |
root.addChild(fn); // if no parent found or the reference is broken, add the node to the root of the tree |
1577 |
} |
|
1577 | 1578 |
} |
1578 |
} |
|
1579 | 1579 |
featureNodes.put(idN, fn); |
1580 |
} |
|
1580 |
}
|
|
1581 | 1581 |
} |
1582 | 1582 |
|
1583 | 1583 |
// Leaves of CharacterTrees in SDD are always CharNodes (referring to Characters) |
1584 |
List<Element> listCharNodes = elNodes.getChildren("CharNode", sddNamespace); |
|
1584 |
List<Element> listCharNodes = elNodes.getChildren("CharNode", sddNamespace);
|
|
1585 | 1585 |
if (listCharNodes != null) { |
1586 |
for (Element elCharNode : listCharNodes){ |
|
1587 |
Element elParent = elCharNode.getChild("Parent", sddNamespace); |
|
1588 |
Element elCharacter = elCharNode.getChild("Character", sddNamespace); |
|
1589 |
FeatureNode fn = FeatureNode.NewInstance(); |
|
1590 |
if (elParent!=null){ |
|
1591 |
String refP = elParent.getAttributeValue("ref"); |
|
1592 |
if ((refP!=null)&&(!refP.equals(""))) { |
|
1586 |
for (Element elCharNode : listCharNodes){
|
|
1587 |
Element elParent = elCharNode.getChild("Parent", sddNamespace);
|
|
1588 |
Element elCharacter = elCharNode.getChild("Character", sddNamespace);
|
|
1589 |
FeatureNode fn = FeatureNode.NewInstance();
|
|
1590 |
if (elParent!=null){
|
|
1591 |
String refP = elParent.getAttributeValue("ref");
|
|
1592 |
if ((refP!=null)&&(!refP.equals(""))) {
|
|
1593 | 1593 |
FeatureNode parent = featureNodes.get(refP); |
1594 |
if (parent==null){ |
|
1594 |
if (parent==null){
|
|
1595 | 1595 |
parent = root; // if no parent found or the reference is broken, add the node to the root of the tree |
1596 |
} |
|
1597 |
parent.addChild(fn); |
|
1596 | 1598 |
} |
1597 |
parent.addChild(fn); |
|
1598 | 1599 |
} |
1599 |
} |
|
1600 |
String refC = elCharacter.getAttributeValue("ref"); |
|
1601 |
if ((refC!=null)&&(!refC.equals(""))){ |
|
1602 |
Feature character = features.get(refC); |
|
1603 |
fn.setFeature(character); |
|
1600 |
String refC = elCharacter.getAttributeValue("ref"); |
|
1601 |
if ((refC!=null)&&(!refC.equals(""))){ |
|
1602 |
Feature character = features.get(refC); |
|
1603 |
fn.setFeature(character); |
|
1604 | 1604 |
featureNodes.put(refC, fn); |
1605 |
} |
|
1605 |
}
|
|
1606 | 1606 |
} |
1607 |
} |
|
1607 |
} |
|
1608 |
} |
|
1609 |
featureTrees.add(feattree); |
|
1608 | 1610 |
} |
1609 |
featureTrees.add(feattree); |
|
1610 |
} |
|
1611 | 1611 |
|
1612 | 1612 |
catch (Exception e) { |
1613 | 1613 |
logger.warn("Import of Character tree " + j + " failed."); |
... | ... | |
1633 | 1633 |
try { |
1634 | 1634 |
Element elRepresentation = elTaxonHierarchy.getChild("Representation",sddNamespace); |
1635 | 1635 |
String label = (String)ImportHelper.getXmlInputValue(elRepresentation,"Label",sddNamespace); |
1636 |
TaxonomicTree taxonomicTree = TaxonomicTree.NewInstance(label); |
|
1637 |
importRepresentation(elTaxonHierarchy, sddNamespace, taxonomicTree, "", sddConfig); |
|
1636 |
TaxonomicTree taxonomicTree = TaxonomicTree.NewInstance(label);
|
|
1637 |
importRepresentation(elTaxonHierarchy, sddNamespace, taxonomicTree, "", sddConfig);
|
|
1638 | 1638 |
|
1639 | 1639 |
Set<TaxonNode> root = taxonomicTree.getRootNodes(); |
1640 | 1640 |
Element elNodes = elTaxonHierarchy.getChild("Nodes", sddNamespace); // There can be only one <Nodes> block for TaxonHierarchies |
... | ... | |
1687 | 1687 |
if (elGeographicAreas != null) { |
1688 | 1688 |
List<Element> listGeographicAreas = elGeographicAreas.getChildren("GeographicArea", sddNamespace); |
1689 | 1689 |
int j = 0; |
1690 |
|
|
1690 |
|
|
1691 | 1691 |
for (Element elGeographicArea : listGeographicAreas){ |
1692 | 1692 |
|
1693 | 1693 |
String id = elGeographicArea.getAttributeValue("id"); |
1694 | 1694 |
NamedArea na = new NamedArea(); |
1695 | 1695 |
importRepresentation(elGeographicArea, sddNamespace, na, id, sddConfig); |
1696 | 1696 |
namedAreas.put(id,na); |
1697 |
} |
|
1697 |
}
|
|
1698 | 1698 |
if ((++j % modCount) == 0){ logger.info("GeographicAreas handled: " + j);} |
1699 |
} |
|
1700 |
} |
|
1699 |
}
|
|
1700 |
}
|
|
1701 | 1701 |
} |
Also available in: Unified diff
merging /branches/cdmlib/SPRINT-Chichorieae1/ to trunk