Search in sources :

Example 16 with OmObservationConstellation

use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.

the class OmEncoderv20Test method createComplexObservation.

protected OmObservation createComplexObservation() {
    DateTime now = new DateTime(DateTimeZone.UTC);
    TimeInstant resultTime = new TimeInstant(now);
    TimeInstant phenomenonTime = new TimeInstant(now);
    TimePeriod validTime = new TimePeriod(now.minusMinutes(5), now.plusMinutes(5));
    OmObservation observation = new OmObservation();
    OmObservationConstellation observationConstellation = new OmObservationConstellation();
    observationConstellation.setFeatureOfInterest(new SamplingFeature(new CodeWithAuthority("feature", CODE_SPACE)));
    OmCompositePhenomenon observableProperty = new OmCompositePhenomenon(PARENT_OBSERVABLE_PROPERTY);
    observableProperty.addPhenomenonComponent(new OmObservableProperty(CHILD_OBSERVABLE_PROPERTY_1));
    observableProperty.addPhenomenonComponent(new OmObservableProperty(CHILD_OBSERVABLE_PROPERTY_2));
    observableProperty.addPhenomenonComponent(new OmObservableProperty(CHILD_OBSERVABLE_PROPERTY_3));
    observableProperty.addPhenomenonComponent(new OmObservableProperty(CHILD_OBSERVABLE_PROPERTY_4));
    observationConstellation.setObservableProperty(observableProperty);
    observationConstellation.setObservationType(OmConstants.OBS_TYPE_COMPLEX_OBSERVATION);
    observationConstellation.addOffering(OFFERING);
    AbstractFeature procedure = new SosProcedureDescriptionUnknownType(PROCEDURE);
    // procedure.setIdentifier(new CodeWithAuthority(PROCEDURE, CODE_SPACE));
    observationConstellation.setProcedure(procedure);
    observation.setObservationConstellation(observationConstellation);
    observation.setParameter(null);
    observation.setResultTime(resultTime);
    observation.setTokenSeparator(TOKEN_SEPERATOR);
    observation.setTupleSeparator(TUPLE_SEPERATOR);
    observation.setValidTime(validTime);
    ComplexValue complexValue = new ComplexValue();
    SweDataRecord sweDataRecord = new SweDataRecord();
    SweQuantity sweQuantity = new SweQuantity();
    sweQuantity.setDefinition(CHILD_OBSERVABLE_PROPERTY_1);
    sweQuantity.setUom("unit");
    sweQuantity.setValue(42.0);
    sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_1_NAME, sweQuantity));
    SweBoolean sweBoolean = new SweBoolean();
    sweBoolean.setValue(Boolean.TRUE);
    sweBoolean.setDefinition(CHILD_OBSERVABLE_PROPERTY_2);
    sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_2_NAME, sweBoolean));
    SweCount sweCount = new SweCount();
    sweCount.setDefinition(CHILD_OBSERVABLE_PROPERTY_3);
    sweCount.setValue(42);
    sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_3_NAME, sweCount));
    SweText sweText = new SweText();
    sweText.setDefinition(CHILD_OBSERVABLE_PROPERTY_4);
    sweText.setValue("42");
    sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_4_NAME, sweText));
    SweCategory sweCategory = new SweCategory();
    sweCategory.setDefinition(CHILD_OBSERVABLE_PROPERTY_5);
    sweCategory.setCodeSpace(CODE_SPACE);
    sweCategory.setValue("52");
    sweDataRecord.addField(new SweField(CHILD_OBSERVABLE_PROPERTY_5_NAME, sweCategory));
    complexValue.setValue(sweDataRecord);
    observation.setValue(new SingleObservationValue<>(phenomenonTime, complexValue));
    return observation;
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) ComplexValue(org.n52.shetland.ogc.om.values.ComplexValue) SweText(org.n52.shetland.ogc.swe.simpleType.SweText) OmCompositePhenomenon(org.n52.shetland.ogc.om.OmCompositePhenomenon) TimePeriod(org.n52.shetland.ogc.gml.time.TimePeriod) OmObservation(org.n52.shetland.ogc.om.OmObservation) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) SamplingFeature(org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) DateTime(org.joda.time.DateTime) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) SweField(org.n52.shetland.ogc.swe.SweField) SosProcedureDescriptionUnknownType(org.n52.shetland.ogc.sos.SosProcedureDescriptionUnknownType) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) CodeWithAuthority(org.n52.shetland.ogc.gml.CodeWithAuthority) TimeInstant(org.n52.shetland.ogc.gml.time.TimeInstant) OmObservableProperty(org.n52.shetland.ogc.om.OmObservableProperty)

Example 17 with OmObservationConstellation

use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.

the class InsertResultTemplateRequestDecoderTest method observationTemplate.

@Test
public void observationTemplate() throws IOException, DecodingException {
    InsertResultTemplateRequest req = load();
    OmObservationConstellation oc = req.getObservationTemplate();
    assertThat(oc, is(notNullValue()));
    assertThat(oc.getObservationType(), is("http://www.opengis.net/def/observationType/OGC-OM/2.0/OM_Measurement"));
    assertThat(oc.getProcedure(), is(notNullValue()));
    assertThat(oc.getProcedure().getIdentifier(), is("http://52north.org/example/procedure/6"));
    assertThat(oc.getObservableProperty(), is(notNullValue()));
    assertThat(oc.getObservableProperty().getIdentifier(), is("http://52north.org/example/observedProperty/6"));
    assertThat(oc.getFeatureOfInterest(), is(notNullValue()));
    assertThat(oc.getFeatureOfInterest().getIdentifierCodeWithAuthority(), is(notNullValue()));
    assertThat(oc.getFeatureOfInterest().getIdentifierCodeWithAuthority().getCodeSpace(), is("http://www.opengis.net/def/nil/OGC/0/unknown"));
    assertThat(oc.getFeatureOfInterest().getIdentifierCodeWithAuthority().getValue(), is("http://52north.org/example/feature/6"));
}
Also used : OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) InsertResultTemplateRequest(org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest) Test(org.junit.Test)

Example 18 with OmObservationConstellation

use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.

the class MeasurementDecodingTest method testFeatureOfInterestName.

@Test
public void testFeatureOfInterestName() {
    assertThat(observation, is(notNullValue()));
    final OmObservationConstellation oc = observation.getObservationConstellation();
    assertThat(oc, is(notNullValue()));
    final AbstractFeature foi = oc.getFeatureOfInterest();
    assertThat(foi, is(notNullValue()));
    final List<CodeType> name = foi.getName();
    assertThat(name, is(notNullValue()));
    assertThat(name.size(), is(3));
    assertThat(name.get(0), is(notNullValue()));
    assertThat(name.get(0).getValue(), is(equalTo(FEATURE_NAME)));
    assertThat(name.get(0).getCodeSpace().toString(), is(equalTo("http://x.y/z")));
    assertThat(name.get(1), is(notNullValue()));
    assertThat(name.get(1).getValue(), is(equalTo("othername1")));
    assertThat(name.get(1).isSetCodeSpace(), is(false));
    assertThat(name.get(2), is(notNullValue()));
    assertThat(name.get(2).getValue(), is(equalTo("othername2")));
    assertThat(name.get(2).isSetCodeSpace(), is(false));
}
Also used : AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) CodeType(org.n52.shetland.ogc.gml.CodeType) OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) Test(org.junit.Test)

Example 19 with OmObservationConstellation

use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.

the class MeasurementDecodingTest method testFeatureOfInterestIdentifier.

@Test
public void testFeatureOfInterestIdentifier() {
    assertThat(observation, is(notNullValue()));
    final OmObservationConstellation oc = observation.getObservationConstellation();
    assertThat(oc, is(notNullValue()));
    final AbstractFeature foi = oc.getFeatureOfInterest();
    assertThat(foi, is(notNullValue()));
    assertThat(foi.getIdentifierCodeWithAuthority(), is(notNullValue()));
    assertThat(foi.getIdentifierCodeWithAuthority().getCodeSpace(), is(equalTo(UNKNOWN_CODESPACE)));
    assertThat(foi.getIdentifierCodeWithAuthority().getValue(), is(equalTo(FEATURE_IDENTIFIER)));
}
Also used : AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) Test(org.junit.Test)

Example 20 with OmObservationConstellation

use of org.n52.shetland.ogc.om.OmObservationConstellation in project arctic-sea by 52North.

the class MeasurementDecodingTest method testObservedProperty.

@Test
public void testObservedProperty() {
    assertThat(observation, is(notNullValue()));
    final OmObservationConstellation oc = observation.getObservationConstellation();
    assertThat(oc, is(notNullValue()));
    final AbstractPhenomenon op = oc.getObservableProperty();
    assertThat(op, is(notNullValue()));
    assertThat(op.getIdentifier(), is(equalTo(OBSERVED_PROPERTY)));
}
Also used : AbstractPhenomenon(org.n52.shetland.ogc.om.AbstractPhenomenon) OmObservationConstellation(org.n52.shetland.ogc.om.OmObservationConstellation) Test(org.junit.Test)

Aggregations

OmObservationConstellation (org.n52.shetland.ogc.om.OmObservationConstellation)28 Test (org.junit.Test)18 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)8 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)7 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)7 InsertResultTemplateRequest (org.n52.shetland.ogc.sos.request.InsertResultTemplateRequest)6 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)5 OMObservationType (net.opengis.om.x20.OMObservationType)4 CodeType (org.n52.shetland.ogc.gml.CodeType)4 Matchers.containsString (org.hamcrest.Matchers.containsString)3 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)3 OmObservation (org.n52.shetland.ogc.om.OmObservation)3 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)3 DateTime (org.joda.time.DateTime)2 SensorML (org.n52.shetland.ogc.sensorML.SensorML)2 SosResultStructure (org.n52.shetland.ogc.sos.SosResultStructure)2 SweField (org.n52.shetland.ogc.swe.SweField)2 Date (java.util.Date)1 SFSamplingFeatureDocument (net.opengis.sampling.x20.SFSamplingFeatureDocument)1 SFSamplingFeatureType (net.opengis.sampling.x20.SFSamplingFeatureType)1