Search in sources :

Example 16 with VariableGroup

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

the class VE_VariableGroup_2_Test method invalid.

@Test
public void invalid() {
    Generic vg1 = new Generic();
    vg1.setName("not-unique");
    Generic vg2 = new Generic();
    vg2.setName("not-unique");
    builder.build(vg1);
    builder.build(vg2);
    builder.complete();
    List<ValidationDiagnostic<VariableGroup>> diagnostics = validationError.validate();
    assertEquals(2, diagnostics.size());
    List<VariableGroup> invalidVariableGroups = diagnostics.stream().map(ValidationDiagnostic::getValidatedObject).collect(Collectors.toList());
    assertTrue(invalidVariableGroups.contains(vg1));
    assertTrue(invalidVariableGroups.contains(vg2));
}
Also used : Generic(com.opensimulationplatform.core.model.modeldescription.variablegroup.generic.Generic) VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup) ValidationDiagnostic(com.opensimulationplatform.core.validation.ValidationDiagnostic) Test(org.junit.Test)

Example 17 with VariableGroup

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

the class VE_VariableGroup_1 method getInvalidObjects.

@Override
protected List<VariableGroup> getInvalidObjects() {
    OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_VariableGroup_1, context.owl.prefixManager);
    Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
    return invalidIndividuals.stream().map(individual -> context.variableGroups.get(individual)).collect(Collectors.toList());
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup) List(java.util.List) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) VE_VariableGroup_1(com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_VariableGroup_1) Set(java.util.Set) ValidationError(com.opensimulationplatform.core.validation.ValidationError) Collectors(java.util.stream.Collectors) OWLClass(org.semanticweb.owlapi.model.OWLClass) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLClass(org.semanticweb.owlapi.model.OWLClass)

Example 18 with VariableGroup

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

the class VE_VariableGroup_2 method getInvalidObjects.

@Override
protected List<VariableGroup> getInvalidObjects() {
    OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_VariableGroup_2, context.owl.prefixManager);
    Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
    return invalidIndividuals.stream().map(individual -> context.variableGroups.get(individual)).collect(Collectors.toList());
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup) List(java.util.List) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) VE_VariableGroup_2(com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_VariableGroup_2) Set(java.util.Set) ValidationError(com.opensimulationplatform.core.validation.ValidationError) Collectors(java.util.stream.Collectors) OWLClass(org.semanticweb.owlapi.model.OWLClass) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLClass(org.semanticweb.owlapi.model.OWLClass)

Example 19 with VariableGroup

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

the class VE_VariableGroup_3 method getInvalidObjects.

@Override
protected List<VariableGroup> getInvalidObjects() {
    OWLClass validationErrorClass = context.owl.dataFactory.getOWLClass(VE_VariableGroup_3, context.owl.prefixManager);
    Set<OWLNamedIndividual> invalidIndividuals = context.invalidIndividuals.get(validationErrorClass);
    return invalidIndividuals.stream().map(individual -> context.variableGroups.get(individual)).collect(Collectors.toList());
}
Also used : VariableGroup(com.opensimulationplatform.core.model.modeldescription.variablegroup.VariableGroup) List(java.util.List) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) VE_VariableGroup_3(com.opensimulationplatform.gen.owl.model.OntologyClasses.VE_VariableGroup_3) Set(java.util.Set) ValidationError(com.opensimulationplatform.core.validation.ValidationError) Collectors(java.util.stream.Collectors) OWLClass(org.semanticweb.owlapi.model.OWLClass) OWLNamedIndividual(org.semanticweb.owlapi.model.OWLNamedIndividual) OWLClass(org.semanticweb.owlapi.model.OWLClass)

Example 20 with VariableGroup

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

the class VariableGroupConnectionOwlBuilder method makeNestedVariableGroupConnections.

private void makeNestedVariableGroupConnections(VariableGroupConnection variableGroupConnection, OWLNamedIndividual individual) {
    List<VariableGroup> variableGroupsA = variableGroupConnection.getVariableGroupA().getVariableGroups();
    List<VariableGroup> variableGroupsB = variableGroupConnection.getVariableGroupB().getVariableGroups();
    for (int i = 0; i < min(variableGroupsA.size(), variableGroupsB.size()); i++) {
        VariableGroupConnection connection = new VariableGroupConnection();
        connection.setSimulatorA(connection.getSimulatorA());
        connection.setSimulatorB(connection.getSimulatorB());
        connection.setVariableGroupA(variableGroupsA.get(i));
        connection.setVariableGroupB(variableGroupsB.get(i));
        OWLNamedIndividual variableGroupConnectionIndividual = this.build(connection);
        OWLObjectProperty hasConnection = context.owl.dataFactory.getOWLObjectProperty(op_has_connection, context.owl.prefixManager);
        OWLAxiom axiom = context.owl.dataFactory.getOWLObjectPropertyAssertionAxiom(hasConnection, individual, variableGroupConnectionIndividual);
        context.axioms.add(axiom);
    }
}
Also used : VariableGroupConnection(com.opensimulationplatform.core.model.systemstructure.VariableGroupConnection) VariableGroupConnection(com.opensimulationplatform.gen.owl.model.OntologyClasses.VariableGroupConnection) 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)

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