Search in sources :

Example 26 with VariableGroup

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup in project osp-validator by open-simulation-platform.

the class SimulatorOwlBuilder method setVariableGroups.

private void setVariableGroups(Simulator simulator, OWLNamedIndividual simulatorIndividual) {
    List<VariableGroup> variableGroups = simulator.getModelDescription().getVariableGroups();
    VariableGroupOwlBuilder variableGroupOwlBuilder = new VariableGroupOwlBuilder();
    variableGroupOwlBuilder.setContext(context);
    variableGroups.forEach(variableGroup -> {
        if ("".equals(simulator.getName().get())) {
            variableGroup.getName().setId(() -> variableGroup.getName().get());
        } else {
            variableGroup.getName().setId(() -> simulator.getName().get() + "." + variableGroup.getName().get());
        }
        OWLNamedIndividual variableGroupIndividual = variableGroupOwlBuilder.build(variableGroup);
        OWLObjectProperty hasVariableGroup = context.owl.dataFactory.getOWLObjectProperty(op_has_variable_group, context.owl.prefixManager);
        OWLAxiom axiom = context.owl.dataFactory.getOWLObjectPropertyAssertionAxiom(hasVariableGroup, simulatorIndividual, variableGroupIndividual);
        context.axioms.add(axiom);
    });
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLAxiom(org.semanticweb.owlapi.model.OWLAxiom) OWLObjectProperty(org.semanticweb.owlapi.model.OWLObjectProperty)

Example 27 with VariableGroup

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup in project osp-validator by open-simulation-platform.

the class VariableGroupConnectionConverter method convert.

@Override
public VariableGroupConnection convert(Connections.VariableGroupConnection variableGroupConnectionElement) {
    VariableGroupConnection variableGroupConnection = new VariableGroupConnection();
    List<VariableEndpoint> variableEndpoints = variableGroupConnectionElement.getVariableGroup();
    VariableEndpoint variableEndpointA = variableEndpoints.get(0);
    VariableEndpoint variableEndpointB = variableEndpoints.get(1);
    Simulator simulatorA = SystemStructureUtil.getSimulatorByName(context.systemStructure, variableEndpointA.getSimulator()).get();
    VariableGroup variableGroupA = ModelDescriptionUtil.getVariableGroupByName(simulatorA.getModelDescription(), variableEndpointA.getName());
    variableGroupConnection.setSimulatorA(simulatorA);
    variableGroupConnection.setVariableGroupA(variableGroupA);
    Simulator simulatorB = SystemStructureUtil.getSimulatorByName(context.systemStructure, variableEndpointB.getSimulator()).get();
    VariableGroup variableGroupB = ModelDescriptionUtil.getVariableGroupByName(simulatorB.getModelDescription(), variableEndpointB.getName());
    variableGroupConnection.setSimulatorB(simulatorB);
    variableGroupConnection.setVariableGroupB(variableGroupB);
    return variableGroupConnection;
}
Also used : VariableGroupConnection(com.opensimulationplatform.core.model.systemstructure.VariableGroupConnection) VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup) Simulator(com.opensimulationplatform.core.model.systemstructure.Simulator) VariableEndpoint(com.opensimulationplatform.systemstructure.xml.model.VariableEndpoint)

Example 28 with VariableGroup

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup in project osp-validator by open-simulation-platform.

the class Validator method addLinearVelocity.

private void addLinearVelocity(ModelDescription modelDescription, Map<Object, Object> map, LinearVelocityType element) {
    VariableGroup variableGroup = ModelDescriptionUtil.getVariableGroupByName(modelDescription, element.getName());
    if (variableGroup != null) {
        map.put(variableGroup, element);
        addVariables(modelDescription, map, element.getVariable());
    }
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)

Example 29 with VariableGroup

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup in project osp-validator by open-simulation-platform.

the class Validator method addAngularDisplacement.

private void addAngularDisplacement(ModelDescription modelDescription, Map<Object, Object> map, AngularDisplacementType angularDisplacementElement) {
    VariableGroup angularDisplacement = ModelDescriptionUtil.getVariableGroupByName(modelDescription, angularDisplacementElement.getName());
    if (angularDisplacement != null) {
        map.put(angularDisplacement, angularDisplacementElement);
        addVariables(modelDescription, map, angularDisplacementElement.getVariable());
    }
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)

Example 30 with VariableGroup

use of com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup in project osp-validator by open-simulation-platform.

the class Validator method addHydraulicQuasiPort.

private void addHydraulicQuasiPort(ModelDescription modelDescription, Map<Object, Object> map, HydraulicQuasiPortType element) {
    VariableGroup variableGroup = ModelDescriptionUtil.getVariableGroupByName(modelDescription, element.getName());
    if (variableGroup != null) {
        map.put(variableGroup, element);
        addPressure(modelDescription, map, element.getPressure());
        addVolume(modelDescription, map, element.getVolume());
    }
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)

Aggregations

VariableGroup (com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup)34 OWLNamedIndividual (org.semanticweb.owlapi.model.OWLNamedIndividual)6 VariableGroupConnection (com.opensimulationplatform.core.model.systemstructure.VariableGroupConnection)5 Test (org.junit.Test)5 Simulator (com.opensimulationplatform.core.model.systemstructure.Simulator)4 ValidationDiagnostic (com.opensimulationplatform.core.validation.ValidationDiagnostic)4 Variable (com.opensimulationplatform.core.model.modeldescription.Variable)3 Generic (com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic)3 ValidationError (com.opensimulationplatform.core.validation.ValidationError)3 List (java.util.List)3 Set (java.util.Set)3 Collectors (java.util.stream.Collectors)3 OWLAxiom (org.semanticweb.owlapi.model.OWLAxiom)3 OWLClass (org.semanticweb.owlapi.model.OWLClass)3 OWLObjectProperty (org.semanticweb.owlapi.model.OWLObjectProperty)3 Force (com.opensimulationplatform.core.model.modeldescription.variablegroup.force.Force)1 SystemStructure (com.opensimulationplatform.core.model.systemstructure.SystemStructure)1 VariableConnection (com.opensimulationplatform.core.model.systemstructure.VariableConnection)1 VE_VariableGroup_1 (com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_VariableGroup_1)1 VE_VariableGroup_2 (com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_VariableGroup_2)1