Project

General

Profile

Revision 833731f1

ID833731f1c113a539fb72836a6ccfbe7ade35835e
Parent 979d74e5
Child 9b9b5b41

Added by Patrick Plitzner over 1 year ago

ref #8248 Add feature to export (partially)

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/descriptive/owl/in/OwlImportUtil.java
23 23
import eu.etaxonomy.cdm.io.descriptive.owl.OwlUtil;
24 24
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
25 25
import eu.etaxonomy.cdm.model.common.Language;
26
import eu.etaxonomy.cdm.model.description.Character;
26 27
import eu.etaxonomy.cdm.model.description.Feature;
27 28
import eu.etaxonomy.cdm.model.media.Media;
28 29
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
......
43 44

  
44 45
    static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(OwlImportUtil.class);
45 46

  
47
    static Feature createFeature(Resource termResource, ITermService termService, Model model, StructureTreeOwlImportState state){
48
        Feature feature = Feature.NewInstance();
49
        if(termResource.hasProperty(OwlUtil.propFeatureIsCategorical)){
50
            feature.setSupportsCategoricalData(termResource.getProperty(OwlUtil.propFeatureIsCategorical).getBoolean());
51
        }
52
        if(termResource.hasProperty(OwlUtil.propFeatureIsQuantitative)){
53
            feature.setSupportsQuantitativeData(termResource.getProperty(OwlUtil.propFeatureIsQuantitative).getBoolean());
54
        }
55
//        // import measurement units
56
//        Set<DefinedTermBase> measurementUnits = new HashSet<>();
57
//        List<Statement> measurementUnitStatements = termResource.listProperties(OwlUtil.propFeatureHasRecommendedMeasurementUnit).toList();
58
//        for (Statement statement : measurementUnitStatements) {
59
//            Resource measurementUnitResource = model.createResource(statement.getObject().toString());
60
//            measurementUnits.add(OwlImportUtil.createTerm(measurementUnitResource, termService, model, state));
61
//        }
62
//        measurementUnits.forEach(unit->feature.addRecommendedMeasurementUnit(unit));
63

  
64
        return feature;
65
    }
66

  
67
    static Character createCharacter(Resource termResource, ITermService termService, Model model, StructureTreeOwlImportState state){
68
        Character character = Character.NewInstance();
69
        return character;
70
    }
71

  
46 72
    static DefinedTermBase createTerm(Resource termResource, ITermService termService, Model model, StructureTreeOwlImportState state){
47 73
        TermType termType = TermType.getByKey(termResource.getProperty(OwlUtil.propType).getString());
48 74
        DefinedTermBase term;
49 75
        // create new term
50 76
        if(termType.equals(TermType.Feature)){
51
            term = Feature.NewInstance();
77
            term = createFeature(termResource, termService, model, state);
78
        }
79
        else if(termType.equals(TermType.Character)){
80
            term = createCharacter(termResource, termService, model, state);
52 81
        }
53 82
        else{
54 83
            term = DefinedTerm.NewInstance(termType);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)