Search in sources :

Example 1 with Classification

use of org.openlca.ilcd.commons.Classification in project olca-modules by GreenDelta.

the class FlowExport method makeCategoryInfo.

private void makeCategoryInfo(DataSetInfo dataSetInfo) {
    CategoryConverter converter = new CategoryConverter();
    FlowCategoryInfo info = new FlowCategoryInfo();
    dataSetInfo.classificationInformation = info;
    if (flow.flowType == org.openlca.core.model.FlowType.ELEMENTARY_FLOW) {
        CompartmentList categorization = converter.getElementaryFlowCategory(flow.category);
        info.compartmentLists.add(categorization);
    } else {
        Classification classification = converter.getClassification(flow.category);
        info.classifications.add(classification);
    }
}
Also used : Classification(org.openlca.ilcd.commons.Classification) CompartmentList(org.openlca.ilcd.flows.CompartmentList) FlowCategoryInfo(org.openlca.ilcd.flows.FlowCategoryInfo)

Example 2 with Classification

use of org.openlca.ilcd.commons.Classification in project olca-modules by GreenDelta.

the class SystemExport method initModel.

private Model initModel() {
    Model model = new Model();
    Models.setOrigin(model, "openLCA");
    model.version = "1.1";
    model.locations = "../ILCDLocations.xml";
    DataSetInfo info = Models.forceDataSetInfo(model);
    info.uuid = system.refId;
    ModelName name = Models.forceModelName(model);
    name.name.add(LangString.of(system.name, config.lang));
    if (system.description != null) {
        info.comment.add(LangString.of(system.description, config.lang));
    }
    CategoryConverter conv = new CategoryConverter();
    Classification c = conv.getClassification(system.category);
    if (c != null)
        Models.forceClassifications(model).add(c);
    if (system.referenceProcess != null) {
        long refId = system.referenceProcess.id;
        QuantitativeReference qRef = Models.forceQuantitativeReference(model);
        qRef.refProcess = processIDs.getOrDefault(refId, -1);
    }
    Models.forcePublication(model).version = Version.asString(system.version);
    model.modelling = new Modelling();
    return model;
}
Also used : ModelName(org.openlca.ilcd.models.ModelName) Classification(org.openlca.ilcd.commons.Classification) Model(org.openlca.ilcd.models.Model) Modelling(org.openlca.ilcd.models.Modelling) DataSetInfo(org.openlca.ilcd.models.DataSetInfo) QuantitativeReference(org.openlca.ilcd.models.QuantitativeReference)

Example 3 with Classification

use of org.openlca.ilcd.commons.Classification in project olca-modules by GreenDelta.

the class ActorExport method addClassification.

private void addClassification(DataSetInfo dataSetInfo) {
    if (actor.category == null)
        return;
    CategoryConverter converter = new CategoryConverter();
    Classification classification = converter.getClassification(actor.category);
    if (classification != null) {
        dataSetInfo.classifications.add(classification);
    }
}
Also used : Classification(org.openlca.ilcd.commons.Classification)

Example 4 with Classification

use of org.openlca.ilcd.commons.Classification in project olca-modules by GreenDelta.

the class CategoryConverter method getClassification.

Classification getClassification(Category category) {
    if (category == null)
        return null;
    Classification classification = new Classification();
    if (category != null) {
        Stack<Category> stack = fillStack(category);
        makeClasses(classification, stack);
    }
    return classification;
}
Also used : Category(org.openlca.core.model.Category) Classification(org.openlca.ilcd.commons.Classification)

Example 5 with Classification

use of org.openlca.ilcd.commons.Classification in project olca-modules by GreenDelta.

the class DataSetInfo method clone.

@Override
public DataSetInfo clone() {
    DataSetInfo clone = new DataSetInfo();
    clone.uuid = uuid;
    if (name != null)
        clone.name = name.clone();
    clone.subIdentifier = subIdentifier;
    LangString.copy(synonyms, clone.synonyms);
    if (complementingProcesses != null) {
        clone.complementingProcesses = new Ref[complementingProcesses.length];
        for (int i = 0; i < complementingProcesses.length; i++) {
            Ref p = complementingProcesses[i];
            if (p == null)
                continue;
            clone.complementingProcesses[i] = p.clone();
        }
    }
    for (Classification c : classifications) {
        if (c == null)
            continue;
        clone.classifications.add(c.clone());
    }
    LangString.copy(comment, clone.comment);
    Ref.copy(externalDocs, clone.externalDocs);
    if (other != null)
        clone.other = other.clone();
    clone.otherAttributes.putAll(otherAttributes);
    return clone;
}
Also used : Ref(org.openlca.ilcd.commons.Ref) Classification(org.openlca.ilcd.commons.Classification)

Aggregations

Classification (org.openlca.ilcd.commons.Classification)10 Test (org.junit.Test)2 Model (org.openlca.ilcd.models.Model)2 InputStream (java.io.InputStream)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 Category (org.openlca.core.model.Category)1 Category (org.openlca.ilcd.commons.Category)1 Ref (org.openlca.ilcd.commons.Ref)1 DataSetInfo (org.openlca.ilcd.flowproperties.DataSetInfo)1 CompartmentList (org.openlca.ilcd.flows.CompartmentList)1 FlowCategoryInfo (org.openlca.ilcd.flows.FlowCategoryInfo)1 Connection (org.openlca.ilcd.models.Connection)1 DataSetInfo (org.openlca.ilcd.models.DataSetInfo)1 DownstreamLink (org.openlca.ilcd.models.DownstreamLink)1 Group (org.openlca.ilcd.models.Group)1 GroupRef (org.openlca.ilcd.models.GroupRef)1 ModelName (org.openlca.ilcd.models.ModelName)1 Modelling (org.openlca.ilcd.models.Modelling)1 Parameter (org.openlca.ilcd.models.Parameter)1