From 427e1aa6f16dc2da9ec07e51e437acb013bd279c Mon Sep 17 00:00:00 2001 From: eblondel Date: Tue, 20 Jun 2017 21:56:47 +0200 Subject: [PATCH] refactor abstract model + base support of GML model + GML units #55 #47 #43 #28 #57 #60 #61 #62 #63 #64 #65 #66 --- DESCRIPTION | 3 +- NAMESPACE | 28 +- R/GMLAbstractGML.R | 92 ++++++ R/GMLAbstractObject.R | 42 +++ ....R => GMLAbstractTimeGeometricPrimitive.R} | 14 +- R/GMLAbstractTimeObject.R | 47 +++ R/GMLAbstractTimePrimitive.R | 68 +++++ R/GMLBaseUnit.R | 64 ++++ R/GMLConventionalUnit.R | 103 +++++++ R/GMLDefinition.R | 69 +++++ R/GMLDerivedUnit.R | 81 ++++++ R/GMLElement.R | 69 +++++ R/GMLTimePeriod.R | 36 +-- R/GMLUnitDefinition.R | 76 +++++ ...OMetadataElement.R => ISOAbstractObject.R} | 275 ++++++++++++------ R/ISOAddress.R | 8 +- R/ISOAngle.R | 2 - R/ISOAssociationRole.R | 7 +- R/ISOBand.R | 25 +- R/ISOBaseBoolean.R | 8 +- R/ISOBaseCharacterString.R | 8 +- R/ISOBaseDate.R | 10 +- R/ISOBaseDateTime.R | 11 +- R/ISOBaseDecimal.R | 8 +- R/ISOBaseInteger.R | 8 +- R/ISOBaseReal.R | 8 +- R/ISOBaseTimeBeginPosition.R | 49 ---- R/ISOBaseTimeEndPosition.R | 49 ---- R/ISOBrowseGraphic.R | 8 +- R/ISOCellGeometry.R | 4 +- R/ISOCharacterSet.R | 4 +- R/ISOCitation.R | 8 +- R/ISOClassification.R | 6 +- ...taCodelistElement.R => ISOCodeListValue.R} | 16 +- R/ISOConformanceResult.R | 8 +- R/ISOConstraint.R | 8 +- R/ISOConstraints.R | 8 +- R/ISOContact.R | 8 +- R/ISOContentInformation.R | 8 +- R/ISOCoverageContentType.R | 4 +- R/ISOCoverageDescription.R | 21 +- R/ISODataIdentification.R | 7 +- R/ISODataQuality.R | 8 +- R/ISODate.R | 8 +- R/ISODateType.R | 4 +- R/ISODefinitionSource.R | 8 +- R/ISODigitalTransferOptions.R | 8 +- R/ISODimension.R | 8 +- R/ISODimensionNameType.R | 4 +- R/ISODistribution.R | 10 +- R/ISODomainConsistency.R | 8 +- R/ISOExtent.R | 8 +- R/ISOFeatureAttribute.R | 27 +- R/ISOFeatureCatalogue.R | 22 +- R/ISOFeatureCatalogueDescription.R | 6 +- R/ISOFeatureOperation.R | 6 +- R/ISOFeatureType.R | 21 +- R/ISOGeographicBoundingBox.R | 6 +- R/ISOGeographicDescription.R | 6 +- R/ISOGeographicExtent.R | 8 +- R/ISOGeometricObjectType.R | 4 +- R/ISOGeometricObjects.R | 8 +- R/ISOGeoreferenceable.R | 6 +- R/ISOGridSpatialRepresentation.R | 10 +- R/ISOHierarchyLevel.R | 4 +- R/ISOIdentification.R | 6 +- R/ISOIdentifier.R | 14 +- R/ISOKeywordType.R | 4 +- R/ISOKeywords.R | 8 +- R/ISOLanguage.R | 4 +- R/ISOLegalConstraints.R | 6 +- R/ISOLength.R | 2 - R/ISOLineage.R | 8 +- R/ISOListedValue.R | 8 +- R/ISOLocalName.R | 8 +- R/ISOMaintenanceFrequency.R | 4 +- R/ISOMaintenanceInformation.R | 8 +- R/ISOMeasure.R | 17 +- R/ISOMemberName.R | 8 +- R/ISOMetaIdentifier.R | 2 +- R/ISOMetadata.R | 13 +- R/ISOMetadataNamespace.R | 4 +- R/ISOMultiplicity.R | 8 +- R/ISOMultiplicityRange.R | 8 +- R/ISOOnlineResource.R | 8 +- R/ISOPresentationForm.R | 4 +- R/ISOProcessStep.R | 8 +- R/ISOPropertyType.R | 18 +- R/ISORangeDimension.R | 14 +- R/ISORecord.R | 8 +- R/ISORecordType.R | 8 +- R/ISOReferenceIdentifier.R | 2 +- R/ISOReferenceSystem.R | 8 +- R/ISORepresentativeFraction.R | 8 +- R/ISOResponsibleParty.R | 8 +- R/ISORestriction.R | 4 +- R/ISORole.R | 4 +- R/ISOScale.R | 2 - R/ISOScope.R | 8 +- R/ISOSecurityConstraints.R | 6 +- R/ISOSource.R | 8 +- R/ISOSpatialRepresentation.R | 6 +- R/ISOSpatialRepresentationType.R | 4 +- R/ISOStatus.R | 4 +- R/ISOTelephone.R | 8 +- R/ISOTemporalExtent.R | 8 +- R/ISOTopicCategory.R | 4 +- R/ISOTopologyLevel.R | 4 +- R/ISOTypeName.R | 8 +- R/ISOURL.R | 8 +- R/ISOUnitOfMeasure.R | 84 ------ R/ISOUnlimitedInteger.R | 8 +- R/ISOUomAngle.R | 40 --- R/ISOUomArea.R | 40 --- R/ISOUomCurrency.R | 40 --- R/ISOUomLength.R | 40 --- R/ISOUomScale.R | 40 --- R/ISOUomTime.R | 40 --- R/ISOUomVelocity.R | 40 --- R/ISOUomVolume.R | 40 --- R/ISOUomWeight.R | 40 --- R/ISOVectorSpatialRepresentation.R | 6 +- R/ISOVerticalExtent.R | 16 +- R/ISoDefinitionReference.R | 8 +- R/geometa.R | 5 +- man/GMLAbstractGML.Rd | 60 ++++ man/GMLAbstractObject.Rd | 39 +++ ...d => GMLAbstractTimeGeometricPrimitive.Rd} | 14 +- man/GMLAbstractTimeObject.Rd | 53 ++++ man/GMLAbstractTimePrimitive.Rd | 49 ++++ man/GMLBaseUnit.Rd | 57 ++++ man/GMLConventionalUnit.Rd | 69 +++++ man/GMLDefinition.Rd | 58 ++++ man/GMLDerivedUnit.Rd | 60 ++++ man/GMLElement.Rd | 37 +++ man/GMLUnitDefinition.Rd | 61 ++++ ...etadataElement.Rd => ISOAbstractObject.Rd} | 37 ++- man/ISOBand.Rd | 15 +- man/ISOBaseTimeBeginPosition.Rd | 39 --- man/ISOBaseTimeEndPosition.Rd | 39 --- ...CodelistElement.Rd => ISOCodeListValue.Rd} | 14 +- man/ISOContentInformation.Rd | 2 +- man/ISOCoverageDescription.Rd | 13 +- man/ISODistribution.Rd | 2 +- man/ISOFeatureAttribute.Rd | 15 +- man/ISOFeatureCatalogue.Rd | 14 +- man/ISOFeatureType.Rd | 13 +- man/ISOGeographicExtent.Rd | 2 +- man/ISOIdentifier.Rd | 2 +- man/ISOMetadata.Rd | 6 +- man/ISOPropertyType.Rd | 2 +- man/ISORangeDimension.Rd | 2 +- man/ISOUnitOfMeasure.Rd | 52 ---- man/ISOUomAngle.Rd | 41 --- man/ISOUomArea.Rd | 41 --- man/ISOUomCurrency.Rd | 41 --- man/ISOUomLength.Rd | 41 --- man/ISOUomScale.Rd | 41 --- man/ISOUomTime.Rd | 41 --- man/ISOUomVelocity.Rd | 41 --- man/ISOUomVolume.Rd | 41 --- man/ISOUomWeight.Rd | 41 --- man/ISOVerticalExtent.Rd | 4 - man/geometa.Rd | 5 +- tests/testthat/test_GMLDefinition.R | 30 ++ tests/testthat/test_GMLElement.R | 36 +++ tests/testthat/test_GMLTimePeriod.R | 2 +- tests/testthat/test_GMLUnitDefinition.R | 102 +++++++ tests/testthat/test_ISOAddress.R | 2 +- tests/testthat/test_ISOBand.R | 17 +- tests/testthat/test_ISOBaseBoolean.R | 4 +- tests/testthat/test_ISOBaseCharacterString.R | 2 +- tests/testthat/test_ISOBaseDate.R | 4 +- tests/testthat/test_ISOBaseDateTime.R | 4 +- tests/testthat/test_ISOBaseDecimal.R | 2 +- tests/testthat/test_ISOBaseInteger.R | 4 +- tests/testthat/test_ISOBaseReal.R | 2 +- tests/testthat/test_ISOBrowseGraphic.R | 2 +- tests/testthat/test_ISOCitation.R | 2 +- tests/testthat/test_ISOConformanceResult.R | 2 +- tests/testthat/test_ISOConstraint.R | 3 +- tests/testthat/test_ISOConstraints.R | 2 +- tests/testthat/test_ISOContact.R | 2 +- tests/testthat/test_ISOCoverageDescription.R | 15 +- tests/testthat/test_ISODataIdentification.R | 2 +- tests/testthat/test_ISODataQuality.R | 2 +- tests/testthat/test_ISODate.R | 2 +- tests/testthat/test_ISODefinitionReference.R | 2 +- tests/testthat/test_ISODefinitionSource.R | 2 +- .../testthat/test_ISODigitalTransferOptions.R | 2 +- tests/testthat/test_ISODimension.R | 2 +- tests/testthat/test_ISODistribution.R | 2 +- tests/testthat/test_ISODomainConsistency.R | 2 +- tests/testthat/test_ISOExtent.R | 5 +- tests/testthat/test_ISOFeatureAttribute.R | 15 +- tests/testthat/test_ISOFeatureCatalogue.R | 15 +- .../test_ISOFeatureCatalogueDescription.R | 4 +- tests/testthat/test_ISOFeatureOperation.R | 2 +- tests/testthat/test_ISOFeatureType.R | 15 +- .../testthat/test_ISOGeographicBoundingBox.R | 2 +- .../testthat/test_ISOGeographicDescription.R | 2 +- tests/testthat/test_ISOGeometricObjects.R | 2 +- tests/testthat/test_ISOGeoreferenceable.R | 2 +- .../test_ISOGridSpatialRepresentation.R | 2 +- tests/testthat/test_ISOIdentifier.R | 10 +- tests/testthat/test_ISOKeywords.R | 2 +- tests/testthat/test_ISOLegalConstraints.R | 2 +- tests/testthat/test_ISOLineage.R | 2 +- tests/testthat/test_ISOListedValue.R | 2 +- tests/testthat/test_ISOLocalName.R | 2 +- .../testthat/test_ISOMaintenanceInformation.R | 2 +- tests/testthat/test_ISOMeasure.R | 10 +- tests/testthat/test_ISOMemberName.R | 2 +- tests/testthat/test_ISOMetaIdentifier.R | 2 +- tests/testthat/test_ISOMetadata.R | 2 +- tests/testthat/test_ISOMultiplicity.R | 2 +- tests/testthat/test_ISOMultiplicityRange.R | 2 +- tests/testthat/test_ISOOnlineResource.R | 2 +- tests/testthat/test_ISOProcessStep.R | 2 +- tests/testthat/test_ISOPropertyType.R | 2 +- tests/testthat/test_ISORangeDimension.R | 2 +- tests/testthat/test_ISORecord.R | 2 +- tests/testthat/test_ISORecordType.R | 2 +- tests/testthat/test_ISOReferenceIdentifier.R | 2 +- tests/testthat/test_ISOReferenceSystem.R | 2 +- .../testthat/test_ISORepresentativeFraction.R | 2 +- tests/testthat/test_ISOResponsibleParty.R | 2 +- tests/testthat/test_ISOScope.R | 2 +- tests/testthat/test_ISOSecurityConstraints.R | 2 +- tests/testthat/test_ISOSource.R | 2 +- .../testthat/test_ISOSpatialTemporalExtent.R | 2 +- tests/testthat/test_ISOTelephone.R | 2 +- tests/testthat/test_ISOTemporalExtent.R | 2 +- tests/testthat/test_ISOTypeName.R | 2 +- tests/testthat/test_ISOURL.R | 2 +- tests/testthat/test_ISOUnitOfMeasure.R | 109 ------- tests/testthat/test_ISOUnlimitedInteger.R | 2 +- .../test_ISOVectorSpatialRepresentation.R | 2 +- tests/testthat/test_ISOVerticalExtent.R | 7 +- 239 files changed, 2136 insertions(+), 1990 deletions(-) create mode 100644 R/GMLAbstractGML.R create mode 100644 R/GMLAbstractObject.R rename R/{GMLTemporalPrimitive.R => GMLAbstractTimeGeometricPrimitive.R} (62%) create mode 100644 R/GMLAbstractTimeObject.R create mode 100644 R/GMLAbstractTimePrimitive.R create mode 100644 R/GMLBaseUnit.R create mode 100644 R/GMLConventionalUnit.R create mode 100644 R/GMLDefinition.R create mode 100644 R/GMLDerivedUnit.R create mode 100644 R/GMLElement.R create mode 100644 R/GMLUnitDefinition.R rename R/{ISOMetadataElement.R => ISOAbstractObject.R} (74%) delete mode 100644 R/ISOBaseTimeBeginPosition.R delete mode 100644 R/ISOBaseTimeEndPosition.R rename R/{ISOMetadataCodelistElement.R => ISOCodeListValue.R} (87%) delete mode 100644 R/ISOUnitOfMeasure.R delete mode 100644 R/ISOUomAngle.R delete mode 100644 R/ISOUomArea.R delete mode 100644 R/ISOUomCurrency.R delete mode 100644 R/ISOUomLength.R delete mode 100644 R/ISOUomScale.R delete mode 100644 R/ISOUomTime.R delete mode 100644 R/ISOUomVelocity.R delete mode 100644 R/ISOUomVolume.R delete mode 100644 R/ISOUomWeight.R create mode 100644 man/GMLAbstractGML.Rd create mode 100644 man/GMLAbstractObject.Rd rename man/{GMLTemporalPrimitive.Rd => GMLAbstractTimeGeometricPrimitive.Rd} (61%) create mode 100644 man/GMLAbstractTimeObject.Rd create mode 100644 man/GMLAbstractTimePrimitive.Rd create mode 100644 man/GMLBaseUnit.Rd create mode 100644 man/GMLConventionalUnit.Rd create mode 100644 man/GMLDefinition.Rd create mode 100644 man/GMLDerivedUnit.Rd create mode 100644 man/GMLElement.Rd create mode 100644 man/GMLUnitDefinition.Rd rename man/{ISOMetadataElement.Rd => ISOAbstractObject.Rd} (79%) delete mode 100644 man/ISOBaseTimeBeginPosition.Rd delete mode 100644 man/ISOBaseTimeEndPosition.Rd rename man/{ISOMetadataCodelistElement.Rd => ISOCodeListValue.Rd} (77%) delete mode 100644 man/ISOUnitOfMeasure.Rd delete mode 100644 man/ISOUomAngle.Rd delete mode 100644 man/ISOUomArea.Rd delete mode 100644 man/ISOUomCurrency.Rd delete mode 100644 man/ISOUomLength.Rd delete mode 100644 man/ISOUomScale.Rd delete mode 100644 man/ISOUomTime.Rd delete mode 100644 man/ISOUomVelocity.Rd delete mode 100644 man/ISOUomVolume.Rd delete mode 100644 man/ISOUomWeight.Rd create mode 100644 tests/testthat/test_GMLDefinition.R create mode 100644 tests/testthat/test_GMLElement.R create mode 100644 tests/testthat/test_GMLUnitDefinition.R delete mode 100644 tests/testthat/test_ISOUnitOfMeasure.R diff --git a/DESCRIPTION b/DESCRIPTION index 5db4f255..e5d7c370 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -6,7 +6,8 @@ Date: 2017-06-16 Author: Emmanuel Blondel Maintainer: Emmanuel Blondel Description: Provides facilities to handle reading and writing of geographic metadata - defined with OGC/ISO 19115 and 19139 (XML) standards. + defined with OGC/ISO 19115 and 19110 geographic information metadata standards, and + encoded using the ISO 19139 (XML) standard. Depends: R (>= 3.1.0) Imports: R6, XML Suggests: testthat, roxygen2 diff --git a/NAMESPACE b/NAMESPACE index c3c570ac..18d951cd 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,18 @@ # Generated by roxygen2 (4.1.1): do not edit by hand -export(GMLTemporalPrimitive) +export(GMLAbstractGML) +export(GMLAbstractObject) +export(GMLAbstractTimeGeometricPrimitive) +export(GMLAbstractTimeObject) +export(GMLAbstractTimePrimitive) +export(GMLBaseUnit) +export(GMLConventionalUnit) +export(GMLDefinition) +export(GMLDerivedUnit) +export(GMLElement) export(GMLTimePeriod) +export(GMLUnitDefinition) +export(ISOAbstractObject) export(ISOAddress) export(ISOAngle) export(ISOAssociationRole) @@ -13,13 +24,12 @@ export(ISOBaseDateTime) export(ISOBaseDecimal) export(ISOBaseInteger) export(ISOBaseReal) -export(ISOBaseTimeBeginPosition) -export(ISOBaseTimeEndPosition) export(ISOBrowseGraphic) export(ISOCellGeometry) export(ISOCharacterSet) export(ISOCitation) export(ISOClassification) +export(ISOCodeListValue) export(ISOCodelist) export(ISOConformanceResult) export(ISOConstraint) @@ -70,8 +80,6 @@ export(ISOMeasure) export(ISOMemberName) export(ISOMetaIdentifier) export(ISOMetadata) -export(ISOMetadataCodelistElement) -export(ISOMetadataElement) export(ISOMetadataNamespace) export(ISOMultiplicity) export(ISOMultiplicityRange) @@ -103,17 +111,7 @@ export(ISOTopicCategory) export(ISOTopologyLevel) export(ISOTypeName) export(ISOURL) -export(ISOUnitOfMeasure) export(ISOUnlimitedInteger) -export(ISOUomAngle) -export(ISOUomArea) -export(ISOUomCurrency) -export(ISOUomLength) -export(ISOUomScale) -export(ISOUomTime) -export(ISOUomVelocity) -export(ISOUomVolume) -export(ISOUomWeight) export(ISOVectorSpatialRepresentation) export(ISOVerticalExtent) export(fetchISOCodelists) diff --git a/R/GMLAbstractGML.R b/R/GMLAbstractGML.R new file mode 100644 index 00000000..5c3bbd51 --- /dev/null +++ b/R/GMLAbstractGML.R @@ -0,0 +1,92 @@ +#' GMLAbstractGML +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML +#' @return Object of \code{\link{R6Class}} for modelling an GML abstract GML +#' @format \code{\link{R6Class}} object. +#' +#' @field descriptionReference +#' @field identifier +#' @field name +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, element, attrs, defaults)}}{ +#' This method is used to instantiate a GML abstract GML +#' } +#' \item{\code{setDescriptionReference(descriptionReference)}}{ +#' Set the descriptionReference +#' } +#' \item{\code{setIdentifier(identifier)}}{ +#' Set the identifier +#' } +#' \item{\code{addName(name)}}{ +#' Adds a name +#' } +#' \item{\code{delName(name)}}{ +#' Deletes a name +#' } +#' } +#' +#' @note Class used internally by geometa +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLAbstractGML <- R6Class("GMLAbstractGML", + inherit = GMLAbstractObject, + private = list( + xmlElement = "AbstractGML", + xmlNamespacePrefix = "GML" + ), + public = list( + #+ descriptionReference [0..1]: character + descriptionReference = NULL, + #+ identifier [0..1]: character + identifier = NULL, + #+ name [0..*]: character + name = list(), + initialize = function(xml = NULL, element = NULL, attrs = list(), defaults = list()){ + if(is.null(element)) element <- private$xmlElement + super$initialize(xml, element = element, attrs = attrs, defaults = defaults) + }, + + #setDescriptionReference + setDescriptionReference = function(descriptionReference){ + gmlElem <- GMLElement$new(element = "descriptionReference") + gmlElem$setHref(descriptionReference) + self$descriptionReference <- gmlElem + }, + + #setIdentifier + setIdentifier = function(identifier, codeSpace){ + gmlElem <- GMLElement$new(element = "identifier") + gmlElem$setValue(identifier) + gmlElem$setCodeSpace(codeSpace) + self$identifier <- gmlElem + }, + + #addName + addName = function(name, codeSpace = NULL){ + gmlElem <- GMLElement$new(element = "name") + if(!is.null(codeSpace)) gmlElem$setCodeSpace(codeSpace) + gmlElem$setValue(name) + return(self$addListElement("name", gmlElem)) + }, + + #delName + delName = function(name, codeSpace = NULL){ + gmlElem <- GMLElement$new(element = "name") + if(!is.null(codeSpace)) gmlElem$setCodeSpace(codeSpace) + gmlElem$setValue(name) + return(self$delListElement("name", gmlElem)) + } + ) +) \ No newline at end of file diff --git a/R/GMLAbstractObject.R b/R/GMLAbstractObject.R new file mode 100644 index 00000000..8222446c --- /dev/null +++ b/R/GMLAbstractObject.R @@ -0,0 +1,42 @@ +#' GMLAbstractObject +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML +#' @return Object of \code{\link{R6Class}} for modelling an GML abstract object +#' @format \code{\link{R6Class}} object. +#' +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, element, attrs, defaults)}}{ +#' This method is used to instantiate an ISOTemporalPrimitive +#' } +#' } +#' +#' @note Class used internally by geometa +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLAbstractObject <- R6Class("GMLAbstractObject", + inherit = ISOAbstractObject, + private = list( + xmlElement = "AbstractObject", + xmlNamespacePrefix = "GML" + ), + public = list( + initialize = function(xml = NULL, element = NULL, attrs = list(), defaults = list()){ + if(is.null(element)) element <- private$xmlElement + super$initialize(xml, element, namespace = private$xmlNamespacePrefix, + attrs = attrs, defaults = defaults, + wrap = FALSE) + } + ) +) \ No newline at end of file diff --git a/R/GMLTemporalPrimitive.R b/R/GMLAbstractTimeGeometricPrimitive.R similarity index 62% rename from R/GMLTemporalPrimitive.R rename to R/GMLAbstractTimeGeometricPrimitive.R index a05767b1..38719df5 100644 --- a/R/GMLTemporalPrimitive.R +++ b/R/GMLAbstractTimeGeometricPrimitive.R @@ -1,4 +1,4 @@ -#' GMLTemporalPrimitive +#' GMLAbstractTimeGeometricPrimitive #' #' @docType class #' @importFrom R6 R6Class @@ -11,7 +11,7 @@ #' @section Methods: #' \describe{ #' \item{\code{new(xml, element, namespace, defaults)}}{ -#' This method is used to instantiate an ISOTemporalPrimitive +#' This method is used to instantiate an ISOAbstractTimeGeometricPrimitive #' } #' } #' @@ -22,15 +22,15 @@ #' #' @author Emmanuel Blondel #' -GMLTemporalPrimitive <- R6Class("GMLTemporalPrimitive", - inherit = ISOMetadataElement, +GMLAbstractTimeGeometricPrimitive <- R6Class("GMLAbstractTimeGeometricPrimitive", + inherit = GMLAbstractTimePrimitive, private = list( - xmlElement = "TM_Primitive", + xmlElement = "AbstractTimeGeometricPrimitive", xmlNamespacePrefix = "GML" ), public = list( - initialize = function(xml = NULL, element, namespace, defaults = list()){ - super$initialize(xml, element, namespace, defaults) + initialize = function(xml = NULL, defaults = list()){ + super$initialize(xml, defaults) } ) ) \ No newline at end of file diff --git a/R/GMLAbstractTimeObject.R b/R/GMLAbstractTimeObject.R new file mode 100644 index 00000000..1b3dd494 --- /dev/null +++ b/R/GMLAbstractTimeObject.R @@ -0,0 +1,47 @@ +#' GMLAbstractTimeObject +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML time object abstract +#' @return Object of \code{\link{R6Class}} for modelling an GML AbstractTimeObject +#' @format \code{\link{R6Class}} object. +#' +#' @field remarks +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, defaults)}}{ +#' This method is used to instantiate a GML AbstractTimeObject +#' } +#' \item{\code{setId(id)}}{ +#' Sets the id +#' } +#' \item{\code{addRemark(remark)}}{ +#' Adds a remark +#' } +#' \item{\code{delRemark(remark)}}{ +#' Deletes a remark +#' } +#' } +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLAbstractTimeObject <- R6Class("GMLAbstractTimeObject", + inherit = GMLAbstractGML, + private = list( + xmlElement = "AbstractTimeObject", + xmlNamespacePrefix = "GML" + ), + public = list( + initialize = function(xml = NULL, defaults = list()){ + super$initialize(xml, element = private$xmlElement, defaults) + } + ) +) \ No newline at end of file diff --git a/R/GMLAbstractTimePrimitive.R b/R/GMLAbstractTimePrimitive.R new file mode 100644 index 00000000..216e3bec --- /dev/null +++ b/R/GMLAbstractTimePrimitive.R @@ -0,0 +1,68 @@ +#' GMLAbstractTimePrimitive +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML time primitive abstract +#' @return Object of \code{\link{R6Class}} for modelling an GML AbstractTimePrimitive +#' @format \code{\link{R6Class}} object. +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, defaults)}}{ +#' This method is used to instantiate a GML AbstractTimePrimitive +#' } +#' \item{\code{setId(id)}}{ +#' Sets the id +#' } +#' \item{\code{addRelatedTime(time)}}{ +#' Adds related time, object of class among \code{GMLTimeInstant}, \code{GMLTimePeriod}, +#' \code{GMLTimeNode} or \code{GMLTimeEdge} +#' } +#' \item{\code{delRelatedTime(time)}}{ +#' Deletes related time +#' } +#' } +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLAbstractTimePrimitive <- R6Class("GMLAbstractTimePrimitive", + inherit = GMLAbstractTimeObject, + private = list( + xmlElement = "AbstractTimePrimitive", + xmlNamespacePrefix = "GML" + ), + public = list( + initialize = function(xml = NULL, defaults = list()){ + super$initialize(xml, defaults) + }, + + #addRelatedTime + addRelatedTime = function(time){ + allowedClasses <- c("GMLTimeInstant", "GMLTimePeriod", + "GMLTimeNode", "GMLTimeEdge") + if(!(class(time)[1] %in% allowedClasses)){ + stop(sprintf("The argument value should an object of class among the following classes %s", + paste(allowedClasses, collapse=", "))) + } + return(self$addListElement("relatedTime", time)) + }, + + #delRelatedTime + delRelatedTime = function(time){ + allowedClasses <- c("GMLTimeInstant", "GMLTimePeriod", + "GMLTimeNode", "GMLTimeEdge") + if(!(class(time)[1] %in% allowedClasses)){ + stop(sprintf("The argument value should an object of class among the following classes %s", + paste(allowedClasses, collapse=", "))) + } + return(self$delListElement("relatedTime", time)) + } + ) +) \ No newline at end of file diff --git a/R/GMLBaseUnit.R b/R/GMLBaseUnit.R new file mode 100644 index 00000000..64b08de8 --- /dev/null +++ b/R/GMLBaseUnit.R @@ -0,0 +1,64 @@ +#' GMLBaseUnit +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML base unit definition +#' @return Object of \code{\link{R6Class}} for modelling an GML base unit +#' @format \code{\link{R6Class}} object. +#' +#' @field unitsSystem +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, defaults, id)}}{ +#' This method is used to instantiate a GML Base Unit +#' } +#' \item{\code{setUnitsSystem(unitsSystem)}}{ +#' Set the unit system +#' } +#' } +#' +#' @examples +#' gml <- GMLBaseUnit$new() +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' gml$setUnitsSystem("somelink") +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLBaseUnit <- R6Class("GMLBaseUnit", + inherit = GMLUnitDefinition, + private = list( + xmlElement = "BaseUnit", + xmlNamespacePrefix = "GML" + ), + public = list( + #+ unitsSystem [1..1]: character + unitsSystem = NULL, + initialize = function(xml = NULL, defaults = list(), id = NA){ + super$initialize(xml, defaults) + if(is.null(xml)){ + self$setId(id, addNS = TRUE) + } + }, + + #setUnitsSystem + setUnitsSystem = function(unitsSystem){ + gmlElem <- GMLElement$new(element = "unitsSystem") + gmlElem$setHref(unitsSystem) + self$unitsSystem <- gmlElem + } + + ) +) \ No newline at end of file diff --git a/R/GMLConventionalUnit.R b/R/GMLConventionalUnit.R new file mode 100644 index 00000000..65b320bc --- /dev/null +++ b/R/GMLConventionalUnit.R @@ -0,0 +1,103 @@ +#' GMLConventionalUnit +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML conventional unit definition +#' @return Object of \code{\link{R6Class}} for modelling an GML derived unit +#' @format \code{\link{R6Class}} object. +#' +#' @field conversionToPreferredUnit +#' @field roughConversionToPreferredUnit +#' @field derivationUnitTerm +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, defaults, id)}}{ +#' This method is used to instantiate a GML Base Unit +#' } +#' \item{\code{addDerivationUnitTerm(uom, exponent)}}{ +#' Adds a derivation unit term, made of a uom reference, and an exponent which +#' can be negative/positive but not equal to zero. +#' } +#' \item{\code{delDerivationUnitTerm(uom, exponent)}}{ +#' Deletes a derivation unit term +#' } +#' \item{\code{setConversionToPreferredUnit(uom, factor, rough)}}{ +#' Sets the conversion to preferred unit. \code{rough} is \code{FALSE} by default +#' } +#' } +#' +#' @examples +#' gml <- GMLConventionalUnit$new() +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' gml$addDerivationUnitTerm("uomId", 2L) +#' gml$setConversionToPreferredUnit("uomId", 2L) +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLConventionalUnit <- R6Class("GMLConventionalUnit", + inherit = GMLUnitDefinition, + private = list( + xmlElement = "ConventionalUnit", + xmlNamespacePrefix = "GML" + ), + public = list( + #+ conversionToPreferredUnit [1..1]: character/integer + conversionToPreferredUnit = NULL, + #+ conversionToPreferredUnit [1..1]: character/integer + roughConversionToPreferredUnit = NULL, + #+ derivationUnitTerm [1..*]: character + derivationUnitTerm = NULL, + initialize = function(xml = NULL, defaults = list(), id = NA){ + super$initialize(xml, defaults) + if(is.null(xml)){ + self$setId(id, addNS = TRUE) + } + }, + + #addDerivationUnitTerm + addDerivationUnitTerm = function(uom, exponent){ + if(exponent == 0L){ + stop("Exponent argument value cannot be equal to zero") + } + gmlElem <- GMLElement$new(element = "derivationUnitTerm") + gmlElem$setAttr("uom", uom) + gmlElem$setAttr("exponent", exponent) + return(self$addListElement("derivationUnitTerm", gmlElem)) + }, + + #delDerivationUnitTerm + delDerivationUnitTerm = function(uom, exponent){ + if(exponent == 0L){ + stop("Exponent argument value cannot be equal to zero") + } + gmlElem <- GMLElement$new(element = "derivationUnitTerm") + gmlElem$setAttr("uom", uom) + gmlElem$setAttr("exponent", exponent) + return(self$delListElement("derivationUnitTerm", gmlElem)) + }, + + #setConversionToPreferredUnit + setConversionToPreferredUnit = function(uom, factor, rough = FALSE){ + elem <- ifelse(rough, "roughConversionToPreferredUnit", "conversionToPreferredUnit") + gmlElem <- GMLElement$new(element = elem) + gmlElem$setAttr("uom", uom) + gmlFactorElem <- GMLElement$new(element = "factor") + gmlFactorElem$setValue(factor) + gmlElem[["factor"]] <- gmlFactorElem + self[[elem]] <- gmlElem + } + ) +) \ No newline at end of file diff --git a/R/GMLDefinition.R b/R/GMLDefinition.R new file mode 100644 index 00000000..25cbbfd8 --- /dev/null +++ b/R/GMLDefinition.R @@ -0,0 +1,69 @@ +#' GMLDefinition +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML definition +#' @return Object of \code{\link{R6Class}} for modelling an GML definition +#' @format \code{\link{R6Class}} object. +#' +#' @field remarks +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, defaults)}}{ +#' This method is used to instantiate a GML Definition +#' } +#' \item{\code{setId(id)}}{ +#' Sets the id +#' } +#' \item{\code{addRemark(remark)}}{ +#' Adds a remark +#' } +#' \item{\code{delRemark(remark)}}{ +#' Deletes a remark +#' } +#' } +#' +#' @examples +#' gml <- GMLDefinition$new() +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLDefinition <- R6Class("GMLDefinition", + inherit = GMLAbstractGML, + private = list( + xmlElement = "Definition", + xmlNamespacePrefix = "GML" + ), + public = list( + #+ remarks [0..*]: character + remarks = list(), + initialize = function(xml = NULL, defaults = list(), id = NA){ + super$initialize(xml, element = private$xmlElement, defaults) + if(is.null(xml)){ + self$setId(id, addNS = TRUE) + } + }, + + #addRemark + addRemark = function(remark){ + return(self$addListElement("remarks", remark)) + }, + + #delRemark + delRemark = function(remark){ + return(self$delListElement("remark", remark)) + } + ) +) \ No newline at end of file diff --git a/R/GMLDerivedUnit.R b/R/GMLDerivedUnit.R new file mode 100644 index 00000000..126facf9 --- /dev/null +++ b/R/GMLDerivedUnit.R @@ -0,0 +1,81 @@ +#' GMLDerivedUnit +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML derived unit definition +#' @return Object of \code{\link{R6Class}} for modelling an GML derived unit +#' @format \code{\link{R6Class}} object. +#' +#' @field derivationUnitTerm +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, defaults, id)}}{ +#' This method is used to instantiate a GML Base Unit +#' } +#' \item{\code{addDerivationUnitTerm(uom, exponent)}}{ +#' Adds a derivation unit term, made of a uom reference, and an exponent which +#' can be negative/positive but not equal to zero. +#' } +#' \item{\code{delDerivationUnitTerm(uom, exponent)}}{ +#' Deletes a derivation unit term +#' } +#' } +#' +#' @examples +#' gml <- GMLDerivedUnit$new() +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' gml$addDerivationUnitTerm("uomId", 2L) +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLDerivedUnit <- R6Class("GMLDerivedUnit", + inherit = GMLUnitDefinition, + private = list( + xmlElement = "DerivedUnit", + xmlNamespacePrefix = "GML" + ), + public = list( + #+ derivationUnitTerm [1..*]: character + derivationUnitTerm = NULL, + initialize = function(xml = NULL, defaults = list(), id = NA){ + super$initialize(xml, defaults) + if(is.null(xml)){ + self$setId(id, addNS = TRUE) + } + }, + + #addDerivationUnitTerm + addDerivationUnitTerm = function(uom, exponent){ + if(exponent == 0L){ + stop("Exponent argument value cannot be equal to zero") + } + gmlElem <- GMLElement$new(element = "derivationUnitTerm") + gmlElem$setAttr("uom", uom) + gmlElem$setAttr("exponent", exponent) + return(self$addListElement("derivationUnitTerm", gmlElem)) + }, + + #delDerivationUnitTerm + delDerivationUnitTerm = function(uom, exponent){ + if(exponent == 0L){ + stop("Exponent argument value cannot be equal to zero") + } + gmlElem <- GMLElement$new(element = "derivationUnitTerm") + gmlElem$setAttr("uom", uom) + gmlElem$setAttr("exponent", exponent) + return(self$delListElement("derivationUnitTerm", gmlElem)) + } + ) +) \ No newline at end of file diff --git a/R/GMLElement.R b/R/GMLElement.R new file mode 100644 index 00000000..94d4eb4d --- /dev/null +++ b/R/GMLElement.R @@ -0,0 +1,69 @@ +#' GMLElement +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML element +#' @return Object of \code{\link{R6Class}} for modelling an GML element +#' @format \code{\link{R6Class}} object. +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, element, attrs, defaults)}}{ +#' This method is used to instantiate a GML element +#' } +#' } +#' +#' @note Class used by geometa internal XML decoder/encoder +#' +#' @references +#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language +#' +#' @author Emmanuel Blondel +#' +GMLElement <- R6Class("GMLElement", + inherit = GMLAbstractGML, + lock_objects = FALSE, + private = list( + xmlElement = "Element", + xmlNamespacePrefix = "GML" + ), + public = list( + initialize = function(xml = NULL, element = NULL, attrs = list(), defaults = list()){ + super$initialize(xml = xml, element = element, attrs = attrs, defaults = defaults) + }, + + decode = function(xml){ + fieldName <- xmlName(xml) + nsPrefix <- "" + fNames <- unlist(strsplit(fieldName, ":")) + if(length(fNames)>1){ + fieldName <- fNames[2] + } + self$element = fieldName + + #set attrs if any + self$attrs <- as.list(xmlAttrs(xml, TRUE, FALSE)) + + + fieldValue <- xmlValue(xml, recursive = FALSE) + if(length(fieldValue)>0){ + #set value if any + fieldValue <- private$toComplexTypes(fieldValue) + if(!is.na(fieldValue)) self$setValue(fieldValue) + }else{ + #set children if any + children <- xmlChildren(xml, encoding = private$encoding) + if(length(children)>0){ + for(i in 1:length(children)){ + childXML <- children[[i]] + childName <- names(children)[i] + childElem <- GMLElement$new(element = childName) + childElem$decode(xml = childXML) + self[[childName]] <- childElem + } + } + } + } + ) +) \ No newline at end of file diff --git a/R/GMLTimePeriod.R b/R/GMLTimePeriod.R index e1ab5e75..2b382257 100644 --- a/R/GMLTimePeriod.R +++ b/R/GMLTimePeriod.R @@ -44,7 +44,7 @@ #' @author Emmanuel Blondel #' GMLTimePeriod <- R6Class("GMLTimePeriod", - inherit = GMLTemporalPrimitive, + inherit = GMLAbstractTimeGeometricPrimitive, private = list( xmlElement = "TimePeriod", xmlNamespacePrefix = "GML" @@ -58,23 +58,10 @@ GMLTimePeriod <- R6Class("GMLTimePeriod", #+ duration [0..1]: character duration = NULL, initialize = function(xml = NULL, beginPosition, endPosition){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$setBeginPosition(beginPosition) self$setEndPosition(endPosition) - }else{ - gmlId <- XML::xmlGetAttr(xml, "gml:id") - if(!is.null(gmlId)){ - self$attrs[["gml:id"]] <- gmlId - }else{ - if(!is.null(self$beginPosition) & !is.null(self$endPosition)){ - self$computeInterval() - } - } } }, @@ -83,7 +70,9 @@ GMLTimePeriod <- R6Class("GMLTimePeriod", if(!all(class(beginPosition)==c("POSIXct","POSIXt")) | is(beginPosition, "Date")){ stop("Value should be of class ('POSIXct','POSIXt') or 'Date'") } - self$beginPosition <- beginPosition + gmlElem <- GMLElement$new(element = "beginPosition") + gmlElem$setValue(beginPosition) + self$beginPosition <- gmlElem if(!is.null(self$endPosition)) self$computeInterval() }, @@ -92,15 +81,17 @@ GMLTimePeriod <- R6Class("GMLTimePeriod", if(!all(class(endPosition)==c("POSIXct","POSIXt")) | is(endPosition, "Date")){ stop("Value should be of class ('POSIXct','POSIXt') or 'Date'") } - self$endPosition <- endPosition + gmlElem <- GMLElement$new(element = "endPosition") + gmlElem$setValue(endPosition) + self$endPosition <- gmlElem if(!is.null(self$beginPosition)) self$computeInterval() }, #computeInterval computeInterval = function(){ - start <- self$beginPosition - end <- self$endPosition + start <- self$beginPosition$value + end <- self$endPosition$value years.seq <- seq(start, end, by = "years") years <- length(years.seq)-1 months.start <- years.seq[length(years.seq)] @@ -120,12 +111,7 @@ GMLTimePeriod <- R6Class("GMLTimePeriod", secs <- length(secs.seq)-1 isoduration <- GMLTimePeriod$computeISODuration(years, months, days, hours, mins, secs) - self$setId(isoduration) - }, - - #setId - setId = function(id){ - self$attrs[["gml:id"]] <- as.character(id) + self$setId(isoduration, addNS = TRUE) }, #setDuration diff --git a/R/GMLUnitDefinition.R b/R/GMLUnitDefinition.R new file mode 100644 index 00000000..5ccb066e --- /dev/null +++ b/R/GMLUnitDefinition.R @@ -0,0 +1,76 @@ +#' GMLUnitDefinition +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO GML unit definition +#' @return Object of \code{\link{R6Class}} for modelling an GML unit definition +#' @format \code{\link{R6Class}} object. +#' +#' @field quantityTypeReference +#' @field catalogSymbol +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml, defaults, id)}}{ +#' This method is used to instantiate a GML Definition +#' } +#' \item{\code{setQuantityTypeReference(ref)}}{ +#' Set the quantity type reference. The content is a reference to a remote value +#' } +#' \item{\code{setCatalogSymbol(symbol)}}{ +#' Sets the preferred lexical symbol used for this unit of measure +#' +#' } +#' } +#' +#' @examples +#' gml <- GMLUnitDefinition$new() +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' +#' @references +#' ISO 19136:2007 Geographic Information -- Geographic Markup Language. +#' http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 +#' +#' OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +#' +#' @author Emmanuel Blondel +#' +GMLUnitDefinition <- R6Class("GMLUnitDefinition", + inherit = GMLDefinition, + private = list( + xmlElement = "UnitDefinition", + xmlNamespacePrefix = "GML" + ), + public = list( + #+ quantityTypeReference [0..1]: character + quantityTypeReference = NULL, + #+ catalogSymbol [0..1]: character + catalogSymbol = NULL, + initialize = function(xml = NULL, defaults = list(), id = NA){ + super$initialize(xml, defaults) + if(is.null(xml)){ + self$setId(id, addNS = TRUE) + } + }, + + #setQuantityTypeReference + setQuantityTypeReference = function(quantityTypeReference){ + gmlElem <- GMLElement$new(element = "quantityTypeReference") + gmlElem$setHref(quantityTypeReference) + self$quantityTypeReference <- gmlElem + }, + + #setCatalogSymbol + setCatalogSymbol = function(catalogSymbol){ + gmlElem <- GMLElement$new(element = "catalogSymbol") + gmlElem$setValue(catalogSymbol) + self$catalogSymbol <- gmlElem + } + ) +) \ No newline at end of file diff --git a/R/ISOMetadataElement.R b/R/ISOAbstractObject.R similarity index 74% rename from R/ISOMetadataElement.R rename to R/ISOAbstractObject.R index 2cc4e7d3..19f5d348 100644 --- a/R/ISOMetadataElement.R +++ b/R/ISOAbstractObject.R @@ -1,4 +1,4 @@ -#' ISOMetadataElement +#' ISOAbstractObject #' #' @docType class #' @importFrom utils packageDescription @@ -23,8 +23,8 @@ #' #' @section Abstract Methods: #' \describe{ -#' \item{\code{new(xml, element, namespace)}}{ -#' This method is used to instantiate an ISOMetadataElement +#' \item{\code{new(xml, element, namespace, defaults, attrs)}}{ +#' This method is used to instantiate an ISOAbstractObject #' } #' \item{\code{INFO(text)}}{ #' Logger to report information. Used internally @@ -76,17 +76,41 @@ #' has been deleted, FALSE otherwise. In case an element is abstent, this method #' will return FALSE. #' } +#' \item{\code{setAttr(attrKey, attrValue)}}{ +#' Set an attribute +#' } +#' \item{\code{setId(id, addNS)}}{ +#' Set an id. By default \code{addNS} is \code{FALSE} (no namespace prefix added). +#' } +#' \item{\code{setHref(href)}}{ +#' Sets an href reference +#' } +#' \item{\code{setCodeList(codeList)}}{ +#' Sets a codeList +#' } +#' \item{\code{setCodeListValue(codeListValue)}}{ +#' Sets a codeList value +#' } +#' \item{\code{setCodeSpace(codeSpace)}}{ +#' Set a codeSpace +#' } +#' \item{\code{setValue(value)}}{ +#' Set a value +#' } #' } #' #' @note Abstract ISO Metadata class used internally by geometa #' #' @author Emmanuel Blondel #' -ISOMetadataElement <- R6Class("ISOMetadataElement", +ISOAbstractObject <- R6Class("ISOAbstractObject", private = list( + xmlElement = "AbstractObject", + xmlNamespacePrefix = "GCO", encoding = options("encoding"), document = FALSE, - system_fields = c("wrap", "element", "namespace", "defaults", "attrs", + system_fields = c("wrap", + "element", "namespace", "defaults", "attrs", "codelistId", "measureType"), logger = function(type, text){ cat(sprintf("[geometa][%s] %s \n", type, text)) @@ -113,6 +137,23 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", txt <- paste(txt, bugReport, sep="\n") txt <- paste(txt, "-->", sep="\n") return(txt) + }, + toComplexTypes = function(value){ + newvalue <- value + if(regexpr(pattern = "(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2})", value)>0){ + newvalue <- as.POSIXct(strptime(value, "%Y-%m-%dT%H:%M:%S"), tz = "GMT") + }else if(regexpr(pattern = "(\\d{4})-(\\d{2})-(\\d{2})", value)>0){ + newvalue <- as.Date(value) + } + return(newvalue) + }, + fromComplexTypes = function(value){ + if(suppressWarnings(all(class(value)==c("POSIXct","POSIXt")))){ + value <- format(value,"%Y-%m-%dT%H:%M:%S") + }else if(class(value)[1] == "Date"){ + value <- format(value,"%Y-%m-%d") + } + return(value) } ), public = list( @@ -129,10 +170,18 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", element = NA, namespace = NA, defaults = list(), - initialize = function(xml = NULL, element, namespace, defaults = list()){ - self$element = element - self$namespace = namespace + attrs = list(), + value = NULL, + initialize = function(xml = NULL, element = NULL, namespace = NULL, + attrs = list(), defaults = list(), + wrap = TRUE){ + if(!is.null(element)){ private$xmlElement <- element } + if(!is.null(namespace)){ private$xmlNamespacePrefix <- toupper(namespace)} + self$element = private$xmlElement + self$namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) + self$attrs = attrs self$defaults = defaults + self$wrap = wrap if(!is.null(xml)){ self$decode(xml) } @@ -153,7 +202,7 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", })] cat(sprintf("<%s>", self$getClassName())) - if(is(self, "ISOMetadataCodelistElement")){ + if(is(self, "ISOCodeListValue")){ clVal <- self$attrs$codeListValue clDes <- self$codelistId$entries[self$codelistId$entries$value == clVal,"description"] cat(paste0(": ", clVal, " {",clDes,"}")) @@ -172,15 +221,15 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", #user values management shift <- "...." if(!is.null(fieldObj)){ - if(is(fieldObj, "ISOMetadataElement")){ + if(is(fieldObj, "ISOAbstractObject")){ cat(paste0("\n", paste(rep(shift, depth), collapse=""),"|-- ", field, " ")) fieldObj$print(depth = depth+1) }else if(is(fieldObj, "list")){ for(item in fieldObj){ - if(is(item, "ISOMetadataElement")){ + if(is(item, "ISOAbstractObject")){ cat(paste0("\n", paste(rep(shift, depth), collapse=""),"|-- ", field, " ")) item$print(depth = depth+1) - if(is(item, "ISOMetadataCodelistElement")){ + if(is(item, "ISOCodeListValue")){ clVal <- item$attrs$codeListValue clDes <- item$codelistId$entries[item$codelistId$entries$value == clVal,"description"] cat(paste0(": ", clVal, " {",clDes,"}")) @@ -207,6 +256,8 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", } for(child in xmlChildren(xml, encoding = private$encoding)){ fieldName <- xmlName(child) + childElement <- child + nsPrefix <- "" fNames <- unlist(strsplit(fieldName, ":")) if(length(fNames)>1){ fieldName <- fNames[2] @@ -216,28 +267,28 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", fieldClass <- NULL if(!is(child, "XMLInternalTextNode")){ - fieldClass <- ISOMetadataElement$getISOClassByNode(child) + fieldClass <- ISOAbstractObject$getISOClassByNode(child) + nsPrefix <- names(xmlNamespace(child)) if(is.null(fieldClass)){ - child <- xmlChildren(child, encoding = private$encoding)[[1]] - fieldClass <- ISOMetadataElement$getISOClassByNode(child) + children <- xmlChildren(child, encoding = private$encoding) + if(length(children)>0){ + childroot <- children[[1]] + if(!is(childroot, "XMLInternalTextNode")){ + child <- childroot + fieldClass <- ISOAbstractObject$getISOClassByNode(childroot) + } + } } } - fieldValue <- NULL + #coercing + fieldValue <- xmlValue(child, recursive = FALSE) + if(length(fieldValue)>0){ + fieldValue <- private$toComplexTypes(fieldValue) + } + if(!is.null(fieldClass)){ if(regexpr("^ISOBase.+", fieldClass$classname)>0){ - fieldValue <- xmlValue(child) - - #coerceTimePosition util - coerceTimePosition <- function(fieldValue){ - outval <- NULL - if(nchar(fieldValue)==10){ - outval <- as.Date(fieldValue) - }else{ - outval <- as.POSIXct(strptime(fieldValue, "%Y-%m-%dT%H:%M:%S"), tz = "GMT") - } - return(outval) - } fieldValue <- switch(fieldClass$classname, "ISOBaseBoolean" = as.logical(fieldValue), @@ -248,14 +299,11 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", class(fieldValue) <- "decimal" fieldValue }, - "ISOBaseDate" = as.Date(fieldValue), - "ISOBaseDateTime" = as.POSIXct(strptime(fieldValue, "%Y-%m-%dT%H:%M:%S"), tz = "GMT"), - "ISOBaseTimeBeginPosition" = coerceTimePosition(fieldValue), - "ISOBaseTimeEndPosition" = coerceTimePosition(fieldValue), fieldValue ) }else{ fieldValue <- fieldClass$new(xml = child) + fieldValue$attrs <- as.list(xmlAttrs(child, TRUE, FALSE)) } if(is(self[[fieldName]], "list")){ self[[fieldName]] <- c(self[[fieldName]], fieldValue) @@ -263,10 +311,23 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", self[[fieldName]] <- fieldValue } }else{ - self[["value"]] <- as(child, "character") + if(nsPrefix == "gml"){ + gmlElem <- GMLElement$new(element = fieldName) + gmlElem$decode(xml = childElement) + if(is(self[[fieldName]], "list")){ + self[[fieldName]] <- c(self[[fieldName]], gmlElem) + }else{ + self[[fieldName]] <- gmlElem + } + }else{ + self[["value"]] <- as(child, "character") + } } } + + #inherit attributes if any + self$attrs <- as.list(xmlAttrs(xml, TRUE, FALSE)) }, #encode @@ -323,8 +384,8 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", #user values management if(!is.null(fieldObj)){ - if(is(fieldObj, "ISOMetadataElement")){ - if(fieldObj$wrap){ + if(is(fieldObj, "ISOAbstractObject")){ + if(self$wrap){ wrapperNode <- xmlOutputDOM( tag = field, nameSpace = self$namespace$id @@ -337,7 +398,7 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", }else if(is(fieldObj, "list")){ for(item in fieldObj){ nodeValue <- NULL - if(is(item, "ISOMetadataElement")){ + if(is(item, "ISOAbstractObject")){ nodeValue <- item }else{ nodeValue <- self$wrapBaseElement(field, item) @@ -355,6 +416,7 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", } }else{ if(field == "value"){ + fieldObj <- private$fromComplexTypes(fieldObj) rootXML$addNode(xmlTextNode(fieldObj)) }else{ dataObj <- self$wrapBaseElement(field, fieldObj) @@ -446,6 +508,7 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", #getNamespaceDefinition getNamespaceDefinition = function(recursive = FALSE){ nsdefs <- NULL + if(recursive){ #list of fields fields <- rev(names(self)) @@ -456,52 +519,65 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", selfNsdef <- self$getNamespaceDefinition() nsdefs <- list() - invisible(lapply(fields, function(x){ - xObj <- self[[x]] - if(is.null(xObj) || (is.list(xObj) & length(xObj) == 0)){ - if(x %in% names(self$defaults)){ - xObj <- self$defaults[[x]] + if(length(fields)>0){ + invisible(lapply(fields, function(x){ + xObj <- self[[x]] + if(is.null(xObj) || (is.list(xObj) & length(xObj) == 0)){ + if(x %in% names(self$defaults)){ + xObj <- self$defaults[[x]] + } } - } - if(!is.null(xObj)){ - nsdef <- NULL - if(is(xObj, "ISOMetadataElement")){ - nsdef <- xObj$getNamespaceDefinition(recursive = recursive) - }else if(is(xObj, "list")){ - nsdef <- list() - invisible(lapply(xObj, function(xObj.item){ - nsdef.item <- NULL - if(is(xObj.item, "ISOMetadataElement")){ - nsdef.item <- xObj.item$getNamespaceDefinition(recursive = recursive) - }else{ - nsdef.item <- ISOMetadataNamespace$GCO$getDefinition() - } - for(item in names(nsdef.item)){ - nsd <- nsdef.item[[item]] - if(!(nsd %in% nsdef)){ - nsdef.new <- c(nsdef, nsd) - names(nsdef.new) <- c(names(nsdef), item) - nsdef <<- nsdef.new + if(!is.null(xObj)){ + nsdef <- NULL + if(is(xObj, "ISOAbstractObject")){ + nsdef <- xObj$getNamespaceDefinition(recursive = recursive) + }else if(is(xObj, "list")){ + nsdef <- list() + invisible(lapply(xObj, function(xObj.item){ + nsdef.item <- NULL + if(is(xObj.item, "ISOAbstractObject")){ + nsdef.item <- xObj.item$getNamespaceDefinition(recursive = recursive) + }else{ + nsdef.item <- ISOMetadataNamespace$GCO$getDefinition() } + for(item in names(nsdef.item)){ + nsd <- nsdef.item[[item]] + if(!(nsd %in% nsdef)){ + nsdef.new <- c(nsdef, nsd) + names(nsdef.new) <- c(names(nsdef), item) + nsdef <<- nsdef.new + } + } + })) + }else{ + nsdef <- ISOMetadataNamespace$GCO$getDefinition() + } + for(item in names(nsdef)){ + nsdef.item <- nsdef[[item]] + if(!(nsdef.item %in% nsdefs)){ + nsdefs.new <- c(nsdefs, nsdef.item) + names(nsdefs.new) <- c(names(nsdefs), item) + nsdefs <<- nsdefs.new } - })) - }else{ - nsdef <- ISOMetadataNamespace$GCO$getDefinition() - } - for(item in names(nsdef)){ - nsdef.item <- nsdef[[item]] - if(!(nsdef.item %in% nsdefs)){ - nsdefs.new <- c(nsdefs, nsdef.item) - names(nsdefs.new) <- c(names(nsdefs), item) - nsdefs <<- nsdefs.new } } - } - })) + })) + } if(!(selfNsdef[[1]] %in% nsdefs)) nsdefs <- c(selfNsdef, nsdefs) nsdefs <- nsdefs[!sapply(nsdefs, is.null)] }else{ nsdefs <- self$namespace$getDefinition() + invisible(lapply(names(self$attrs), function(attr){ + str <- unlist(strsplit(attr,":", fixed=T)) + if(length(str)>1){ + nsprefix <- str[1] + namespace <- ISOMetadataNamespace[[toupper(nsprefix)]] + if(!is.null(namespace)){ + ns <- namespace$getDefinition() + if(!(ns %in% nsdefs)) nsdefs <<- c(nsdefs, ns) + } + } + })) } return(nsdefs) }, @@ -517,8 +593,6 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", #specific coercing if(all(dataType == c("POSIXct","POSIXt"))) dataType <- "datetime" - if(field == "beginPosition") dataType <- "begintime" - if(field == "endPosition") dataType <- "endtime" #wrapping dataObj <- switch(tolower(dataType), @@ -530,8 +604,6 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", "logical" = ISOBaseBoolean$new(value = fieldObj), "datetime" = ISOBaseDateTime$new(value = fieldObj), "date" = ISOBaseDate$new(value = fieldObj), - "begintime" = ISOBaseTimeBeginPosition$new(value = fieldObj), - "endtime" = ISOBaseTimeEndPosition$new(value = fieldObj), NULL ) return(dataObj) @@ -544,7 +616,7 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", out = FALSE }else{ out = any(sapply(self[[field]], function(x){ - ISOMetadataElement$compare(x, metadataElement) + ISOAbstractObject$compare(x, metadataElement) })) } return(out) @@ -564,12 +636,49 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", delListElement = function(field, metadataElement){ startNb <- length(self[[field]]) if(self$contains(field, metadataElement)){ - self[[field]] = self[[field]][!sapply(self[[field]], ISOMetadataElement$compare, metadataElement)] + self[[field]] = self[[field]][!sapply(self[[field]], ISOAbstractObject$compare, metadataElement)] } endNb = length(self[[field]]) return(endNb == startNb-1) }, + #setAttr + setAttr = function(attrKey, attrValue){ + self$attrs[[attrKey]] <- attrValue + }, + + #setId + setId = function(id, addNS = FALSE){ + attrKey <- "id" + if(addNS) attrKey <- paste(tolower(private$xmlNamespacePrefix), attrKey, sep=":") + self$attrs[[attrKey]] <- id + }, + + #setHref + setHref = function(href){ + self$attrs[["xlink:href"]] <- href + }, + + #setCodeList + setCodeList = function(codeList){ + self$attrs[["codeList"]] <- codeList + }, + + #setCodeListValue + setCodeListValue = function(codeListValue){ + self$attrs[["codeListValue"]] <- codeListValue + }, + + #setCodeSpace + setCodeSpace = function(codeSpace){ + self$attrs[["codeSpace"]] <- codeSpace + }, + + #setValue + setValue = function(value){ + self$value <- value + }, + #isDocument isDocument = function(){ return(private$document) @@ -577,7 +686,7 @@ ISOMetadataElement <- R6Class("ISOMetadataElement", ) ) -ISOMetadataElement$getISOClassByNode = function(node){ +ISOAbstractObject$getISOClassByNode = function(node){ outClass <- NULL if(!is(node, "XMLInternalDocument")) node <- xmlDoc(node) nodeElement <- xmlRoot(node) @@ -603,9 +712,9 @@ ISOMetadataElement$getISOClassByNode = function(node){ return(outClass) } -ISOMetadataElement$compare = function(metadataElement1, metadataElement2){ +ISOAbstractObject$compare = function(metadataElement1, metadataElement2){ text1 <- NULL - if(is(metadataElement1, "ISOMetadataElement")){ + if(is(metadataElement1, "ISOAbstractObject")){ xml1 <-metadataElement1$encode(addNS = TRUE, validate = FALSE) if(metadataElement1$isDocument()){ content1 <- as(xml1, "character") @@ -619,7 +728,7 @@ ISOMetadataElement$compare = function(metadataElement1, metadataElement2){ text1 <- as.character(metadataElement1) } text2 <- NULL - if(is(metadataElement2, "ISOMetadataElement")){ + if(is(metadataElement2, "ISOAbstractObject")){ xml2 <- metadataElement2$encode(addNS = TRUE, validate = FALSE) if(metadataElement2$isDocument()){ content2 <- as(xml2, "character") diff --git a/R/ISOAddress.R b/R/ISOAddress.R index 66a37f3e..ef467859 100644 --- a/R/ISOAddress.R +++ b/R/ISOAddress.R @@ -50,7 +50,7 @@ #' @author Emmanuel Blondel #' ISOAddress <- R6Class("ISOAddress", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "CI_Address", xmlNamespacePrefix = "GMD" @@ -62,11 +62,7 @@ ISOAddress <- R6Class("ISOAddress", country = NULL, electronicMailAddress = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setDeliveryPoint diff --git a/R/ISOAngle.R b/R/ISOAngle.R index 17640e76..a14bf06e 100644 --- a/R/ISOAngle.R +++ b/R/ISOAngle.R @@ -33,8 +33,6 @@ ISOAngle <- R6Class("ISOAngle", initialize = function(xml = NULL, value, uom, useUomURI = FALSE){ super$initialize( xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix), value = value, uom = uom, useUomURI = useUomURI diff --git a/R/ISOAssociationRole.R b/R/ISOAssociationRole.R index 13880fe9..06fde861 100644 --- a/R/ISOAssociationRole.R +++ b/R/ISOAssociationRole.R @@ -61,12 +61,7 @@ ISOAssociationRole <- R6Class("ISOAssociationRole", initialize = function(xml = NULL){ defaults = list(cardinality = ISOMultiplicityRange(lower = 0, upper = Inf)) - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix), - defaults = defaults - ) + super$initialize(xml = xml, defaults = defaults) }, #setType diff --git a/R/ISOBand.R b/R/ISOBand.R index 2c605794..3b715ef5 100644 --- a/R/ISOBand.R +++ b/R/ISOBand.R @@ -28,7 +28,7 @@ #' Sets the minimum value #' } #' \item{\code{setUnits(units)}}{ -#' Sets the unit, object of class \code{ISOUomLength} +#' Sets the unit, object of class \code{GMLUnitDefinition} #' } #' \item{\code{setPeakResponse(peakResponse)}}{ #' Sets the peak response @@ -54,10 +54,15 @@ #' md$setDescriptor("descriptor") #' md$setMaxValue(10) #' md$setMinValue(1) -#' uom = ISOUomLength$new() -#' uom$setUomName("var") -#' uom$setUomSymbol("symbol") -#' md$setUnits(uom) +#' gml <- GMLBaseUnit$new(id = "ID") +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' gml$setUnitsSystem("somelink") +#' md$setUnits(gml) #' md$setPeakResponse(9) #' md$setBitsPerValue(5) #' md$setToneGradation(100) @@ -93,11 +98,7 @@ ISOBand <- R6Class("ISOBand", offset = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setMaxValue @@ -112,8 +113,8 @@ ISOBand <- R6Class("ISOBand", #setUnits setUnits = function(uom){ - if(!is(uom, "ISOUomLength")){ - stop("The argument value should be an object of class 'ISOUomLength") + if(!is(uom, "GMLUnitDefinition")){ + stop("The argument value should be an object of class 'GMUnitDefinition") } self$units <- uom }, diff --git a/R/ISOBaseBoolean.R b/R/ISOBaseBoolean.R index 6b564287..b7c4cff9 100644 --- a/R/ISOBaseBoolean.R +++ b/R/ISOBaseBoolean.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOBaseBoolean <- R6Class("ISOBaseBoolean", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "Boolean", xmlNamespacePrefix = "GCO" @@ -32,11 +32,7 @@ ISOBaseBoolean <- R6Class("ISOBaseBoolean", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ newValue <- value if(!is(value, "logical")){ diff --git a/R/ISOBaseCharacterString.R b/R/ISOBaseCharacterString.R index e8ee110c..9290d8cf 100644 --- a/R/ISOBaseCharacterString.R +++ b/R/ISOBaseCharacterString.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOBaseCharacterString <- R6Class("ISOBaseCharacterString", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "CharacterString", xmlNamespacePrefix = "GCO" @@ -32,11 +32,7 @@ ISOBaseCharacterString <- R6Class("ISOBaseCharacterString", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$value = value } diff --git a/R/ISOBaseDate.R b/R/ISOBaseDate.R index 68e9c87a..fa3191a3 100644 --- a/R/ISOBaseDate.R +++ b/R/ISOBaseDate.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOBaseDate <- R6Class("ISOBaseDate", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "Date", xmlNamespacePrefix = "GCO" @@ -32,14 +32,10 @@ ISOBaseDate <- R6Class("ISOBaseDate", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ if(all(class(value)==c("POSIXct","POSIXt"))){ - value <- format(value,"%Y-%m-%d") + value <- as.Date(value) } self$value = value } diff --git a/R/ISOBaseDateTime.R b/R/ISOBaseDateTime.R index de17cac0..fe32015b 100644 --- a/R/ISOBaseDateTime.R +++ b/R/ISOBaseDateTime.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOBaseDateTime <- R6Class("ISOBaseDateTime", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "DateTime", xmlNamespacePrefix = "GCO" @@ -32,15 +32,8 @@ ISOBaseDateTime <- R6Class("ISOBaseDateTime", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ - if(all(class(value)==c("POSIXct","POSIXt"))){ - value <- format(value,"%Y-%m-%dT%H:%M:%S") - } self$value = value } } diff --git a/R/ISOBaseDecimal.R b/R/ISOBaseDecimal.R index 77536229..bf8d64ec 100644 --- a/R/ISOBaseDecimal.R +++ b/R/ISOBaseDecimal.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOBaseDecimal <- R6Class("ISOBaseDecimal", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "Decimal", xmlNamespacePrefix = "GCO" @@ -32,11 +32,7 @@ ISOBaseDecimal <- R6Class("ISOBaseDecimal", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ if(!is(value, "double")){ value <- as.double(value) diff --git a/R/ISOBaseInteger.R b/R/ISOBaseInteger.R index 6fea4cc6..5f697357 100644 --- a/R/ISOBaseInteger.R +++ b/R/ISOBaseInteger.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOBaseInteger <- R6Class("ISOBaseInteger", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "Integer", xmlNamespacePrefix = "GCO" @@ -32,11 +32,7 @@ ISOBaseInteger <- R6Class("ISOBaseInteger", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ if(!is(value, "integer")){ value <- as.integer(value) diff --git a/R/ISOBaseReal.R b/R/ISOBaseReal.R index 8095ba92..845260be 100644 --- a/R/ISOBaseReal.R +++ b/R/ISOBaseReal.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOBaseReal <- R6Class("ISOBaseReal", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "Real", xmlNamespacePrefix = "GCO" @@ -32,11 +32,7 @@ ISOBaseReal <- R6Class("ISOBaseReal", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ if(!is(value, "double")){ value <- as.double(value) diff --git a/R/ISOBaseTimeBeginPosition.R b/R/ISOBaseTimeBeginPosition.R deleted file mode 100644 index 75cf53bc..00000000 --- a/R/ISOBaseTimeBeginPosition.R +++ /dev/null @@ -1,49 +0,0 @@ -#' ISOBaseTimeBeginPosition -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO begin position -#' @return Object of \code{\link{R6Class}} for modelling an ISO Time begin position -#' @format \code{\link{R6Class}} object. -#' -#' @field value -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml,value)}}{ -#' This method is used to instantiate an ISOBaseTimeBeginPosition -#' } -#' } -#' -#' @note Class used by geometa internal XML decoder/encoder -#' -#' @author Emmanuel Blondel -#' -ISOBaseTimeBeginPosition <- R6Class("ISOBaseTimeBeginPosition", - inherit = ISOMetadataElement, - private = list( - xmlElement = "beginPosition", - xmlNamespacePrefix = "GML" - ), - public = list( - wrap = FALSE, - value = NA, - attrs = list(), - initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) - if(is.null(xml)){ - if(all(class(value)==c("POSIXct","POSIXt"))){ - value <- format(value,"%Y-%m-%dT%H:%M:%S") - }else if(class(value) == "Date"){ - value <- format(value,"%Y-%m-%d") - } - self$value = value - } - } - ) -) \ No newline at end of file diff --git a/R/ISOBaseTimeEndPosition.R b/R/ISOBaseTimeEndPosition.R deleted file mode 100644 index 70b27ad8..00000000 --- a/R/ISOBaseTimeEndPosition.R +++ /dev/null @@ -1,49 +0,0 @@ -#' ISOBaseTimeEndPosition -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO end position -#' @return Object of \code{\link{R6Class}} for modelling an ISO Time end position -#' @format \code{\link{R6Class}} object. -#' -#' @field value -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml,value)}}{ -#' This method is used to instantiate an ISOBaseTimeEndPosition -#' } -#' } -#' -#' @note Class used by geometa internal XML decoder/encoder -#' -#' @author Emmanuel Blondel -#' -ISOBaseTimeEndPosition <- R6Class("ISOBaseTimeEndPosition", - inherit = ISOMetadataElement, - private = list( - xmlElement = "endPosition", - xmlNamespacePrefix = "GML" - ), - public = list( - wrap = FALSE, - value = NA, - attrs = list(), - initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) - if(is.null(xml)){ - if(all(class(value)==c("POSIXct","POSIXt"))){ - value <- format(value,"%Y-%m-%dT%H:%M:%S") - }else if(class(value) == "Date"){ - value <- format(value,"%Y-%m-%d") - } - self$value = value - } - } - ) -) \ No newline at end of file diff --git a/R/ISOBrowseGraphic.R b/R/ISOBrowseGraphic.R index 3f3dd75f..5ba19a0f 100644 --- a/R/ISOBrowseGraphic.R +++ b/R/ISOBrowseGraphic.R @@ -32,7 +32,7 @@ #' @author Emmanuel Blondel #' ISOBrowseGraphic <- R6Class("ISOBrowseGraphic", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_BrowseGraphic", xmlNamespacePrefix = "GMD" @@ -42,11 +42,7 @@ ISOBrowseGraphic <- R6Class("ISOBrowseGraphic", fileDescription = NULL, fileType = NULL, initialize = function(xml = NULL, fileName, fileDescription, fileType){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$fileName <- fileName self$fileDescription <- fileDescription diff --git a/R/ISOCellGeometry.R b/R/ISOCellGeometry.R index d6feea73..5ee84223 100644 --- a/R/ISOCellGeometry.R +++ b/R/ISOCellGeometry.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOCellGeometry <- R6Class("ISOCellGeometry", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_CellGeometryCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOCellGeometry <- R6Class("ISOCellGeometry", ) ISOCellGeometry$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOCellGeometry, labels)) + return(ISOCodeListValue$values(ISOCellGeometry, labels)) } \ No newline at end of file diff --git a/R/ISOCharacterSet.R b/R/ISOCharacterSet.R index 6cedbff2..51605711 100644 --- a/R/ISOCharacterSet.R +++ b/R/ISOCharacterSet.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOCharacterSet <- R6Class("ISOCharacterSet", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_CharacterSetCode", xmlNamespacePrefix = "GMD" @@ -43,5 +43,5 @@ ISOCharacterSet <- R6Class("ISOCharacterSet", ) ISOCharacterSet$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOCharacterSet, labels)) + return(ISOCodeListValue$values(ISOCharacterSet, labels)) } \ No newline at end of file diff --git a/R/ISOCitation.R b/R/ISOCitation.R index 953e977a..7ea76ac2 100644 --- a/R/ISOCitation.R +++ b/R/ISOCitation.R @@ -90,7 +90,7 @@ #' @author Emmanuel Blondel #' ISOCitation<- R6Class("ISOCitation", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "CI_Citation", xmlNamespacePrefix = "GMD" @@ -105,11 +105,7 @@ ISOCitation<- R6Class("ISOCitation", citedResponsibleParty = NULL, presentationForm = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setTitle diff --git a/R/ISOClassification.R b/R/ISOClassification.R index 4a21d8df..516d90cc 100644 --- a/R/ISOClassification.R +++ b/R/ISOClassification.R @@ -29,18 +29,18 @@ #' @author Emmanuel Blondel #' ISOClassification <- R6Class("ISOClassification", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_ClassificationCode", xmlNamespacePrefix = "GMD" ), public = list( initialize = function(xml = NULL, value){ - super$initialize(xml = xml, id = "MD_ClassificationCode", value = value, setValue = FALSE) + super$initialize(xml = xml, id = private$xmlElement, value = value, setValue = FALSE) } ) ) ISOClassification$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOClassification, labels)) + return(ISOCodeListValue$values(ISOClassification, labels)) } \ No newline at end of file diff --git a/R/ISOMetadataCodelistElement.R b/R/ISOCodeListValue.R similarity index 87% rename from R/ISOMetadataCodelistElement.R rename to R/ISOCodeListValue.R index abccf4a2..a40ff2b2 100644 --- a/R/ISOMetadataCodelistElement.R +++ b/R/ISOCodeListValue.R @@ -1,4 +1,4 @@ -#' ISOMetadataCodelistElement +#' ISOCodeListValue #' #' @docType class #' @importFrom R6 R6Class @@ -12,7 +12,7 @@ #' @section Methods: #' \describe{ #' \item{\code{new(xml, id, value, addCodeListAttrs, addCodeSpaceAttr, setValue)}}{ -#' This method is used to instantiate an ISOMetadataCodelistElement. By default, +#' This method is used to instantiate an ISOCodeListValue. By default, #' \code{addCodeListAttrs = TRUE}, to add codelist atributes to root XML. The #' parameter \code{addCodeSpaceAttr = TRUE} by default, and ignored if the valueof #' \code{addCodeLisAttrs} is set to \code{FALSE}. The argument \code{setValue} @@ -31,8 +31,8 @@ #' #' @author Emmanuel Blondel #' -ISOMetadataCodelistElement <- R6Class("ISOMetadataCodelistElement", - inherit = ISOMetadataElement, +ISOCodeListValue <- R6Class("ISOCodeListValue", + inherit = ISOAbstractObject, public = list( codelistId = NULL, attrs = list(), @@ -41,11 +41,7 @@ ISOMetadataCodelistElement <- R6Class("ISOMetadataCodelistElement", addCodeListAttrs = TRUE, addCodeSpaceAttr = TRUE, setValue = TRUE){ - super$initialize( - xml = xml, - element = id, - namespace = ISOMetadataNamespace$GMD - ) + super$initialize(xml = xml) if(!is.null(xml)){ value <- xmlGetAttr(xml, "codeListValue") #codeListValue should be as attribute if(is.null(value)) value <- xmlValue(xml) #try to pick up value instead @@ -98,7 +94,7 @@ ISOMetadataCodelistElement <- R6Class("ISOMetadataCodelistElement", ) ) -ISOMetadataCodelistElement$values = function(class, labels = FALSE){ +ISOCodeListValue$values = function(class, labels = FALSE){ fields <- "value" if(labels) fields <- c(fields, "description") return(getISOCodelist(class$private_fields$xmlElement)$entries[,fields]) diff --git a/R/ISOConformanceResult.R b/R/ISOConformanceResult.R index 922f9cb6..3a1b223f 100644 --- a/R/ISOConformanceResult.R +++ b/R/ISOConformanceResult.R @@ -45,7 +45,7 @@ #' @author Emmanuel Blondel #' ISOConformanceResult <- R6Class("ISOConformanceResult", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "DQ_ConformanceResult", xmlNamespacePrefix = "GMD" @@ -55,11 +55,7 @@ ISOConformanceResult <- R6Class("ISOConformanceResult", explanation = NULL, pass = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setSpecification diff --git a/R/ISOConstraint.R b/R/ISOConstraint.R index 441f6b5a..89b9abc3 100644 --- a/R/ISOConstraint.R +++ b/R/ISOConstraint.R @@ -30,7 +30,7 @@ #' @author Emmanuel Blondel #' ISOConstraint <- R6Class("ISOConstraint", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "FC_Constraint", xmlNamespacePrefix = "GFC" @@ -41,11 +41,7 @@ ISOConstraint <- R6Class("ISOConstraint", description = NULL, initialize = function(xml = NULL, description = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(!is.null(description)){ self$setDescription(description) } diff --git a/R/ISOConstraints.R b/R/ISOConstraints.R index 1a487642..135e6c16 100644 --- a/R/ISOConstraints.R +++ b/R/ISOConstraints.R @@ -33,7 +33,7 @@ #' @author Emmanuel Blondel #' ISOConstraints<- R6Class("ISOConstraints", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_Constraints", xmlNamespacePrefix = "GMD" @@ -41,10 +41,8 @@ ISOConstraints<- R6Class("ISOConstraints", public = list( #+ useLimitation [0..*]: character useLimitation = list(), - initialize = function(xml = NULL, element = NULL, namespace = NULL, defaults = list()){ - if(is.null(element)) element <- private$xmlElement - if(is.null(namespace)) namespace <- getISOMetadataNamespace(private$xmlNamespacePrefix) - super$initialize(xml, element, namespace, defaults) + initialize = function(xml = NULL, defaults = list()){ + super$initialize(xml, defaults = defaults) }, #addUseLimitation diff --git a/R/ISOContact.R b/R/ISOContact.R index d36e29f7..083316cb 100644 --- a/R/ISOContact.R +++ b/R/ISOContact.R @@ -52,7 +52,7 @@ #' @author Emmanuel Blondel #' ISOContact <- R6Class("ISOContact", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "CI_Contact", xmlNamespacePrefix = "GMD" @@ -62,11 +62,7 @@ ISOContact <- R6Class("ISOContact", address = NULL, onlineResource = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setPhone diff --git a/R/ISOContentInformation.R b/R/ISOContentInformation.R index 2bef759b..9225f2f6 100644 --- a/R/ISOContentInformation.R +++ b/R/ISOContentInformation.R @@ -9,7 +9,7 @@ #' #' @section Abstract Methods: #' \describe{ -#' \item{\code{new(xml, element, namespace)}}{ +#' \item{\code{new(xml)}}{ #' This method is used to instantiate an ISOContentInformation #' } #' } @@ -22,14 +22,14 @@ #' @author Emmanuel Blondel #' ISOContentInformation <- R6Class("ISOContentInformation", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_ContentInformation", xmlNamespacePrefix = "GMD" ), public = list( - initialize = function(xml = NULL, element, namespace){ - super$initialize(xml = xml, element = element, namespace = namespace) + initialize = function(xml = NULL){ + super$initialize(xml = xml) } ) ) \ No newline at end of file diff --git a/R/ISOCoverageContentType.R b/R/ISOCoverageContentType.R index 7d8fa213..f1d7a200 100644 --- a/R/ISOCoverageContentType.R +++ b/R/ISOCoverageContentType.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOCoverageContentType <- R6Class("ISOCoverageContentType", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_CoverageContentTypeCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOCoverageContentType <- R6Class("ISOCoverageContentType", ) ISOCoverageContentType$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOCoverageContentType, labels)) + return(ISOCodeListValue$values(ISOCoverageContentType, labels)) } \ No newline at end of file diff --git a/R/ISOCoverageDescription.R b/R/ISOCoverageDescription.R index ea427b2a..0fe41b62 100644 --- a/R/ISOCoverageDescription.R +++ b/R/ISOCoverageDescription.R @@ -46,10 +46,15 @@ #' band$setDescriptor("descriptor") #' band$setMaxValue(10) #' band$setMinValue(1) -#' uom = ISOUomLength$new() -#' uom$setUomName("var") -#' uom$setUomSymbol("symbol") -#' band$setUnits(uom) +#' gml <- GMLBaseUnit$new(id = sprintf("ID%s",i)) +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' gml$setUnitsSystem("somelink") +#' band$setUnits(gml) #' band$setPeakResponse(9) #' band$setBitsPerValue(5) #' band$setToneGradation(100) @@ -65,7 +70,7 @@ #' @author Emmanuel Blondel #' ISOCoverageDescription <- R6Class("ISOCoverageDescription", - inherit = ISOContentInformation, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_CoverageDescription", xmlNamespacePrefix = "GMD" @@ -79,11 +84,7 @@ ISOCoverageDescription <- R6Class("ISOCoverageDescription", #+ dimension: ISORangeDimension dimension = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setAttributeDescription diff --git a/R/ISODataIdentification.R b/R/ISODataIdentification.R index 16b73a94..43045d40 100644 --- a/R/ISODataIdentification.R +++ b/R/ISODataIdentification.R @@ -302,12 +302,7 @@ ISODataIdentification <- R6Class("ISODataIdentification", characterSet = ISOCharacterSet$new(value = "utf8") ) - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix), - defaults = defaults - ) + super$initialize(xml = xml, defaults = defaults) }, #addSpatialRepresentationType diff --git a/R/ISODataQuality.R b/R/ISODataQuality.R index 54c85636..ee915104 100644 --- a/R/ISODataQuality.R +++ b/R/ISODataQuality.R @@ -66,7 +66,7 @@ #' @author Emmanuel Blondel #' ISODataQuality <- R6Class("ISODataQuality", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "DQ_DataQuality", xmlNamespacePrefix = "GMD" @@ -76,11 +76,7 @@ ISODataQuality <- R6Class("ISODataQuality", report = list(), lineage = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setScope diff --git a/R/ISODate.R b/R/ISODate.R index 23ce393b..a4f5d79b 100644 --- a/R/ISODate.R +++ b/R/ISODate.R @@ -36,7 +36,7 @@ #' @author Emmanuel Blondel #' ISODate <- R6Class("ISODate", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "CI_Date", xmlNamespacePrefix = "GMD" @@ -45,11 +45,7 @@ ISODate <- R6Class("ISODate", date = NULL, dateType = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setDate diff --git a/R/ISODateType.R b/R/ISODateType.R index 1434c252..2e6d7c9b 100644 --- a/R/ISODateType.R +++ b/R/ISODateType.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISODateType <- R6Class("ISODateType", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "CI_DateTypeCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISODateType <- R6Class("ISODateType", ) ISODateType$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISODateType, labels)) + return(ISOCodeListValue$values(ISODateType, labels)) } \ No newline at end of file diff --git a/R/ISODefinitionSource.R b/R/ISODefinitionSource.R index 8082c79e..f197fe12 100644 --- a/R/ISODefinitionSource.R +++ b/R/ISODefinitionSource.R @@ -25,7 +25,7 @@ #' @author Emmanuel Blondel #' ISODefinitionSource <- R6Class("ISODefinitionSource", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "FC_DefinitionSource", xmlNamespacePrefix = "GFC" @@ -34,11 +34,7 @@ ISODefinitionSource <- R6Class("ISODefinitionSource", #+ source [0..1]: ISOCitation source = NULL, initialize = function(xml = NULL, source = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(!is.null(source)){ self$setSource(source) } diff --git a/R/ISODigitalTransferOptions.R b/R/ISODigitalTransferOptions.R index d8533e3a..d59c6da3 100644 --- a/R/ISODigitalTransferOptions.R +++ b/R/ISODigitalTransferOptions.R @@ -49,7 +49,7 @@ #' @author Emmanuel Blondel #' ISODigitalTransferOptions <- R6Class("ISODigitalTransferOptions", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_DigitalTransferOptions", xmlNamespacePrefix = "GMD" @@ -64,11 +64,7 @@ ISODigitalTransferOptions <- R6Class("ISODigitalTransferOptions", #+ offLine [0..1]: MD_Medium offLine = NULL, #TODO initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setUnitsOfDistribution diff --git a/R/ISODimension.R b/R/ISODimension.R index 170bbdcf..30650478 100644 --- a/R/ISODimension.R +++ b/R/ISODimension.R @@ -43,7 +43,7 @@ #' @author Emmanuel Blondel #' ISODimension <- R6Class("ISODimension", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_Dimension", xmlNamespacePrefix = "GMD" @@ -56,11 +56,7 @@ ISODimension <- R6Class("ISODimension", #+ resolution [0..1]: ISOMeasure or subclass resolution = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setName diff --git a/R/ISODimensionNameType.R b/R/ISODimensionNameType.R index 4655b9b8..4fe63110 100644 --- a/R/ISODimensionNameType.R +++ b/R/ISODimensionNameType.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISODimensionNameType <- R6Class("ISODimensionNameType", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_DimensionNameTypeCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISODimensionNameType <- R6Class("ISODimensionNameType", ) ISODimensionNameType$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISODimensionNameType, labels)) + return(ISOCodeListValue$values(ISODimensionNameType, labels)) } \ No newline at end of file diff --git a/R/ISODistribution.R b/R/ISODistribution.R index f11278b4..14a00cb2 100644 --- a/R/ISODistribution.R +++ b/R/ISODistribution.R @@ -11,7 +11,7 @@ #' #' @section Methods: #' \describe{ -#' \item{\code{new(xml,value)}}{ +#' \item{\code{new(xml)}}{ #' This method is used to instantiate an ISODistribution #' } #' \item{\code{setDigitalTransferOptions(options)}}{ @@ -41,7 +41,7 @@ #' @author Emmanuel Blondel #' ISODistribution <- R6Class("ISODistribution", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_Distribution", xmlNamespacePrefix = "GMD" @@ -50,11 +50,7 @@ ISODistribution <- R6Class("ISODistribution", #+ transferOptions [0..*]: ISODigitalTransferOptions transferOptions = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = "MD_Distribution", - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #MD_DigitalTransferOptions diff --git a/R/ISODomainConsistency.R b/R/ISODomainConsistency.R index aa4cf7bd..5b8209d2 100644 --- a/R/ISODomainConsistency.R +++ b/R/ISODomainConsistency.R @@ -25,7 +25,7 @@ #' @author Emmanuel Blondel #' ISODomainConsistency <- R6Class("ISODomainConsistency", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "DQ_DomainConsistency", xmlNamespacePrefix = "GMD" @@ -33,11 +33,7 @@ ISODomainConsistency <- R6Class("ISODomainConsistency", public = list( result = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = "DQ_DomainConsistency", - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #addResult diff --git a/R/ISOExtent.R b/R/ISOExtent.R index d948bd38..595dfdf6 100644 --- a/R/ISOExtent.R +++ b/R/ISOExtent.R @@ -51,7 +51,7 @@ #' @author Emmanuel Blondel #' ISOExtent <- R6Class("ISOExtent", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "EX_Extent", xmlNamespacePrefix = "GMD" @@ -64,11 +64,7 @@ ISOExtent <- R6Class("ISOExtent", #+ verticialElement [0..*]: ISOVerticalElement verticalElement = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #addGeographicElement diff --git a/R/ISOFeatureAttribute.R b/R/ISOFeatureAttribute.R index 308a2f56..fca3c401 100644 --- a/R/ISOFeatureAttribute.R +++ b/R/ISOFeatureAttribute.R @@ -21,7 +21,7 @@ #' Sets the code #' } #' \item{\code{setValueMeasurementUnit(uom)}}{ -#' Sets the value measurement unit +#' Sets the value measurement unit, an object of class \code{GMLUnitDefinition} #' } #' \item{\code{addListedValue(value)}}{ #' Adds a listed value (object of class \code{ISOListedValue}) @@ -41,10 +41,15 @@ #' md$setCardinality(lower=1,upper=1) #' md$setCode("code") #' -#' uom <- ISOUomLength$new() -#' uom$setUomName("Meter") -#' uom$setUomSymbol("m") -#' md$setValueMeasurementUnit(uom) +#' gml <- GMLBaseUnit$new(id = "ID") +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' gml$setUnitsSystem("somelink") +#' md$setValueMeasurementUnit(gml) #' #' val1 <- ISOListedValue$new() #' val1$setCode("code1") @@ -73,7 +78,7 @@ ISOFeatureAttribute <- R6Class("ISOFeatureAttribute", #+ code [0..1]: character code = NULL, - #+ valueMeasurementUnit [0..1]: ISOUnitOfMeasure + #+ valueMeasurementUnit [0..1]: GMLUnitDefinition valueMeasurementUnit = NULL, #+ listedValue [0..*]: ISOListedValue listedValue = list(), @@ -81,11 +86,7 @@ ISOFeatureAttribute <- R6Class("ISOFeatureAttribute", valueType = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setCode @@ -95,8 +96,8 @@ ISOFeatureAttribute <- R6Class("ISOFeatureAttribute", #setValueMeasurementUnit setValueMeasurementUnit = function(uom){ - if(!is(uom, "ISOUnitOfMeasure")){ - stop("The argument should be an object of class 'ISOUnitOfMeasure") + if(!is(uom, "GMLUnitDefinition")){ + stop("The argument should be an object of class 'GMLUnitDefinition") } self$valueMeasurementUnit <- uom }, diff --git a/R/ISOFeatureCatalogue.R b/R/ISOFeatureCatalogue.R index 2a6f6090..99d7c596 100644 --- a/R/ISOFeatureCatalogue.R +++ b/R/ISOFeatureCatalogue.R @@ -94,11 +94,15 @@ #' fat$setCardinality(lower=1,upper=1) #' fat$setCode(sprintf("code %s",i)) #' -#' #add measurement unit -#' uom <- ISOUomLength$new() -#' uom$setUomName("Meter") -#' uom$setUomSymbol("m") -#' fat$setValueMeasurementUnit(uom) +#' gml <- GMLBaseUnit$new(id = sprintf("ID%s",i)) +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' gml$setUnitsSystem("somelink") +#' fat$setValueMeasurementUnit(gml) #' #' #add listed values #' val1 <- ISOListedValue$new() @@ -128,7 +132,7 @@ #' @author Emmanuel Blondel #' ISOFeatureCatalogue <- R6Class("ISOFeatureCatalogue", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( document = TRUE, xmlElement = "FC_FeatureCatalogue", @@ -156,11 +160,7 @@ ISOFeatureCatalogue <- R6Class("ISOFeatureCatalogue", definitionSource = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setName diff --git a/R/ISOFeatureCatalogueDescription.R b/R/ISOFeatureCatalogueDescription.R index a85b2fca..f91edddc 100644 --- a/R/ISOFeatureCatalogueDescription.R +++ b/R/ISOFeatureCatalogueDescription.R @@ -80,11 +80,7 @@ ISOFeatureCatalogueDescription <- R6Class("ISOFeatureCatalogueDescription", featureCatalogueCitation = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setComplianceCode diff --git a/R/ISOFeatureOperation.R b/R/ISOFeatureOperation.R index 663afec5..fff2b45e 100644 --- a/R/ISOFeatureOperation.R +++ b/R/ISOFeatureOperation.R @@ -50,11 +50,7 @@ ISOFeatureOperation <- R6Class("ISOFeatureOperation", formalDefinition = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setSignature diff --git a/R/ISOFeatureType.R b/R/ISOFeatureType.R index 8d5e8abc..5793f496 100644 --- a/R/ISOFeatureType.R +++ b/R/ISOFeatureType.R @@ -82,10 +82,15 @@ #' fat$setCode(sprintf("code %s",i)) #' #' #add measurement unit -#' uom <- ISOUomLength$new() -#' uom$setUomName("Meter") -#' uom$setUomSymbol("m") -#' fat$setValueMeasurementUnit(uom) +#' gml <- GMLBaseUnit$new(id = "ID%") +#' gml$setDescriptionReference("someref") +#' gml$setIdentifier("identifier", "codespace") +#' gml$addName("name1", "codespace") +#' gml$addName("name2", "codespace") +#' gml$setQuantityTypeReference("someref") +#' gml$setCatalogSymbol("symbol") +#' gml$setUnitsSystem("somelink") +#' fat$setValueMeasurementUnit(gml) #' #' #add listed values #' val1 <- ISOListedValue$new() @@ -111,7 +116,7 @@ #' @author Emmanuel Blondel #' ISOFeatureType <- R6Class("ISOFeatureType", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "FC_FeatureType", xmlNamespacePrefix = "GFC" @@ -142,11 +147,7 @@ ISOFeatureType <- R6Class("ISOFeatureType", definitionReference = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setTypeName diff --git a/R/ISOGeographicBoundingBox.R b/R/ISOGeographicBoundingBox.R index 8112c8a1..2316b4ff 100644 --- a/R/ISOGeographicBoundingBox.R +++ b/R/ISOGeographicBoundingBox.R @@ -40,11 +40,7 @@ ISOGeographicBoundingBox <- R6Class("ISOGeographicBoundingBox", southBoundLatitude = NULL, northBoundLatitude = NULL, initialize = function(xml = NULL, minx, miny, maxx, maxy, bbox = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ if(!is.null(bbox)){ if(!is(bbox, "matrix") || !all.equal(dim(bbox), c(2,2))){ diff --git a/R/ISOGeographicDescription.R b/R/ISOGeographicDescription.R index 27a3a366..1306b243 100644 --- a/R/ISOGeographicDescription.R +++ b/R/ISOGeographicDescription.R @@ -36,11 +36,7 @@ ISOGeographicDescription <- R6Class("ISOGeographicDescription", #+ geographicIdentifier [1..1]: character geographicIdentifier = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setGeographicIdentifier diff --git a/R/ISOGeographicExtent.R b/R/ISOGeographicExtent.R index 45421bbb..204d0ad3 100644 --- a/R/ISOGeographicExtent.R +++ b/R/ISOGeographicExtent.R @@ -11,7 +11,7 @@ #' #' @section Methods: #' \describe{ -#' \item{\code{new(xml, element, namespace, defaults)}}{ +#' \item{\code{new(xml, defaults)}}{ #' This method is used to instantiate an ISOGeographicExtent #' } #' } @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOGeographicExtent <- R6Class("ISOGeographicExtent", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "EX_GeographicExtent", xmlNamespacePrefix = "GMD" @@ -32,9 +32,9 @@ ISOGeographicExtent <- R6Class("ISOGeographicExtent", public = list( #+ extentTypeCode [0..1]: ISOBaseBoolean default "true" extentTypeCode = NULL, - initialize = function(xml = NULL, element, namespace, defaults = list()){ + initialize = function(xml = NULL, defaults = list()){ defaults = list(extentTypeCode = TRUE) - super$initialize(xml, element, namespace, defaults) + super$initialize(xml, defaults = defaults) } ) ) \ No newline at end of file diff --git a/R/ISOGeometricObjectType.R b/R/ISOGeometricObjectType.R index 58712bb1..a614951f 100644 --- a/R/ISOGeometricObjectType.R +++ b/R/ISOGeometricObjectType.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOGeometricObjectType <- R6Class("ISOGeometricObjectType", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_GeometricObjectTypeCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOGeometricObjectType <- R6Class("ISOGeometricObjectType", ) ISOGeometricObjectType$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOGeometricObjectType, labels)) + return(ISOCodeListValue$values(ISOGeometricObjectType, labels)) } \ No newline at end of file diff --git a/R/ISOGeometricObjects.R b/R/ISOGeometricObjects.R index 03355dd4..65de81b7 100644 --- a/R/ISOGeometricObjects.R +++ b/R/ISOGeometricObjects.R @@ -35,7 +35,7 @@ #' @author Emmanuel Blondel #' ISOGeometricObjects <- R6Class("ISOGeometricObjects", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_GeometricObjects", xmlNamespacePrefix = "GMD" @@ -44,11 +44,7 @@ ISOGeometricObjects <- R6Class("ISOGeometricObjects", geometricObjectType = NULL, geometricObjectCount = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setGeometricObjectType diff --git a/R/ISOGeoreferenceable.R b/R/ISOGeoreferenceable.R index 10abc375..485f5365 100644 --- a/R/ISOGeoreferenceable.R +++ b/R/ISOGeoreferenceable.R @@ -106,11 +106,7 @@ ISOGeoreferenceable <- R6Class("ISOGeoreferenceable", parameterCitation = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setControlPointAvailability diff --git a/R/ISOGridSpatialRepresentation.R b/R/ISOGridSpatialRepresentation.R index 53d513cc..8853bbde 100644 --- a/R/ISOGridSpatialRepresentation.R +++ b/R/ISOGridSpatialRepresentation.R @@ -68,14 +68,8 @@ ISOGridSpatialRepresentation <- R6Class("ISOGridSpatialRepresentation", #+ transformationParameterAvailability : logical transformationParameterAvailability = NULL, - initialize = function(xml = NULL, element = NULL, namespace = NULL){ - if(is.null(element)) element <- private$xmlElement - if(is.null(namespace)) namespace <- getISOMetadataNamespace(private$xmlNamespacePrefix) - super$initialize( - xml = xml, - element = element, - namespace = namespace - ) + initialize = function(xml = NULL){ + super$initialize(xml = xml) }, #setNumberOfDimensions diff --git a/R/ISOHierarchyLevel.R b/R/ISOHierarchyLevel.R index cc87e143..e1abb359 100644 --- a/R/ISOHierarchyLevel.R +++ b/R/ISOHierarchyLevel.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOHierarchyLevel <- R6Class("ISOHierarchyLevel", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_ScopeCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOHierarchyLevel <- R6Class("ISOHierarchyLevel", ) ISOHierarchyLevel$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOHierarchyLevel, labels)) + return(ISOCodeListValue$values(ISOHierarchyLevel, labels)) } \ No newline at end of file diff --git a/R/ISOIdentification.R b/R/ISOIdentification.R index 126722cf..de9d67d3 100644 --- a/R/ISOIdentification.R +++ b/R/ISOIdentification.R @@ -105,7 +105,7 @@ #' @author Emmanuel Blondel #' ISOIdentification <- R6Class("ISOIdentification", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_Identification", xmlNamespacePrefix = "GMD" @@ -137,8 +137,8 @@ ISOIdentification <- R6Class("ISOIdentification", resourceSpecificUsage = list(), #TODO #+ aggregationInfo [0..*]: MD_AggregateInformation (ISOAggregateInformation - to implement) aggregationInformation = list(), #TODO - initialize = function(xml = NULL, element, namespace, defaults = list()){ - super$initialize(xml, element, namespace, defaults) + initialize = function(xml = NULL, defaults = list()){ + super$initialize(xml, defaults = defaults) }, #MD_Identification diff --git a/R/ISOIdentifier.R b/R/ISOIdentifier.R index 08c08bf4..9aacee44 100644 --- a/R/ISOIdentifier.R +++ b/R/ISOIdentifier.R @@ -12,7 +12,7 @@ #' #' @section Methods: #' \describe{ -#' \item{\code{new(xml, prefix, code, codeSpace)}}{ +#' \item{\code{new(xml, code, codeSpace)}}{ #' This method is used to instantiate an ISOIdentifier #' } #' \item{\code{setAuthority(authority)}}{ @@ -28,9 +28,9 @@ #' @author Emmanuel Blondel #' ISOIdentifier <- R6Class("ISOIdentifier", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( - xmlElement = c("MD_Identifier", "RS_Identifier"), + xmlElement = "Identifier", xmlNamespacePrefix = "GMD" ), public = list( @@ -38,12 +38,8 @@ ISOIdentifier <- R6Class("ISOIdentifier", authority = NULL, #+ code[1..1]: character code = NULL, - initialize = function(xml = NULL, prefix, code){ - super$initialize( - xml = xml, - element = paste(prefix, "Identifier", sep = "_"), - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + initialize = function(xml = NULL, code){ + super$initialize(xml = xml) if(is.null(xml)){ self$code <- as.character(code) } diff --git a/R/ISOKeywordType.R b/R/ISOKeywordType.R index 82da4085..124a2fd7 100644 --- a/R/ISOKeywordType.R +++ b/R/ISOKeywordType.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOKeywordType <- R6Class("ISOKeywordType", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_KeywordTypeCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOKeywordType <- R6Class("ISOKeywordType", ) ISOKeywordType$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOKeywordType, labels)) + return(ISOCodeListValue$values(ISOKeywordType, labels)) } \ No newline at end of file diff --git a/R/ISOKeywords.R b/R/ISOKeywords.R index 7fc38c79..d67dbe30 100644 --- a/R/ISOKeywords.R +++ b/R/ISOKeywords.R @@ -45,7 +45,7 @@ #' @author Emmanuel Blondel #' ISOKeywords <- R6Class("ISOKeywords", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_Keywords", xmlNamespacePrefix = "GMD" @@ -55,11 +55,7 @@ ISOKeywords <- R6Class("ISOKeywords", type = NULL, thesaurusName = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #addKeyword diff --git a/R/ISOLanguage.R b/R/ISOLanguage.R index 6c251a00..54e15234 100644 --- a/R/ISOLanguage.R +++ b/R/ISOLanguage.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOLanguage <- R6Class("ISOLanguage", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "LanguageCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOLanguage <- R6Class("ISOLanguage", ) ISOLanguage$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOLanguage, labels)) + return(ISOCodeListValue$values(ISOLanguage, labels)) } \ No newline at end of file diff --git a/R/ISOLegalConstraints.R b/R/ISOLegalConstraints.R index 35b40ea9..9c1a108e 100644 --- a/R/ISOLegalConstraints.R +++ b/R/ISOLegalConstraints.R @@ -76,11 +76,7 @@ ISOLegalConstraints <- R6Class("ISOLegalConstraints", #+ otherConstraints [0..*]: character otherConstraints = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #addAccessConstraint diff --git a/R/ISOLength.R b/R/ISOLength.R index 6c9d88cc..954d28ee 100644 --- a/R/ISOLength.R +++ b/R/ISOLength.R @@ -33,8 +33,6 @@ ISOLength <- R6Class("ISOLength", initialize = function(xml = NULL, value, uom, useUomURI = FALSE){ super$initialize( xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix), value = value, uom = uom, useUomURI = useUomURI diff --git a/R/ISOLineage.R b/R/ISOLineage.R index 54fb1ce3..6a432cfd 100644 --- a/R/ISOLineage.R +++ b/R/ISOLineage.R @@ -70,7 +70,7 @@ #' @author Emmanuel Blondel #' ISOLineage<- R6Class("ISOLineage", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "LI_Lineage", xmlNamespacePrefix = "GMD" @@ -83,11 +83,7 @@ ISOLineage<- R6Class("ISOLineage", #+ source [0..*]: ISOSource source = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setStatement diff --git a/R/ISOListedValue.R b/R/ISOListedValue.R index d3cb4fde..7d1aee18 100644 --- a/R/ISOListedValue.R +++ b/R/ISOListedValue.R @@ -41,7 +41,7 @@ #' @author Emmanuel Blondel #' ISOListedValue <- R6Class("ISOListedValue", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "FC_ListedValue", xmlNamespacePrefix = "GFC" @@ -58,11 +58,7 @@ ISOListedValue <- R6Class("ISOListedValue", definitionReference = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setLabel diff --git a/R/ISOLocalName.R b/R/ISOLocalName.R index e5bb0d31..7b3110aa 100644 --- a/R/ISOLocalName.R +++ b/R/ISOLocalName.R @@ -22,7 +22,7 @@ #' @author Emmanuel Blondel #' ISOLocalName <- R6Class("ISOLocalName", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "LocalName", xmlNamespacePrefix = "GCO" @@ -30,11 +30,7 @@ ISOLocalName <- R6Class("ISOLocalName", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$value = value } diff --git a/R/ISOMaintenanceFrequency.R b/R/ISOMaintenanceFrequency.R index 5389f614..488d9bd3 100644 --- a/R/ISOMaintenanceFrequency.R +++ b/R/ISOMaintenanceFrequency.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOMaintenanceFrequency <- R6Class("ISOMaintenanceFrequency", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_MaintenanceFrequencyCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOMaintenanceFrequency <- R6Class("ISOMaintenanceFrequency", ) ISOMaintenanceFrequency$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOMaintenanceFrequency, labels)) + return(ISOCodeListValue$values(ISOMaintenanceFrequency, labels)) } \ No newline at end of file diff --git a/R/ISOMaintenanceInformation.R b/R/ISOMaintenanceInformation.R index 3346b1cb..ff8404ca 100644 --- a/R/ISOMaintenanceInformation.R +++ b/R/ISOMaintenanceInformation.R @@ -30,7 +30,7 @@ #' @author Emmanuel Blondel #' ISOMaintenanceInformation <- R6Class("ISOMaintenanceInformation", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_MaintenanceInformation", xmlNamespacePrefix = "GMD" @@ -38,11 +38,7 @@ ISOMaintenanceInformation <- R6Class("ISOMaintenanceInformation", public = list( maintenanceAndUpdateFrequency = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setMaintenanceFrequency diff --git a/R/ISOMeasure.R b/R/ISOMeasure.R index bb889e70..2ff936dc 100644 --- a/R/ISOMeasure.R +++ b/R/ISOMeasure.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOMeasure <- R6Class("ISOMeasure", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "Measure", xmlNamespacePrefix = "GCO" @@ -32,14 +32,8 @@ ISOMeasure <- R6Class("ISOMeasure", public = list( value = NA, attrs = list(), - initialize = function(xml = NULL, element = NULL, namespace = NULL, value, uom, useUomURI = FALSE){ - if(is.null(element)) element <- private$xmlElement - if(is.null(namespace)) namespace <- getISOMetadataNamespace(private$xmlNamespacePrefix) - super$initialize( - xml = xml, - element = element, - namespace = namespace - ) + initialize = function(xml = NULL, value, uom, useUomURI = FALSE){ + super$initialize(xml = xml) if(is.null(xml)){ if(!is(value, "double")){ value <- as.double(value) @@ -50,11 +44,6 @@ ISOMeasure <- R6Class("ISOMeasure", uomAttr <- sprintf("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='%s'])", uomAttr) } self$attrs[["uom"]] <- uomAttr - }else{ - uomId <- XML::xmlGetAttr(xml, "uom") - if(!is.null(uomId)){ - self$attrs[["uom"]] <- uomId - } } } ) diff --git a/R/ISOMemberName.R b/R/ISOMemberName.R index 93e2d281..64382298 100644 --- a/R/ISOMemberName.R +++ b/R/ISOMemberName.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOMemberName <- R6Class("ISOMemberName", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MemberName", xmlNamespacePrefix = "GCO" @@ -38,11 +38,7 @@ ISOMemberName <- R6Class("ISOMemberName", aName = NULL, attributeType = NULL, initialize = function(xml = NULL, aName, attributeType){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$setName(aName) self$setAttributeType(attributeType) diff --git a/R/ISOMetaIdentifier.R b/R/ISOMetaIdentifier.R index e0fa3f74..1a9eb83e 100644 --- a/R/ISOMetaIdentifier.R +++ b/R/ISOMetaIdentifier.R @@ -33,7 +33,7 @@ ISOMetaIdentifier <- R6Class("ISOMetaIdentifier", ), public = list( initialize = function(xml = NULL, code){ - super$initialize(xml = xml, prefix = "MD", code = code) + super$initialize(xml = xml, code = code) } ) ) \ No newline at end of file diff --git a/R/ISOMetadata.R b/R/ISOMetadata.R index f3def5de..ba0c83f4 100644 --- a/R/ISOMetadata.R +++ b/R/ISOMetadata.R @@ -1,11 +1,11 @@ -#' ISOMetadataElement +#' ISOMetadata #' #' @docType class #' @importFrom R6 R6Class #' @import XML #' @export #' @keywords ISO metadata element -#' @return Object of \code{\link{R6Class}} for modelling an ISO Metadata Element +#' @return Object of \code{\link{R6Class}} for modelling an ISO Metadata #' @format \code{\link{R6Class}} object. #' #' @field fileIdentifier @@ -369,7 +369,7 @@ #' @author Emmanuel Blondel #' ISOMetadata <- R6Class("ISOMetadata", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( document = TRUE, xmlElement = "MD_Metadata", @@ -435,12 +435,7 @@ ISOMetadata <- R6Class("ISOMetadata", xml <- xmlChildren(xmlChildren(xml)[[1]])[[1]] } } - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix), - defaults = defaults - ) + super$initialize(xml = xml, defaults = defaults) }, #MD_Metadata diff --git a/R/ISOMetadataNamespace.R b/R/ISOMetadataNamespace.R index c15b1d8e..047d129d 100644 --- a/R/ISOMetadataNamespace.R +++ b/R/ISOMetadataNamespace.R @@ -40,6 +40,7 @@ ISOMetadataNamespace$GMI = ISOMetadataNamespace$new("gmi", "http://www.isotc211. ISOMetadataNamespace$GTS = ISOMetadataNamespace$new("gts", "http://www.isotc211.org/2005/gts") ISOMetadataNamespace$SRV = ISOMetadataNamespace$new("srv", "http://www.isotc211.org/2005/srv") ISOMetadataNamespace$GML = ISOMetadataNamespace$new("gml", "http://www.opengis.net/gml/3.2") +ISOMetadataNamespace$XLINK = ISOMetadataNamespace$new("xlink", "http://www.w3.org/1999/xlink") ISOMetadataNamespace$all = function(){ return(list( ISOMetadataNamespace$GCO, @@ -48,7 +49,8 @@ ISOMetadataNamespace$all = function(){ ISOMetadataNamespace$GMI, ISOMetadataNamespace$GTS, ISOMetadataNamespace$SRV, - ISOMetadataNamespace$GML + ISOMetadataNamespace$GML, + ISOMetadataNamespace$XLINK )) } diff --git a/R/ISOMultiplicity.R b/R/ISOMultiplicity.R index b6e251b7..576ab42f 100644 --- a/R/ISOMultiplicity.R +++ b/R/ISOMultiplicity.R @@ -27,7 +27,7 @@ #' @author Emmanuel Blondel #' ISOMultiplicity <- R6Class("ISOMultiplicity", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "Multiplicity", xmlNamespacePrefix = "GCO" @@ -35,11 +35,7 @@ ISOMultiplicity <- R6Class("ISOMultiplicity", public = list( range = NULL, initialize = function(xml = NULL, lower, upper){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$range <- ISOMultiplicityRange$new(lower = lower, upper = upper) } diff --git a/R/ISOMultiplicityRange.R b/R/ISOMultiplicityRange.R index 65f03f7d..ef93000d 100644 --- a/R/ISOMultiplicityRange.R +++ b/R/ISOMultiplicityRange.R @@ -26,7 +26,7 @@ #' @author Emmanuel Blondel #' ISOMultiplicityRange <- R6Class("ISOMultiplicityRange", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MultiplicityRange", xmlNamespacePrefix = "GCO" @@ -35,11 +35,7 @@ ISOMultiplicityRange <- R6Class("ISOMultiplicityRange", lower = NULL, upper = NULL, initialize = function(xml = NULL, lower, upper){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ if(!is(lower, "integer")){ lower <- as.integer(lower) diff --git a/R/ISOOnlineResource.R b/R/ISOOnlineResource.R index f5431311..a1d563cd 100644 --- a/R/ISOOnlineResource.R +++ b/R/ISOOnlineResource.R @@ -45,7 +45,7 @@ #' @author Emmanuel Blondel #' ISOOnlineResource <- R6Class("ISOOnlineResource", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "CI_OnlineResource", xmlNamespacePrefix = "GMD" @@ -56,11 +56,7 @@ ISOOnlineResource <- R6Class("ISOOnlineResource", name = NULL, description = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setLinkage diff --git a/R/ISOPresentationForm.R b/R/ISOPresentationForm.R index d3a4222b..9f22e156 100644 --- a/R/ISOPresentationForm.R +++ b/R/ISOPresentationForm.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOPresentationForm <- R6Class("ISOPresentationForm", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "CI_PresentationFormCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOPresentationForm <- R6Class("ISOPresentationForm", ) ISOPresentationForm$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOPresentationForm, labels)) + return(ISOCodeListValue$values(ISOPresentationForm, labels)) } \ No newline at end of file diff --git a/R/ISOProcessStep.R b/R/ISOProcessStep.R index bebdfa41..853ba35e 100644 --- a/R/ISOProcessStep.R +++ b/R/ISOProcessStep.R @@ -56,7 +56,7 @@ #' @author Emmanuel Blondel #' ISOProcessStep <- R6Class("ISOProcessStep", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "LI_ProcessStep", xmlNamespacePrefix = "GMD" @@ -75,11 +75,7 @@ ISOProcessStep <- R6Class("ISOProcessStep", source = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setDescription diff --git a/R/ISOPropertyType.R b/R/ISOPropertyType.R index 776668a3..51d4de74 100644 --- a/R/ISOPropertyType.R +++ b/R/ISOPropertyType.R @@ -16,7 +16,7 @@ #' #' @section Methods: #' \describe{ -#' \item{\code{new(xml, element, namespace, defaults)}}{ +#' \item{\code{new(xml, defaults)}}{ #' This method is used to instantiate an ISOPropertyType #' } #' \item{\code{setMemberName(memberName)}}{ @@ -51,7 +51,7 @@ #' @author Emmanuel Blondel #' ISOPropertyType <- R6Class("ISOPropertyType", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "FC_PropertyType", xmlNamespacePrefix = "GFC" @@ -71,19 +71,9 @@ ISOPropertyType <- R6Class("ISOPropertyType", #+ definitionReference [0..1] definitionReference = NULL, - initialize = function(xml = NULL, - element = NULL, namespace = NULL, - defaults = NULL){ - - if(is.null(element)) element <- private$xmlElement - if(is.null(namespace)) namespace <- getISOMetadataNamespace(private$xmlNamespacePrefix) + initialize = function(xml = NULL, defaults = NULL){ if(is.null(defaults)) defaults <- list(cardinality = ISOMultiplicityRange$new(lower=1L,upper=1L)) - super$initialize( - xml = xml, - element = element, - namespace = namespace, - defaults = defaults - ) + super$initialize(xml = xml, defaults = defaults) }, #setMemberName diff --git a/R/ISORangeDimension.R b/R/ISORangeDimension.R index 1fa27a20..ac1db845 100644 --- a/R/ISORangeDimension.R +++ b/R/ISORangeDimension.R @@ -12,7 +12,7 @@ #' #' @section Methods: #' \describe{ -#' \item{\code{new(xml, element, namespace)}}{ +#' \item{\code{new(xml)}}{ #' This method is used to instantiate an ISORangeDimension #' } #' \item{\code{setSequenceIdentifier(memberName)}}{ @@ -36,7 +36,7 @@ #' @author Emmanuel Blondel #' ISORangeDimension <- R6Class("ISORangeDimension", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_RangeDimension", xmlNamespacePrefix = "GMD" @@ -44,14 +44,8 @@ ISORangeDimension <- R6Class("ISORangeDimension", public = list( sequenceIdentifier = NULL, descriptor = NULL, - initialize = function(xml = NULL, element = NULL, namespace = NULL){ - if(is.null(element)) element <- private$xmlElement - if(is.null(namespace)) namespace <- getISOMetadataNamespace(private$xmlNamespacePrefix) - super$initialize( - xml = xml, - element = element, - namespace = namespace - ) + initialize = function(xml = NULL){ + super$initialize(xml = xml) }, #setSequenceIdentifier diff --git a/R/ISORecord.R b/R/ISORecord.R index 62be0a02..7a2a4071 100644 --- a/R/ISORecord.R +++ b/R/ISORecord.R @@ -22,7 +22,7 @@ #' @author Emmanuel Blondel #' ISORecord <- R6Class("ISORecord", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "Record", xmlNamespacePrefix = "GCO" @@ -30,11 +30,7 @@ ISORecord <- R6Class("ISORecord", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$value = value } diff --git a/R/ISORecordType.R b/R/ISORecordType.R index f5b7e80e..b245ec78 100644 --- a/R/ISORecordType.R +++ b/R/ISORecordType.R @@ -22,7 +22,7 @@ #' @author Emmanuel Blondel #' ISORecordType <- R6Class("ISORecordType", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "RecordType", xmlNamespacePrefix = "GCO" @@ -30,11 +30,7 @@ ISORecordType <- R6Class("ISORecordType", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$value = value } diff --git a/R/ISOReferenceIdentifier.R b/R/ISOReferenceIdentifier.R index 0d1bd945..53891064 100644 --- a/R/ISOReferenceIdentifier.R +++ b/R/ISOReferenceIdentifier.R @@ -41,7 +41,7 @@ ISOReferenceIdentifier <- R6Class("ISOReferenceIdentifier", #+ version [0..1]: character version = NULL, initialize = function(xml = NULL, code, codeSpace = NULL){ - super$initialize(xml = xml, prefix = "RS", code = code) + super$initialize(xml = xml, code = code) if(!is.null(codeSpace)) self$setCodeSpace(codeSpace) }, diff --git a/R/ISOReferenceSystem.R b/R/ISOReferenceSystem.R index a1ab07c0..a58bb8c1 100644 --- a/R/ISOReferenceSystem.R +++ b/R/ISOReferenceSystem.R @@ -31,7 +31,7 @@ #' @author Emmanuel Blondel #' ISOReferenceSystem <- R6Class("ISOReferenceSystem", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_ReferenceSystem", xmlNamespacePrefix = "GMD" @@ -39,11 +39,7 @@ ISOReferenceSystem <- R6Class("ISOReferenceSystem", public = list( referenceSystemIdentifier = NULL, initialize = function(xml = NULL, prefix, code){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setReferenceSystemIdentifier diff --git a/R/ISORepresentativeFraction.R b/R/ISORepresentativeFraction.R index a5343ed0..a5d22fea 100644 --- a/R/ISORepresentativeFraction.R +++ b/R/ISORepresentativeFraction.R @@ -31,7 +31,7 @@ #' @author Emmanuel Blondel #' ISORepresentativeFraction <- R6Class("ISORepresentativeFraction", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_RepresentativeFraction", xmlNamespacePrefix = "GMD" @@ -39,11 +39,7 @@ ISORepresentativeFraction <- R6Class("ISORepresentativeFraction", public = list( denominator = NULL, initialize = function(xml = NULL, denominator){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml) & !missing(denominator)){ self$setDenominator(denominator) } diff --git a/R/ISOResponsibleParty.R b/R/ISOResponsibleParty.R index e0efc635..dde47e42 100644 --- a/R/ISOResponsibleParty.R +++ b/R/ISOResponsibleParty.R @@ -51,7 +51,7 @@ #' @author Emmanuel Blondel #' ISOResponsibleParty <- R6Class("ISOResponsibleParty", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "CI_ResponsibleParty", xmlNamespacePrefix = "GMD" @@ -63,11 +63,7 @@ ISOResponsibleParty <- R6Class("ISOResponsibleParty", contactInfo = NULL, role = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setIndividualName diff --git a/R/ISORestriction.R b/R/ISORestriction.R index 20959cf2..cba592b4 100644 --- a/R/ISORestriction.R +++ b/R/ISORestriction.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISORestriction <- R6Class("ISORestriction", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_RestrictionCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISORestriction <- R6Class("ISORestriction", ) ISORestriction$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISORestriction, labels)) + return(ISOCodeListValue$values(ISORestriction, labels)) } \ No newline at end of file diff --git a/R/ISORole.R b/R/ISORole.R index e35d395b..c2f3b4ed 100644 --- a/R/ISORole.R +++ b/R/ISORole.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISORole <- R6Class("ISORole", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "CI_RoleCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISORole <- R6Class("ISORole", ) ISORole$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISORole, labels)) + return(ISOCodeListValue$values(ISORole, labels)) } \ No newline at end of file diff --git a/R/ISOScale.R b/R/ISOScale.R index 80255c2a..2be71c75 100644 --- a/R/ISOScale.R +++ b/R/ISOScale.R @@ -33,8 +33,6 @@ ISOScale <- R6Class("ISOScale", initialize = function(xml = NULL, value, uom, useUomURI = FALSE){ super$initialize( xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix), value = value, uom = uom ) diff --git a/R/ISOScope.R b/R/ISOScope.R index cc3936de..802047db 100644 --- a/R/ISOScope.R +++ b/R/ISOScope.R @@ -30,7 +30,7 @@ #' @author Emmanuel Blondel #' ISOScope <- R6Class("ISOScope", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "DQ_Scope", xmlNamespacePrefix = "GMD" @@ -38,11 +38,7 @@ ISOScope <- R6Class("ISOScope", public = list( level = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setLevel diff --git a/R/ISOSecurityConstraints.R b/R/ISOSecurityConstraints.R index 35d74204..6d3e4524 100644 --- a/R/ISOSecurityConstraints.R +++ b/R/ISOSecurityConstraints.R @@ -64,11 +64,7 @@ ISOSecurityConstraints <- R6Class("ISOSecurityConstraints", #+ handlingDescription [0..1]: character handlingDescription = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setClassification diff --git a/R/ISOSource.R b/R/ISOSource.R index 22778456..8f0a5b2b 100644 --- a/R/ISOSource.R +++ b/R/ISOSource.R @@ -72,7 +72,7 @@ #' @author Emmanuel Blondel #' ISOSource <- R6Class("ISOSource", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "LI_Source", xmlNamespacePrefix = "GMD" @@ -93,11 +93,7 @@ ISOSource <- R6Class("ISOSource", sourceStep = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setDescription diff --git a/R/ISOSpatialRepresentation.R b/R/ISOSpatialRepresentation.R index 462ba739..0f6972a9 100644 --- a/R/ISOSpatialRepresentation.R +++ b/R/ISOSpatialRepresentation.R @@ -22,14 +22,14 @@ #' @author Emmanuel Blondel #' ISOSpatialRepresentation <- R6Class("ISOSpatialRepresentation", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "MD_SpatialRepresentation", xmlNamespacePrefix = "GMD" ), public = list( - initialize = function(xml = NULL, element, namespace, defaults = list()){ - super$initialize(xml, element, namespace, defaults) + initialize = function(xml = NULL, defaults = list()){ + super$initialize(xml, defaults = defaults) } ) ) \ No newline at end of file diff --git a/R/ISOSpatialRepresentationType.R b/R/ISOSpatialRepresentationType.R index b645cd46..09fc7430 100644 --- a/R/ISOSpatialRepresentationType.R +++ b/R/ISOSpatialRepresentationType.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOSpatialRepresentationType <- R6Class("ISOSpatialRepresentationType", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_SpatialRepresentationTypeCode", xmlNamespacePrefix = "GMD" @@ -43,5 +43,5 @@ ISOSpatialRepresentationType <- R6Class("ISOSpatialRepresentationType", ) ISOSpatialRepresentationType$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOSpatialRepresentationType, labels)) + return(ISOCodeListValue$values(ISOSpatialRepresentationType, labels)) } \ No newline at end of file diff --git a/R/ISOStatus.R b/R/ISOStatus.R index 61ab92bc..6146420c 100644 --- a/R/ISOStatus.R +++ b/R/ISOStatus.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOStatus<- R6Class("ISOStatus", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_ProgressCode", xmlNamespacePrefix = "GMD" @@ -43,5 +43,5 @@ ISOStatus<- R6Class("ISOStatus", ) ISOStatus$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOStatus, labels)) + return(ISOCodeListValue$values(ISOStatus, labels)) } \ No newline at end of file diff --git a/R/ISOTelephone.R b/R/ISOTelephone.R index 3569a77d..cab914ac 100644 --- a/R/ISOTelephone.R +++ b/R/ISOTelephone.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOTelephone <- R6Class("ISOTelephone", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "CI_Telephone", xmlNamespacePrefix = "GMD" @@ -38,11 +38,7 @@ ISOTelephone <- R6Class("ISOTelephone", voice = NULL, facsimile = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setVoice diff --git a/R/ISOTemporalExtent.R b/R/ISOTemporalExtent.R index 5c81208a..7822e235 100644 --- a/R/ISOTemporalExtent.R +++ b/R/ISOTemporalExtent.R @@ -33,7 +33,7 @@ #' @author Emmanuel Blondel #' ISOTemporalExtent <- R6Class("ISOTemporalExtent", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "EX_TemporalExtent", xmlNamespacePrefix = "GMD" @@ -41,11 +41,7 @@ ISOTemporalExtent <- R6Class("ISOTemporalExtent", public = list( extent = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setTimeInstant diff --git a/R/ISOTopicCategory.R b/R/ISOTopicCategory.R index c742a9df..fdd90097 100644 --- a/R/ISOTopicCategory.R +++ b/R/ISOTopicCategory.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOTopicCategory <- R6Class("ISOTopicCategory", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_TopicCategoryCode", xmlNamespacePrefix = "GMD" @@ -43,5 +43,5 @@ ISOTopicCategory <- R6Class("ISOTopicCategory", ) ISOTopicCategory$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOTopicCategory, labels)) + return(ISOCodeListValue$values(ISOTopicCategory, labels)) } \ No newline at end of file diff --git a/R/ISOTopologyLevel.R b/R/ISOTopologyLevel.R index 633547b1..1d3ba546 100644 --- a/R/ISOTopologyLevel.R +++ b/R/ISOTopologyLevel.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOTopologyLevel <- R6Class("ISOTopologyLevel", - inherit = ISOMetadataCodelistElement, + inherit = ISOCodeListValue, private = list( xmlElement = "MD_TopologyLevelCode", xmlNamespacePrefix = "GMD" @@ -42,5 +42,5 @@ ISOTopologyLevel <- R6Class("ISOTopologyLevel", ) ISOTopologyLevel$values <- function(labels = FALSE){ - return(ISOMetadataCodelistElement$values(ISOTopologyLevel, labels)) + return(ISOCodeListValue$values(ISOTopologyLevel, labels)) } \ No newline at end of file diff --git a/R/ISOTypeName.R b/R/ISOTypeName.R index 36627cc2..2a187e62 100644 --- a/R/ISOTypeName.R +++ b/R/ISOTypeName.R @@ -29,7 +29,7 @@ #' @author Emmanuel Blondel #' ISOTypeName <- R6Class("ISOTypeName", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "TypeName", xmlNamespacePrefix = "GCO" @@ -40,11 +40,7 @@ ISOTypeName <- R6Class("ISOTypeName", aName = NULL, initialize = function(xml = NULL, aName = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ if(!is.null(aName)) self$setName(aName) } diff --git a/R/ISOURL.R b/R/ISOURL.R index 06fdab89..7c4676dd 100644 --- a/R/ISOURL.R +++ b/R/ISOURL.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOURL <- R6Class("ISOURL", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "URL", xmlNamespacePrefix = "GMD" @@ -32,11 +32,7 @@ ISOURL <- R6Class("ISOURL", public = list( value = NA, initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ self$value = value } diff --git a/R/ISOUnitOfMeasure.R b/R/ISOUnitOfMeasure.R deleted file mode 100644 index f68bc335..00000000 --- a/R/ISOUnitOfMeasure.R +++ /dev/null @@ -1,84 +0,0 @@ -#' ISOUnitOfMeasure -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO -#' @return Object of \code{\link{R6Class}} for modelling an ISO abstract UnitOfMeasure -#' @format \code{\link{R6Class}} object. -#' -#' @field uomName -#' @field uomSymbol -#' @field measureType -#' @field nameStandardUnit -#' @field scaleToStandardUnit -#' @field offsetToStandardUnit -#' @field formula -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml,value)}}{ -#' This method is used to instantiate an ISOUnitOfMeasure -#' } -#' } -#' -#' @note Abstract ISO class used internally by geometa -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUnitOfMeasure <- R6Class("ISOUnitOfMeasure", - inherit = ISOMetadataElement, - private = list( - xmlElement = "UnitOfMeasure", - xmlNamespacePrefix = "GCO" - ), - public = list( - uomName = NULL, - uomSymbol = NULL, - measureType = NULL, - nameStandardUnit = NULL, - scaleToStandardUnit = NULL, - offsetToStandardUnit = NULL, - formula = NULL, - initialize = function(xml = NULL, measureType){ - - self$measureType <- measureType - - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) - - }, - - #setUomName - setUomName = function(uomName){ - self$uomName <- uomName - }, - - #setUomSymbol - setUomSymbol = function(uomSymbol){ - self$uomSymbol <- uomSymbol - }, - - #setNameStandardUnit - setNameStandardUnit = function(nameStandardUnit){ - self$nameStandardUnit <- nameStandardUnit - }, - - #setScaleToStandardUnit - setScaleToStandardUnit = function(scaleToStandardUnit){ - self$scaleToStandardUnit <- as.numeric(scaleToStandardUnit) - }, - - #setOffsetToStandardUnit - setOffsetStandardUnit = function(offsetToStandardUnit){ - self$offsetToStandardUnit <- as.numeric(offsetToStandardUnit) - } - ) - -) \ No newline at end of file diff --git a/R/ISOUnlimitedInteger.R b/R/ISOUnlimitedInteger.R index 8b80ea03..6bc7c04c 100644 --- a/R/ISOUnlimitedInteger.R +++ b/R/ISOUnlimitedInteger.R @@ -24,7 +24,7 @@ #' @author Emmanuel Blondel #' ISOUnlimitedInteger <- R6Class("ISOUnlimitedInteger", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "UnlimitedInteger", xmlNamespacePrefix = "GCO" @@ -33,11 +33,7 @@ ISOUnlimitedInteger <- R6Class("ISOUnlimitedInteger", value = NA, attrs = list(), initialize = function(xml = NULL, value){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) if(is.null(xml)){ if(!is(value, "integer") & !is.infinite(value)){ value <- as.integer(value) diff --git a/R/ISOUomAngle.R b/R/ISOUomAngle.R deleted file mode 100644 index 142e44e9..00000000 --- a/R/ISOUomAngle.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomAngle -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure angle -#' @return Object of \code{\link{R6Class}} for modelling an ISOUomAngle -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml)}}{ -#' This method is used to instantiate an ISOUomAngle -#' } -#' } -#' -#' @examples -#' uom <- ISOUomAngle$new() -#' uom$setUomName("Degrees") -#' uom$setUomSymbol("deg") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomAngle <- R6Class("ISOUomAngle", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomAngle", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "angle") - } - ) -) \ No newline at end of file diff --git a/R/ISOUomArea.R b/R/ISOUomArea.R deleted file mode 100644 index 6003a40f..00000000 --- a/R/ISOUomArea.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomArea -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure area -#' @return Object of \code{\link{R6Class}} for modelling an ISOUomArea -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml)}}{ -#' This method is used to instantiate an ISOUomArea -#' } -#' } -#' -#' @examples -#' uom <- ISOUomArea$new() -#' uom$setUomName("Square meters") -#' uom$setUomSymbol("sqm") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomArea <- R6Class("ISOUomArea", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomArea", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "area") - } - ) -) \ No newline at end of file diff --git a/R/ISOUomCurrency.R b/R/ISOUomCurrency.R deleted file mode 100644 index 8c6b8dc2..00000000 --- a/R/ISOUomCurrency.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomCurrency -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure currency -#' @return Object of \code{\link{R6Class}} for modelling an ISOUomCurrency -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml)}}{ -#' This method is used to instantiate an ISOUomCurrency -#' } -#' } -#' -#' @examples -#' uom <- ISOUomCurrency$new() -#' uom$setUomName("Dollar") -#' uom$setUomSymbol("$") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomCurrency <- R6Class("ISOUomCurrency", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomCurrency", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "currency") - } - ) -) \ No newline at end of file diff --git a/R/ISOUomLength.R b/R/ISOUomLength.R deleted file mode 100644 index fe012ac0..00000000 --- a/R/ISOUomLength.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomLength -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure length -#' @return Object of \code{\link{R6Class}} for modelling an ISO UomLength -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml)}}{ -#' This method is used to instantiate an ISOUomLength -#' } -#' } -#' -#' @examples -#' uom <- ISOUomLength$new() -#' uom$setUomName("Meter") -#' uom$setUomSymbol("m") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomLength <- R6Class("ISOUomLength", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomLength", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "length") - } - ) -) \ No newline at end of file diff --git a/R/ISOUomScale.R b/R/ISOUomScale.R deleted file mode 100644 index e7e6ba1e..00000000 --- a/R/ISOUomScale.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomScale -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure scale -#' @return Object of \code{\link{R6Class}} for modelling an ISOUomScale -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml,value)}}{ -#' This method is used to instantiate an ISOUomScale -#' } -#' } -#' -#' @examples -#' uom <- ISOUomScale$new() -#' uom$setUomName("scaleunit") -#' uom$setUomSymbol("scale") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomScale <- R6Class("ISOUomScale", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomScale", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "scale") - } - ) -) \ No newline at end of file diff --git a/R/ISOUomTime.R b/R/ISOUomTime.R deleted file mode 100644 index 5c4a63cc..00000000 --- a/R/ISOUomTime.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomTime -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure time -#' @return Object of \code{\link{R6Class}} for modelling an ISOUomTime -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml)}}{ -#' This method is used to instantiate an ISOUomTime -#' } -#' } -#' -#' @examples -#' uom <- ISOUomTime$new() -#' uom$setUomName("Hours") -#' uom$setUomSymbol("h") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomTime <- R6Class("ISOUomTime", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomTime", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "time") - } - ) -) \ No newline at end of file diff --git a/R/ISOUomVelocity.R b/R/ISOUomVelocity.R deleted file mode 100644 index d2eaf1ff..00000000 --- a/R/ISOUomVelocity.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomVelocity -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure velocity -#' @return Object of \code{\link{R6Class}} for modelling an ISOUomVelocity -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml)}}{ -#' This method is used to instantiate an ISOUomVelocity -#' } -#' } -#' -#' @examples -#' uom <- ISOUomVelocity$new() -#' uom$setUomName("meters per second") -#' uom$setUomSymbol("m/s") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomVelocity <- R6Class("ISOUomVelocity", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomVelocity", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "velocity") - } - ) -) \ No newline at end of file diff --git a/R/ISOUomVolume.R b/R/ISOUomVolume.R deleted file mode 100644 index 72f5c91c..00000000 --- a/R/ISOUomVolume.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomVolume -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure volume -#' @return Object of \code{\link{R6Class}} for modelling an ISOUomVolume -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml)}}{ -#' This method is used to instantiate an ISOUomVolume -#' } -#' } -#' -#' @examples -#' uom <- ISOUomVolume$new() -#' uom$setUomName("cubic meters") -#' uom$setUomSymbol("m3") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomVolume <- R6Class("ISOUomVolume", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomVolume", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "volume") - } - ) -) \ No newline at end of file diff --git a/R/ISOUomWeight.R b/R/ISOUomWeight.R deleted file mode 100644 index e076a062..00000000 --- a/R/ISOUomWeight.R +++ /dev/null @@ -1,40 +0,0 @@ -#' ISOUomWeight -#' -#' @docType class -#' @importFrom R6 R6Class -#' @export -#' @keywords ISO unit measure weight -#' @return Object of \code{\link{R6Class}} for modelling an ISOUomWeight -#' @format \code{\link{R6Class}} object. -#' -#' -#' @section Methods: -#' \describe{ -#' \item{\code{new(xml)}}{ -#' This method is used to instantiate an ISOUomWeight -#' } -#' } -#' -#' @examples -#' uom <- ISOUomWeight$new() -#' uom$setUomName("grams") -#' uom$setUomSymbol("g") -#' xml <- uom$encode() -#' -#' @references -#' ISO/TS 19103:2005 Geographic information -- Conceptual schema language -#' -#' @author Emmanuel Blondel -#' -ISOUomWeight <- R6Class("ISOUomWeight", - inherit = ISOUnitOfMeasure, - private = list( - xmlElement = "UomWeight", - xmlNamespacePrefix = "GCO" - ), - public = list( - initialize = function(xml = NULL){ - super$initialize(xml = xml, measureType = "weight") - } - ) -) \ No newline at end of file diff --git a/R/ISOVectorSpatialRepresentation.R b/R/ISOVectorSpatialRepresentation.R index b56c4a2e..54521e42 100644 --- a/R/ISOVectorSpatialRepresentation.R +++ b/R/ISOVectorSpatialRepresentation.R @@ -55,11 +55,7 @@ ISOVectorSpatialRepresentation <- R6Class("ISOVectorSpatialRepresentation", #+ geometricObjects [0..*]: ISOGeometricObjects geometricObjects = list(), initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setTopologyLevel diff --git a/R/ISOVerticalExtent.R b/R/ISOVerticalExtent.R index ed250028..f860478a 100644 --- a/R/ISOVerticalExtent.R +++ b/R/ISOVerticalExtent.R @@ -18,10 +18,6 @@ #' ve <- ISOVerticalExtent$new() #' ve$setMinimumValue(0) #' ve$setMaximumValue(19) -#' uom <- ISOUomLength$new() -#' uom$setUomName("Meter") -#' uom$setUomSymbol("m") -#' ve$setUnitOfMeasure(uom) #' xml <- ve$encode() #' #' @references @@ -30,7 +26,7 @@ #' @author Emmanuel Blondel #' ISOVerticalExtent <- R6Class("ISOVerticalExtent", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "EX_VerticalExtent", xmlNamespacePrefix = "GMD" @@ -44,11 +40,7 @@ ISOVerticalExtent <- R6Class("ISOVerticalExtent", unitOfMeasure = NULL, #+ verticalCRS [1..1]: TODO initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setMinimumValue @@ -63,8 +55,8 @@ ISOVerticalExtent <- R6Class("ISOVerticalExtent", #setUnitOfMeasure setUnitOfMeasure = function(unitOfMeasure){ - if(!is(unitOfMeasure, "ISOUomLength")){ - stop("The unit of measure should be an object of class 'ISOUomLength") + if(!is(unitOfMeasure, "GMLUnitDefinition")){ + stop("The unit of measure should be an object of class 'GMLUnitDefinition") } self$unitOfMeasure = unitOfMeasure } diff --git a/R/ISoDefinitionReference.R b/R/ISoDefinitionReference.R index 113e6723..22cca5db 100644 --- a/R/ISoDefinitionReference.R +++ b/R/ISoDefinitionReference.R @@ -30,7 +30,7 @@ #' @author Emmanuel Blondel #' ISODefinitionReference <- R6Class("ISODefinitionReference", - inherit = ISOMetadataElement, + inherit = ISOAbstractObject, private = list( xmlElement = "FC_DefinitionReference", xmlNamespacePrefix = "GFC" @@ -43,11 +43,7 @@ ISODefinitionReference <- R6Class("ISODefinitionReference", definitionSource = NULL, initialize = function(xml = NULL){ - super$initialize( - xml = xml, - element = private$xmlElement, - namespace = getISOMetadataNamespace(private$xmlNamespacePrefix) - ) + super$initialize(xml = xml) }, #setSourceIdentifier diff --git a/R/geometa.R b/R/geometa.R index 18cfb746..3061ff6f 100644 --- a/R/geometa.R +++ b/R/geometa.R @@ -5,13 +5,14 @@ #' #' @title Tools for Reading and Writing ISO/OGC Geographic Metadata #' @description Provides facilities to handle reading and writing of geographic metadata -#' defined with OGC/ISO 19115 and 19139 (XML) standards. +#' defined with OGC/ISO 19115 and 19110 geographic information metadata standards, and +#' encoded using the ISO 19139 (XML) standard. #' @details #' \tabular{ll}{ #' Package: \tab geometa\cr #' Type: \tab Package\cr #' Version: \tab 0.2-0\cr -#' Date: \tab 2017-06-16\cr +#' Date: \tab 2017-06-20\cr #' License: \tab MIT\cr #' LazyLoad: \tab yes\cr #' } diff --git a/man/GMLAbstractGML.Rd b/man/GMLAbstractGML.Rd new file mode 100644 index 00000000..e72e9fa8 --- /dev/null +++ b/man/GMLAbstractGML.Rd @@ -0,0 +1,60 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLAbstractGML.R +\docType{class} +\name{GMLAbstractGML} +\alias{GMLAbstractGML} +\title{GMLAbstractGML} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLAbstractGML +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML abstract GML +} +\description{ +GMLAbstractGML +} +\section{Fields}{ + +\describe{ +\item{\code{descriptionReference}}{} + +\item{\code{identifier}}{} + +\item{\code{name}}{} +}} +\note{ +Class used internally by geometa +} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, element, attrs, defaults)}}{ + This method is used to instantiate a GML abstract GML + } + \item{\code{setDescriptionReference(descriptionReference)}}{ + Set the descriptionReference + } + \item{\code{setIdentifier(identifier)}}{ + Set the identifier + } + \item{\code{addName(name)}}{ + Adds a name + } + \item{\code{delName(name)}}{ + Deletes a name + } +} +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} + diff --git a/man/GMLAbstractObject.Rd b/man/GMLAbstractObject.Rd new file mode 100644 index 00000000..9cd72afb --- /dev/null +++ b/man/GMLAbstractObject.Rd @@ -0,0 +1,39 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLAbstractObject.R +\docType{class} +\name{GMLAbstractObject} +\alias{GMLAbstractObject} +\title{GMLAbstractObject} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLAbstractObject +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML abstract object +} +\description{ +GMLAbstractObject +} +\note{ +Class used internally by geometa +} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, element, attrs, defaults)}}{ + This method is used to instantiate an ISOTemporalPrimitive + } +} +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} + diff --git a/man/GMLTemporalPrimitive.Rd b/man/GMLAbstractTimeGeometricPrimitive.Rd similarity index 61% rename from man/GMLTemporalPrimitive.Rd rename to man/GMLAbstractTimeGeometricPrimitive.Rd index ea03a4d7..1d6fc0b6 100644 --- a/man/GMLTemporalPrimitive.Rd +++ b/man/GMLAbstractTimeGeometricPrimitive.Rd @@ -1,18 +1,18 @@ % Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/GMLTemporalPrimitive.R +% Please edit documentation in R/GMLAbstractTimeGeometricPrimitive.R \docType{class} -\name{GMLTemporalPrimitive} -\alias{GMLTemporalPrimitive} -\title{GMLTemporalPrimitive} +\name{GMLAbstractTimeGeometricPrimitive} +\alias{GMLAbstractTimeGeometricPrimitive} +\title{GMLAbstractTimeGeometricPrimitive} \format{\code{\link{R6Class}} object.} \usage{ -GMLTemporalPrimitive +GMLAbstractTimeGeometricPrimitive } \value{ Object of \code{\link{R6Class}} for modelling an ISO GML abstract temporal primitive } \description{ -GMLTemporalPrimitive +GMLAbstractTimeGeometricPrimitive } \note{ Class used internally by geometa @@ -21,7 +21,7 @@ Class used internally by geometa \describe{ \item{\code{new(xml, element, namespace, defaults)}}{ - This method is used to instantiate an ISOTemporalPrimitive + This method is used to instantiate an ISOAbstractTimeGeometricPrimitive } } } diff --git a/man/GMLAbstractTimeObject.Rd b/man/GMLAbstractTimeObject.Rd new file mode 100644 index 00000000..0be7eab6 --- /dev/null +++ b/man/GMLAbstractTimeObject.Rd @@ -0,0 +1,53 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLAbstractTimeObject.R +\docType{class} +\name{GMLAbstractTimeObject} +\alias{GMLAbstractTimeObject} +\title{GMLAbstractTimeObject} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLAbstractTimeObject +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML AbstractTimeObject +} +\description{ +GMLAbstractTimeObject +} +\section{Fields}{ + +\describe{ +\item{\code{remarks}}{} +}} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, defaults)}}{ + This method is used to instantiate a GML AbstractTimeObject + } + \item{\code{setId(id)}}{ + Sets the id + } + \item{\code{addRemark(remark)}}{ + Adds a remark + } + \item{\code{delRemark(remark)}}{ + Deletes a remark + } +} +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} +\keyword{abstract} +\keyword{object} +\keyword{time} + diff --git a/man/GMLAbstractTimePrimitive.Rd b/man/GMLAbstractTimePrimitive.Rd new file mode 100644 index 00000000..2c113b0a --- /dev/null +++ b/man/GMLAbstractTimePrimitive.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLAbstractTimePrimitive.R +\docType{class} +\name{GMLAbstractTimePrimitive} +\alias{GMLAbstractTimePrimitive} +\title{GMLAbstractTimePrimitive} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLAbstractTimePrimitive +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML AbstractTimePrimitive +} +\description{ +GMLAbstractTimePrimitive +} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, defaults)}}{ + This method is used to instantiate a GML AbstractTimePrimitive + } + \item{\code{setId(id)}}{ + Sets the id + } + \item{\code{addRelatedTime(time)}}{ + Adds related time, object of class among \code{GMLTimeInstant}, \code{GMLTimePeriod}, + \code{GMLTimeNode} or \code{GMLTimeEdge} + } + \item{\code{delRelatedTime(time)}}{ + Deletes related time + } +} +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} +\keyword{abstract} +\keyword{primitive} +\keyword{time} + diff --git a/man/GMLBaseUnit.Rd b/man/GMLBaseUnit.Rd new file mode 100644 index 00000000..a0a053f7 --- /dev/null +++ b/man/GMLBaseUnit.Rd @@ -0,0 +1,57 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLBaseUnit.R +\docType{class} +\name{GMLBaseUnit} +\alias{GMLBaseUnit} +\title{GMLBaseUnit} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLBaseUnit +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML base unit +} +\description{ +GMLBaseUnit +} +\section{Fields}{ + +\describe{ +\item{\code{unitsSystem}}{} +}} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, defaults, id)}}{ + This method is used to instantiate a GML Base Unit + } + \item{\code{setUnitsSystem(unitsSystem)}}{ + Set the unit system + } +} +} +\examples{ +gml <- GMLBaseUnit$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} +\keyword{base} +\keyword{definition} +\keyword{unit} + diff --git a/man/GMLConventionalUnit.Rd b/man/GMLConventionalUnit.Rd new file mode 100644 index 00000000..d6f08ed7 --- /dev/null +++ b/man/GMLConventionalUnit.Rd @@ -0,0 +1,69 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLConventionalUnit.R +\docType{class} +\name{GMLConventionalUnit} +\alias{GMLConventionalUnit} +\title{GMLConventionalUnit} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLConventionalUnit +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML derived unit +} +\description{ +GMLConventionalUnit +} +\section{Fields}{ + +\describe{ +\item{\code{conversionToPreferredUnit}}{} + +\item{\code{roughConversionToPreferredUnit}}{} + +\item{\code{derivationUnitTerm}}{} +}} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, defaults, id)}}{ + This method is used to instantiate a GML Base Unit + } + \item{\code{addDerivationUnitTerm(uom, exponent)}}{ + Adds a derivation unit term, made of a uom reference, and an exponent which + can be negative/positive but not equal to zero. + } + \item{\code{delDerivationUnitTerm(uom, exponent)}}{ + Deletes a derivation unit term + } + \item{\code{setConversionToPreferredUnit(uom, factor, rough)}}{ + Sets the conversion to preferred unit. \code{rough} is \code{FALSE} by default + } +} +} +\examples{ +gml <- GMLConventionalUnit$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$addDerivationUnitTerm("uomId", 2L) + gml$setConversionToPreferredUnit("uomId", 2L) +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} +\keyword{conventional} +\keyword{definition} +\keyword{unit} + diff --git a/man/GMLDefinition.Rd b/man/GMLDefinition.Rd new file mode 100644 index 00000000..f9e7a85a --- /dev/null +++ b/man/GMLDefinition.Rd @@ -0,0 +1,58 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLDefinition.R +\docType{class} +\name{GMLDefinition} +\alias{GMLDefinition} +\title{GMLDefinition} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLDefinition +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML definition +} +\description{ +GMLDefinition +} +\section{Fields}{ + +\describe{ +\item{\code{remarks}}{} +}} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, defaults)}}{ + This method is used to instantiate a GML Definition + } + \item{\code{setId(id)}}{ + Sets the id + } + \item{\code{addRemark(remark)}}{ + Adds a remark + } + \item{\code{delRemark(remark)}}{ + Deletes a remark + } +} +} +\examples{ +gml <- GMLDefinition$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} +\keyword{definition} + diff --git a/man/GMLDerivedUnit.Rd b/man/GMLDerivedUnit.Rd new file mode 100644 index 00000000..c8e98bae --- /dev/null +++ b/man/GMLDerivedUnit.Rd @@ -0,0 +1,60 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLDerivedUnit.R +\docType{class} +\name{GMLDerivedUnit} +\alias{GMLDerivedUnit} +\title{GMLDerivedUnit} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLDerivedUnit +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML derived unit +} +\description{ +GMLDerivedUnit +} +\section{Fields}{ + +\describe{ +\item{\code{derivationUnitTerm}}{} +}} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, defaults, id)}}{ + This method is used to instantiate a GML Base Unit + } + \item{\code{addDerivationUnitTerm(uom, exponent)}}{ + Adds a derivation unit term, made of a uom reference, and an exponent which + can be negative/positive but not equal to zero. + } + \item{\code{delDerivationUnitTerm(uom, exponent)}}{ + Deletes a derivation unit term + } +} +} +\examples{ +gml <- GMLDerivedUnit$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$addDerivationUnitTerm("uomId", 2L) +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} +\keyword{definition} +\keyword{derived} +\keyword{unit} + diff --git a/man/GMLElement.Rd b/man/GMLElement.Rd new file mode 100644 index 00000000..9fceff74 --- /dev/null +++ b/man/GMLElement.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLElement.R +\docType{class} +\name{GMLElement} +\alias{GMLElement} +\title{GMLElement} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLElement +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML element +} +\description{ +GMLElement +} +\note{ +Class used by geometa internal XML decoder/encoder +} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, element, attrs, defaults)}}{ + This method is used to instantiate a GML element + } +} +} +\author{ +Emmanuel Blondel +} +\references{ +ISO/TS 19103:2005 Geographic information -- Conceptual schema language +} +\keyword{GML} +\keyword{ISO} +\keyword{element} + diff --git a/man/GMLUnitDefinition.Rd b/man/GMLUnitDefinition.Rd new file mode 100644 index 00000000..c95feb3d --- /dev/null +++ b/man/GMLUnitDefinition.Rd @@ -0,0 +1,61 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/GMLUnitDefinition.R +\docType{class} +\name{GMLUnitDefinition} +\alias{GMLUnitDefinition} +\title{GMLUnitDefinition} +\format{\code{\link{R6Class}} object.} +\usage{ +GMLUnitDefinition +} +\value{ +Object of \code{\link{R6Class}} for modelling an GML unit definition +} +\description{ +GMLUnitDefinition +} +\section{Fields}{ + +\describe{ +\item{\code{quantityTypeReference}}{} + +\item{\code{catalogSymbol}}{} +}} +\section{Methods}{ + +\describe{ + \item{\code{new(xml, defaults, id)}}{ + This method is used to instantiate a GML Definition + } + \item{\code{setQuantityTypeReference(ref)}}{ + Set the quantity type reference. The content is a reference to a remote value + } + \item{\code{setCatalogSymbol(symbol)}}{ + Sets the preferred lexical symbol used for this unit of measure + + } +} +} +\examples{ +gml <- GMLUnitDefinition$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19136:2007 Geographic Information -- Geographic Markup Language. + http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=32554 + + OGC Geography Markup Language. http://www.opengeospatial.org/standards/gml +} +\keyword{GML} +\keyword{ISO} +\keyword{definition} +\keyword{unit} + diff --git a/man/ISOMetadataElement.Rd b/man/ISOAbstractObject.Rd similarity index 79% rename from man/ISOMetadataElement.Rd rename to man/ISOAbstractObject.Rd index fa265c0e..1a43a8d9 100644 --- a/man/ISOMetadataElement.Rd +++ b/man/ISOAbstractObject.Rd @@ -1,18 +1,18 @@ % Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOMetadataElement.R +% Please edit documentation in R/ISOAbstractObject.R \docType{class} -\name{ISOMetadataElement} -\alias{ISOMetadataElement} -\title{ISOMetadataElement} +\name{ISOAbstractObject} +\alias{ISOAbstractObject} +\title{ISOAbstractObject} \format{\code{\link{R6Class}} object.} \usage{ -ISOMetadataElement +ISOAbstractObject } \value{ Object of \code{\link{R6Class}} for modelling an ISO Metadata Element } \description{ -ISOMetadataElement +ISOAbstractObject } \note{ Abstract ISO Metadata class used internally by geometa @@ -35,8 +35,8 @@ Abstract ISO Metadata class used internally by geometa \section{Abstract Methods}{ \describe{ - \item{\code{new(xml, element, namespace)}}{ - This method is used to instantiate an ISOMetadataElement + \item{\code{new(xml, element, namespace, defaults, attrs)}}{ + This method is used to instantiate an ISOAbstractObject } \item{\code{INFO(text)}}{ Logger to report information. Used internally @@ -88,6 +88,27 @@ Abstract ISO Metadata class used internally by geometa has been deleted, FALSE otherwise. In case an element is abstent, this method will return FALSE. } + \item{\code{setAttr(attrKey, attrValue)}}{ + Set an attribute + } + \item{\code{setId(id, addNS)}}{ + Set an id. By default \code{addNS} is \code{FALSE} (no namespace prefix added). + } + \item{\code{setHref(href)}}{ + Sets an href reference + } + \item{\code{setCodeList(codeList)}}{ + Sets a codeList + } + \item{\code{setCodeListValue(codeListValue)}}{ + Sets a codeList value + } + \item{\code{setCodeSpace(codeSpace)}}{ + Set a codeSpace + } + \item{\code{setValue(value)}}{ + Set a value + } } } \author{ diff --git a/man/ISOBand.Rd b/man/ISOBand.Rd index 52312f9f..e4596ad6 100644 --- a/man/ISOBand.Rd +++ b/man/ISOBand.Rd @@ -46,7 +46,7 @@ ISOBand Sets the minimum value } \item{\code{setUnits(units)}}{ - Sets the unit, object of class \code{ISOUomLength} + Sets the unit, object of class \code{GMLUnitDefinition} } \item{\code{setPeakResponse(peakResponse)}}{ Sets the peak response @@ -72,10 +72,15 @@ ISOBand md$setDescriptor("descriptor") md$setMaxValue(10) md$setMinValue(1) - uom = ISOUomLength$new() - uom$setUomName("var") - uom$setUomSymbol("symbol") - md$setUnits(uom) + gml <- GMLBaseUnit$new(id = "ID") + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + md$setUnits(gml) md$setPeakResponse(9) md$setBitsPerValue(5) md$setToneGradation(100) diff --git a/man/ISOBaseTimeBeginPosition.Rd b/man/ISOBaseTimeBeginPosition.Rd deleted file mode 100644 index a4f3c54c..00000000 --- a/man/ISOBaseTimeBeginPosition.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOBaseTimeBeginPosition.R -\docType{class} -\name{ISOBaseTimeBeginPosition} -\alias{ISOBaseTimeBeginPosition} -\title{ISOBaseTimeBeginPosition} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOBaseTimeBeginPosition -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISO Time begin position -} -\description{ -ISOBaseTimeBeginPosition -} -\section{Fields}{ - -\describe{ -\item{\code{value}}{} -}} -\note{ -Class used by geometa internal XML decoder/encoder -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml,value)}}{ - This method is used to instantiate an ISOBaseTimeBeginPosition - } -} -} -\author{ -Emmanuel Blondel -} -\keyword{ISO} -\keyword{begin} -\keyword{position} - diff --git a/man/ISOBaseTimeEndPosition.Rd b/man/ISOBaseTimeEndPosition.Rd deleted file mode 100644 index e60f404d..00000000 --- a/man/ISOBaseTimeEndPosition.Rd +++ /dev/null @@ -1,39 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOBaseTimeEndPosition.R -\docType{class} -\name{ISOBaseTimeEndPosition} -\alias{ISOBaseTimeEndPosition} -\title{ISOBaseTimeEndPosition} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOBaseTimeEndPosition -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISO Time end position -} -\description{ -ISOBaseTimeEndPosition -} -\section{Fields}{ - -\describe{ -\item{\code{value}}{} -}} -\note{ -Class used by geometa internal XML decoder/encoder -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml,value)}}{ - This method is used to instantiate an ISOBaseTimeEndPosition - } -} -} -\author{ -Emmanuel Blondel -} -\keyword{ISO} -\keyword{end} -\keyword{position} - diff --git a/man/ISOMetadataCodelistElement.Rd b/man/ISOCodeListValue.Rd similarity index 77% rename from man/ISOMetadataCodelistElement.Rd rename to man/ISOCodeListValue.Rd index 4a5f55be..6a3e030d 100644 --- a/man/ISOMetadataCodelistElement.Rd +++ b/man/ISOCodeListValue.Rd @@ -1,18 +1,18 @@ % Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOMetadataCodelistElement.R +% Please edit documentation in R/ISOCodeListValue.R \docType{class} -\name{ISOMetadataCodelistElement} -\alias{ISOMetadataCodelistElement} -\title{ISOMetadataCodelistElement} +\name{ISOCodeListValue} +\alias{ISOCodeListValue} +\title{ISOCodeListValue} \format{\code{\link{R6Class}} object.} \usage{ -ISOMetadataCodelistElement +ISOCodeListValue } \value{ Object of \code{\link{R6Class}} for modelling an ISO Metadata codelist element } \description{ -ISOMetadataCodelistElement +ISOCodeListValue } \section{Fields}{ @@ -26,7 +26,7 @@ Abstract ISO codelist class used internally by geometa \describe{ \item{\code{new(xml, id, value, addCodeListAttrs, addCodeSpaceAttr, setValue)}}{ - This method is used to instantiate an ISOMetadataCodelistElement. By default, + This method is used to instantiate an ISOCodeListValue. By default, \code{addCodeListAttrs = TRUE}, to add codelist atributes to root XML. The parameter \code{addCodeSpaceAttr = TRUE} by default, and ignored if the valueof \code{addCodeLisAttrs} is set to \code{FALSE}. The argument \code{setValue} diff --git a/man/ISOContentInformation.Rd b/man/ISOContentInformation.Rd index 9f2f2471..40cb540f 100644 --- a/man/ISOContentInformation.Rd +++ b/man/ISOContentInformation.Rd @@ -20,7 +20,7 @@ Abstract class. Used internally by \pkg{geometa} \section{Abstract Methods}{ \describe{ - \item{\code{new(xml, element, namespace)}}{ + \item{\code{new(xml)}}{ This method is used to instantiate an ISOContentInformation } } diff --git a/man/ISOCoverageDescription.Rd b/man/ISOCoverageDescription.Rd index c9f02530..6f414b3c 100644 --- a/man/ISOCoverageDescription.Rd +++ b/man/ISOCoverageDescription.Rd @@ -59,10 +59,15 @@ ISOCoverageDescription band$setDescriptor("descriptor") band$setMaxValue(10) band$setMinValue(1) - uom = ISOUomLength$new() - uom$setUomName("var") - uom$setUomSymbol("symbol") - band$setUnits(uom) + gml <- GMLBaseUnit$new(id = sprintf("ID\%s",i)) + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + band$setUnits(gml) band$setPeakResponse(9) band$setBitsPerValue(5) band$setToneGradation(100) diff --git a/man/ISODistribution.Rd b/man/ISODistribution.Rd index 2cf54f7a..528fd0ca 100644 --- a/man/ISODistribution.Rd +++ b/man/ISODistribution.Rd @@ -22,7 +22,7 @@ ISODistribution \section{Methods}{ \describe{ - \item{\code{new(xml,value)}}{ + \item{\code{new(xml)}}{ This method is used to instantiate an ISODistribution } \item{\code{setDigitalTransferOptions(options)}}{ diff --git a/man/ISOFeatureAttribute.Rd b/man/ISOFeatureAttribute.Rd index fd0018e1..91bee010 100644 --- a/man/ISOFeatureAttribute.Rd +++ b/man/ISOFeatureAttribute.Rd @@ -35,7 +35,7 @@ ISOFeatureAttribute Sets the code } \item{\code{setValueMeasurementUnit(uom)}}{ - Sets the value measurement unit + Sets the value measurement unit, an object of class \code{GMLUnitDefinition} } \item{\code{addListedValue(value)}}{ Adds a listed value (object of class \code{ISOListedValue}) @@ -55,10 +55,15 @@ md <- ISOFeatureAttribute$new() md$setCardinality(lower=1,upper=1) md$setCode("code") - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - md$setValueMeasurementUnit(uom) + gml <- GMLBaseUnit$new(id = "ID") + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + md$setValueMeasurementUnit(gml) val1 <- ISOListedValue$new() val1$setCode("code1") diff --git a/man/ISOFeatureCatalogue.Rd b/man/ISOFeatureCatalogue.Rd index 3b224ad5..9dd038ee 100644 --- a/man/ISOFeatureCatalogue.Rd +++ b/man/ISOFeatureCatalogue.Rd @@ -104,11 +104,15 @@ fc <- ISOFeatureCatalogue$new() fat$setCardinality(lower=1,upper=1) fat$setCode(sprintf("code \%s",i)) - #add measurement unit - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - fat$setValueMeasurementUnit(uom) + gml <- GMLBaseUnit$new(id = sprintf("ID\%s",i)) + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + fat$setValueMeasurementUnit(gml) #add listed values val1 <- ISOListedValue$new() diff --git a/man/ISOFeatureType.Rd b/man/ISOFeatureType.Rd index f25406b2..7f52adca 100644 --- a/man/ISOFeatureType.Rd +++ b/man/ISOFeatureType.Rd @@ -103,10 +103,15 @@ ISOFeatureType fat$setCode(sprintf("code \%s",i)) #add measurement unit - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - fat$setValueMeasurementUnit(uom) + gml <- GMLBaseUnit$new(id = "ID\%") + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + fat$setValueMeasurementUnit(gml) #add listed values val1 <- ISOListedValue$new() diff --git a/man/ISOGeographicExtent.Rd b/man/ISOGeographicExtent.Rd index ac833085..f52b9625 100644 --- a/man/ISOGeographicExtent.Rd +++ b/man/ISOGeographicExtent.Rd @@ -25,7 +25,7 @@ abstract class \section{Methods}{ \describe{ - \item{\code{new(xml, element, namespace, defaults)}}{ + \item{\code{new(xml, defaults)}}{ This method is used to instantiate an ISOGeographicExtent } } diff --git a/man/ISOIdentifier.Rd b/man/ISOIdentifier.Rd index 04a997ad..6cd74996 100644 --- a/man/ISOIdentifier.Rd +++ b/man/ISOIdentifier.Rd @@ -27,7 +27,7 @@ Abstract ISO class \section{Methods}{ \describe{ - \item{\code{new(xml, prefix, code, codeSpace)}}{ + \item{\code{new(xml, code, codeSpace)}}{ This method is used to instantiate an ISOIdentifier } \item{\code{setAuthority(authority)}}{ diff --git a/man/ISOMetadata.Rd b/man/ISOMetadata.Rd index cbbc61df..ba3b82fa 100644 --- a/man/ISOMetadata.Rd +++ b/man/ISOMetadata.Rd @@ -3,16 +3,16 @@ \docType{class} \name{ISOMetadata} \alias{ISOMetadata} -\title{ISOMetadataElement} +\title{ISOMetadata} \format{\code{\link{R6Class}} object.} \usage{ ISOMetadata } \value{ -Object of \code{\link{R6Class}} for modelling an ISO Metadata Element +Object of \code{\link{R6Class}} for modelling an ISO Metadata } \description{ -ISOMetadataElement +ISOMetadata } \section{Fields}{ diff --git a/man/ISOPropertyType.Rd b/man/ISOPropertyType.Rd index ece556af..61416614 100644 --- a/man/ISOPropertyType.Rd +++ b/man/ISOPropertyType.Rd @@ -32,7 +32,7 @@ ISOPropertyType \section{Methods}{ \describe{ - \item{\code{new(xml, element, namespace, defaults)}}{ + \item{\code{new(xml, defaults)}}{ This method is used to instantiate an ISOPropertyType } \item{\code{setMemberName(memberName)}}{ diff --git a/man/ISORangeDimension.Rd b/man/ISORangeDimension.Rd index 10bb390b..47475375 100644 --- a/man/ISORangeDimension.Rd +++ b/man/ISORangeDimension.Rd @@ -24,7 +24,7 @@ ISORangeDimension \section{Methods}{ \describe{ - \item{\code{new(xml, element, namespace)}}{ + \item{\code{new(xml)}}{ This method is used to instantiate an ISORangeDimension } \item{\code{setSequenceIdentifier(memberName)}}{ diff --git a/man/ISOUnitOfMeasure.Rd b/man/ISOUnitOfMeasure.Rd deleted file mode 100644 index b5eb8e22..00000000 --- a/man/ISOUnitOfMeasure.Rd +++ /dev/null @@ -1,52 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUnitOfMeasure.R -\docType{class} -\name{ISOUnitOfMeasure} -\alias{ISOUnitOfMeasure} -\title{ISOUnitOfMeasure} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUnitOfMeasure -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISO abstract UnitOfMeasure -} -\description{ -ISOUnitOfMeasure -} -\section{Fields}{ - -\describe{ -\item{\code{uomName}}{} - -\item{\code{uomSymbol}}{} - -\item{\code{measureType}}{} - -\item{\code{nameStandardUnit}}{} - -\item{\code{scaleToStandardUnit}}{} - -\item{\code{offsetToStandardUnit}}{} - -\item{\code{formula}}{} -}} -\note{ -Abstract ISO class used internally by geometa -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml,value)}}{ - This method is used to instantiate an ISOUnitOfMeasure - } -} -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} - diff --git a/man/ISOUomAngle.Rd b/man/ISOUomAngle.Rd deleted file mode 100644 index f8d55e9a..00000000 --- a/man/ISOUomAngle.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomAngle.R -\docType{class} -\name{ISOUomAngle} -\alias{ISOUomAngle} -\title{ISOUomAngle} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomAngle -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISOUomAngle -} -\description{ -ISOUomAngle -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml)}}{ - This method is used to instantiate an ISOUomAngle - } -} -} -\examples{ -uom <- ISOUomAngle$new() - uom$setUomName("Degrees") - uom$setUomSymbol("deg") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{angle} -\keyword{measure} -\keyword{unit} - diff --git a/man/ISOUomArea.Rd b/man/ISOUomArea.Rd deleted file mode 100644 index d3df9585..00000000 --- a/man/ISOUomArea.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomArea.R -\docType{class} -\name{ISOUomArea} -\alias{ISOUomArea} -\title{ISOUomArea} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomArea -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISOUomArea -} -\description{ -ISOUomArea -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml)}}{ - This method is used to instantiate an ISOUomArea - } -} -} -\examples{ -uom <- ISOUomArea$new() - uom$setUomName("Square meters") - uom$setUomSymbol("sqm") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{area} -\keyword{measure} -\keyword{unit} - diff --git a/man/ISOUomCurrency.Rd b/man/ISOUomCurrency.Rd deleted file mode 100644 index e5b2cfa7..00000000 --- a/man/ISOUomCurrency.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomCurrency.R -\docType{class} -\name{ISOUomCurrency} -\alias{ISOUomCurrency} -\title{ISOUomCurrency} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomCurrency -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISOUomCurrency -} -\description{ -ISOUomCurrency -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml)}}{ - This method is used to instantiate an ISOUomCurrency - } -} -} -\examples{ -uom <- ISOUomCurrency$new() - uom$setUomName("Dollar") - uom$setUomSymbol("$") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{currency} -\keyword{measure} -\keyword{unit} - diff --git a/man/ISOUomLength.Rd b/man/ISOUomLength.Rd deleted file mode 100644 index c6e13795..00000000 --- a/man/ISOUomLength.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomLength.R -\docType{class} -\name{ISOUomLength} -\alias{ISOUomLength} -\title{ISOUomLength} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomLength -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISO UomLength -} -\description{ -ISOUomLength -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml)}}{ - This method is used to instantiate an ISOUomLength - } -} -} -\examples{ -uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{length} -\keyword{measure} -\keyword{unit} - diff --git a/man/ISOUomScale.Rd b/man/ISOUomScale.Rd deleted file mode 100644 index 1c11fc21..00000000 --- a/man/ISOUomScale.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomScale.R -\docType{class} -\name{ISOUomScale} -\alias{ISOUomScale} -\title{ISOUomScale} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomScale -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISOUomScale -} -\description{ -ISOUomScale -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml,value)}}{ - This method is used to instantiate an ISOUomScale - } -} -} -\examples{ -uom <- ISOUomScale$new() - uom$setUomName("scaleunit") - uom$setUomSymbol("scale") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{measure} -\keyword{scale} -\keyword{unit} - diff --git a/man/ISOUomTime.Rd b/man/ISOUomTime.Rd deleted file mode 100644 index 7ae8608d..00000000 --- a/man/ISOUomTime.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomTime.R -\docType{class} -\name{ISOUomTime} -\alias{ISOUomTime} -\title{ISOUomTime} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomTime -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISOUomTime -} -\description{ -ISOUomTime -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml)}}{ - This method is used to instantiate an ISOUomTime - } -} -} -\examples{ -uom <- ISOUomTime$new() - uom$setUomName("Hours") - uom$setUomSymbol("h") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{measure} -\keyword{time} -\keyword{unit} - diff --git a/man/ISOUomVelocity.Rd b/man/ISOUomVelocity.Rd deleted file mode 100644 index eda3a5d8..00000000 --- a/man/ISOUomVelocity.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomVelocity.R -\docType{class} -\name{ISOUomVelocity} -\alias{ISOUomVelocity} -\title{ISOUomVelocity} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomVelocity -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISOUomVelocity -} -\description{ -ISOUomVelocity -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml)}}{ - This method is used to instantiate an ISOUomVelocity - } -} -} -\examples{ -uom <- ISOUomVelocity$new() - uom$setUomName("meters per second") - uom$setUomSymbol("m/s") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{measure} -\keyword{unit} -\keyword{velocity} - diff --git a/man/ISOUomVolume.Rd b/man/ISOUomVolume.Rd deleted file mode 100644 index 7f99dfc6..00000000 --- a/man/ISOUomVolume.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomVolume.R -\docType{class} -\name{ISOUomVolume} -\alias{ISOUomVolume} -\title{ISOUomVolume} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomVolume -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISOUomVolume -} -\description{ -ISOUomVolume -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml)}}{ - This method is used to instantiate an ISOUomVolume - } -} -} -\examples{ -uom <- ISOUomVolume$new() - uom$setUomName("cubic meters") - uom$setUomSymbol("m3") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{measure} -\keyword{unit} -\keyword{volume} - diff --git a/man/ISOUomWeight.Rd b/man/ISOUomWeight.Rd deleted file mode 100644 index f0f4d471..00000000 --- a/man/ISOUomWeight.Rd +++ /dev/null @@ -1,41 +0,0 @@ -% Generated by roxygen2 (4.1.1): do not edit by hand -% Please edit documentation in R/ISOUomWeight.R -\docType{class} -\name{ISOUomWeight} -\alias{ISOUomWeight} -\title{ISOUomWeight} -\format{\code{\link{R6Class}} object.} -\usage{ -ISOUomWeight -} -\value{ -Object of \code{\link{R6Class}} for modelling an ISOUomWeight -} -\description{ -ISOUomWeight -} -\section{Methods}{ - -\describe{ - \item{\code{new(xml)}}{ - This method is used to instantiate an ISOUomWeight - } -} -} -\examples{ -uom <- ISOUomWeight$new() - uom$setUomName("grams") - uom$setUomSymbol("g") - xml <- uom$encode() -} -\author{ -Emmanuel Blondel -} -\references{ -ISO/TS 19103:2005 Geographic information -- Conceptual schema language -} -\keyword{ISO} -\keyword{measure} -\keyword{unit} -\keyword{weight} - diff --git a/man/ISOVerticalExtent.Rd b/man/ISOVerticalExtent.Rd index 1fec2c04..954db840 100644 --- a/man/ISOVerticalExtent.Rd +++ b/man/ISOVerticalExtent.Rd @@ -26,10 +26,6 @@ ISOVerticalExtent ve <- ISOVerticalExtent$new() ve$setMinimumValue(0) ve$setMaximumValue(19) - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - ve$setUnitOfMeasure(uom) xml <- ve$encode() } \author{ diff --git a/man/geometa.Rd b/man/geometa.Rd index 22f36d5f..e375d0fe 100644 --- a/man/geometa.Rd +++ b/man/geometa.Rd @@ -7,14 +7,15 @@ \title{Tools for Reading and Writing ISO/OGC Geographic Metadata} \description{ Provides facilities to handle reading and writing of geographic metadata -defined with OGC/ISO 19115 and 19139 (XML) standards. +defined with OGC/ISO 19115 and 19110 geographic information metadata standards, and +encoded using the ISO 19139 (XML) standard. } \details{ \tabular{ll}{ Package: \tab geometa\cr Type: \tab Package\cr Version: \tab 0.2-0\cr - Date: \tab 2017-06-16\cr + Date: \tab 2017-06-20\cr License: \tab MIT\cr LazyLoad: \tab yes\cr } diff --git a/tests/testthat/test_GMLDefinition.R b/tests/testthat/test_GMLDefinition.R new file mode 100644 index 00000000..918d722d --- /dev/null +++ b/tests/testthat/test_GMLDefinition.R @@ -0,0 +1,30 @@ +# test_GMLDefinition.R +# Author: Emmanuel Blondel +# +# Description: Unit tests for GMLDefinition.R +#======================= +require(geometa, quietly = TRUE) +require(testthat) +require(XML) + +context("GMLDefinition") + +test_that("encoding",{ + + #encoding + gml <- GMLDefinition$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + + xml <- gml$encode() + expect_is(xml, "XMLInternalNode") + + #decoding + gml2 <- GMLDefinition$new(xml = xml) + xml2 <- gml2$encode() + + expect_true(ISOAbstractObject$compare(gml, gml2)) + +}) \ No newline at end of file diff --git a/tests/testthat/test_GMLElement.R b/tests/testthat/test_GMLElement.R new file mode 100644 index 00000000..19b582ae --- /dev/null +++ b/tests/testthat/test_GMLElement.R @@ -0,0 +1,36 @@ +# test_GMLElement.R +# Author: Emmanuel Blondel +# +# Description: Unit tests for GMLElement.R +#======================= +require(geometa, quietly = TRUE) +require(testthat) +require(XML) + +context("GMLElement") + +test_that("GML Element",{ + + #encoding + gml1 <- GMLElement$new(element = "tag1") + gml1$attrs <- list(attr1 = "value1", attr2 = "value2") + + gml2 <- GMLElement$new(element = "tag2") + gml2$attrs <- list(attr3 = "value3", attr4 = "value4") + + gml3 <- GMLElement$new(element = "tag3") + gml3$attrs <- list(attr5 = "value5", attr6 = "value6") + gml3$setValue("value") + gml2[["child"]] <- gml3 + gml1[["child"]] <- gml2 + + xml <- gml1$encode(validate = FALSE) + expect_is(xml, "XMLInternalNode") + + #decoding + gml1copy <- GMLElement$new(xml = xml) + xmlcopy <- gml1copy$encode(validate = FALSE) + + expect_true(ISOAbstractObject$compare(gml1, gml1copy)) + +}) diff --git a/tests/testthat/test_GMLTimePeriod.R b/tests/testthat/test_GMLTimePeriod.R index b888c7fa..430ddc4b 100644 --- a/tests/testthat/test_GMLTimePeriod.R +++ b/tests/testthat/test_GMLTimePeriod.R @@ -24,6 +24,6 @@ test_that("encoding",{ md2 <- GMLTimePeriod$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_GMLUnitDefinition.R b/tests/testthat/test_GMLUnitDefinition.R new file mode 100644 index 00000000..d8a032ad --- /dev/null +++ b/tests/testthat/test_GMLUnitDefinition.R @@ -0,0 +1,102 @@ +# test_GMLUnitDefinition.R +# Author: Emmanuel Blondel +# +# Description: Unit tests for GMLUnitDefinition.R +#======================= +require(geometa, quietly = TRUE) +require(testthat) +require(XML) + +context("GMLUnitDefinition") + +test_that("UnitDefinition",{ + + #encoding + gml <- GMLUnitDefinition$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + + xml <- gml$encode() + expect_is(xml, "XMLInternalNode") + + #decoding + gml2 <- GMLUnitDefinition$new(xml = xml) + xml2 <- gml2$encode() + + expect_true(ISOAbstractObject$compare(gml, gml2)) + +}) + +test_that("BaseUnit",{ + + #encoding + gml <- GMLBaseUnit$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + + xml <- gml$encode() + expect_is(xml, "XMLInternalNode") + + #decoding + gml2 <- GMLBaseUnit$new(xml = xml) + xml2 <- gml2$encode() + + expect_true(ISOAbstractObject$compare(gml, gml2)) + +}) + +test_that("DerivedUnit",{ + + #encoding + gml <- GMLDerivedUnit$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$addDerivationUnitTerm("uomId", 2L) + + xml <- gml$encode() + expect_is(xml, "XMLInternalNode") + + #decoding + gml2 <- GMLDerivedUnit$new(xml = xml) + xml2 <- gml2$encode() + + expect_true(ISOAbstractObject$compare(gml, gml2)) + +}) + +test_that("ConventionalUnit",{ + + #encoding + gml <- GMLConventionalUnit$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$addDerivationUnitTerm("uomId", 2L) + gml$setConversionToPreferredUnit("uomId", 2L) + + xml <- gml$encode() + expect_is(xml, "XMLInternalNode") + + #decoding + gml2 <- GMLConventionalUnit$new(xml = xml) + xml2 <- gml2$encode() + + expect_true(ISOAbstractObject$compare(gml, gml2)) + +}) \ No newline at end of file diff --git a/tests/testthat/test_ISOAddress.R b/tests/testthat/test_ISOAddress.R index 6214fcc6..496550c6 100644 --- a/tests/testthat/test_ISOAddress.R +++ b/tests/testthat/test_ISOAddress.R @@ -24,6 +24,6 @@ test_that("encoding",{ md2 <- ISOAddress$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBand.R b/tests/testthat/test_ISOBand.R index 2b1c2a82..bf5fb300 100644 --- a/tests/testthat/test_ISOBand.R +++ b/tests/testthat/test_ISOBand.R @@ -16,10 +16,17 @@ test_that("encoding",{ md$setDescriptor("descriptor") md$setMaxValue(10) md$setMinValue(1) - uom = ISOUomLength$new() - uom$setUomName("var") - uom$setUomSymbol("symbol") - md$setUnits(uom) + + gml <- GMLBaseUnit$new() + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + md$setUnits(gml) + md$setPeakResponse(9) md$setBitsPerValue(5) md$setToneGradation(100) @@ -33,6 +40,6 @@ test_that("encoding",{ md2 <- ISOBand$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBaseBoolean.R b/tests/testthat/test_ISOBaseBoolean.R index f6e46d2e..ac815772 100644 --- a/tests/testthat/test_ISOBaseBoolean.R +++ b/tests/testthat/test_ISOBaseBoolean.R @@ -21,7 +21,7 @@ test_that("encoding",{ md2 <- ISOBaseBoolean$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) @@ -38,6 +38,6 @@ test_that("encoding with coercing",{ md2 <- ISOBaseBoolean$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBaseCharacterString.R b/tests/testthat/test_ISOBaseCharacterString.R index fc3ccd7e..4d5ad441 100644 --- a/tests/testthat/test_ISOBaseCharacterString.R +++ b/tests/testthat/test_ISOBaseCharacterString.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOBaseCharacterString$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBaseDate.R b/tests/testthat/test_ISOBaseDate.R index 93b7e80f..204ad4bb 100644 --- a/tests/testthat/test_ISOBaseDate.R +++ b/tests/testthat/test_ISOBaseDate.R @@ -13,7 +13,7 @@ test_that("encoding",{ #encoding md <- ISOBaseDate$new(value = ISOdate(2015, 1, 1, 1)) expect_is(md, "ISOBaseDate") - expect_equal(md$value, "2015-01-01") + expect_equal(md$value, as.Date(ISOdate(2015, 1, 1, 1))) xml <- md$encode() expect_is(xml, "XMLInternalNode") @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOBaseDate$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBaseDateTime.R b/tests/testthat/test_ISOBaseDateTime.R index e3b9235d..663ade0e 100644 --- a/tests/testthat/test_ISOBaseDateTime.R +++ b/tests/testthat/test_ISOBaseDateTime.R @@ -13,7 +13,7 @@ test_that("encoding",{ #encoding md <- ISOBaseDateTime$new(value = ISOdate(2015, 1, 1, 1)) expect_is(md, "ISOBaseDateTime") - expect_equal(md$value, "2015-01-01T01:00:00") + expect_equal(md$value, ISOdate(2015, 1, 1, 1)) xml <- md$encode() expect_is(xml, "XMLInternalNode") @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOBaseDateTime$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBaseDecimal.R b/tests/testthat/test_ISOBaseDecimal.R index 9df642f8..5ebfab20 100644 --- a/tests/testthat/test_ISOBaseDecimal.R +++ b/tests/testthat/test_ISOBaseDecimal.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOBaseDecimal$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBaseInteger.R b/tests/testthat/test_ISOBaseInteger.R index 9120e47c..a913c5f8 100644 --- a/tests/testthat/test_ISOBaseInteger.R +++ b/tests/testthat/test_ISOBaseInteger.R @@ -20,7 +20,7 @@ test_that("encoding",{ md2 <- ISOBaseInteger$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) @@ -36,6 +36,6 @@ test_that("encoding with coercing",{ md2 <- ISOBaseInteger$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBaseReal.R b/tests/testthat/test_ISOBaseReal.R index 27131dbf..1e0f2dad 100644 --- a/tests/testthat/test_ISOBaseReal.R +++ b/tests/testthat/test_ISOBaseReal.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOBaseReal$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOBrowseGraphic.R b/tests/testthat/test_ISOBrowseGraphic.R index 23e8fa65..f8fe9fed 100644 --- a/tests/testthat/test_ISOBrowseGraphic.R +++ b/tests/testthat/test_ISOBrowseGraphic.R @@ -23,6 +23,6 @@ test_that("encoding",{ md2 <- ISOBrowseGraphic$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOCitation.R b/tests/testthat/test_ISOCitation.R index 7e861149..0fed3ee1 100644 --- a/tests/testthat/test_ISOCitation.R +++ b/tests/testthat/test_ISOCitation.R @@ -59,6 +59,6 @@ test_that("encoding",{ md2 <- ISOCitation$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOConformanceResult.R b/tests/testthat/test_ISOConformanceResult.R index 8e56940b..ae88b878 100644 --- a/tests/testthat/test_ISOConformanceResult.R +++ b/tests/testthat/test_ISOConformanceResult.R @@ -29,6 +29,6 @@ test_that("encoding",{ md2 <- ISOConformanceResult$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOConstraint.R b/tests/testthat/test_ISOConstraint.R index 99dc5e33..7df53ffa 100644 --- a/tests/testthat/test_ISOConstraint.R +++ b/tests/testthat/test_ISOConstraint.R @@ -14,7 +14,6 @@ test_that("encoding",{ expect_equal(md$description, "description1") md$setDescription("description2") expect_equal(md$description, "description2") - xml <- md$encode() expect_is(md, "ISOConstraint") xml <- md$encode() expect_is(xml, "XMLInternalNode") @@ -23,6 +22,6 @@ test_that("encoding",{ md2 <- ISOConstraint$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOConstraints.R b/tests/testthat/test_ISOConstraints.R index 80dcda4e..d4f418d4 100644 --- a/tests/testthat/test_ISOConstraints.R +++ b/tests/testthat/test_ISOConstraints.R @@ -24,6 +24,6 @@ test_that("encoding",{ md2 <- ISOConstraints$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOContact.R b/tests/testthat/test_ISOContact.R index d7a142a5..9fc0a19f 100644 --- a/tests/testthat/test_ISOContact.R +++ b/tests/testthat/test_ISOContact.R @@ -35,6 +35,6 @@ test_that("encoding",{ md2 <- ISOContact$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOCoverageDescription.R b/tests/testthat/test_ISOCoverageDescription.R index ca50c489..3c8c446e 100644 --- a/tests/testthat/test_ISOCoverageDescription.R +++ b/tests/testthat/test_ISOCoverageDescription.R @@ -24,10 +24,15 @@ test_that("encoding",{ band$setDescriptor("descriptor") band$setMaxValue(10) band$setMinValue(1) - uom = ISOUomLength$new() - uom$setUomName("var") - uom$setUomSymbol("symbol") - band$setUnits(uom) + gml <- GMLBaseUnit$new(id = sprintf("ID%s",i)) + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + band$setUnits(gml) band$setPeakResponse(9) band$setBitsPerValue(5) band$setToneGradation(100) @@ -43,6 +48,6 @@ test_that("encoding",{ md2 <- ISOCoverageDescription$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISODataIdentification.R b/tests/testthat/test_ISODataIdentification.R index f9840c31..0f9d2ad2 100644 --- a/tests/testthat/test_ISODataIdentification.R +++ b/tests/testthat/test_ISODataIdentification.R @@ -112,6 +112,6 @@ test_that("encoding",{ md2 <- ISODataIdentification$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISODataQuality.R b/tests/testthat/test_ISODataQuality.R index 5a6c2a46..6fa3453b 100644 --- a/tests/testthat/test_ISODataQuality.R +++ b/tests/testthat/test_ISODataQuality.R @@ -47,6 +47,6 @@ test_that("encoding",{ dq2 <- ISODataQuality$new(xml = xml) xml2 <- dq2$encode() - expect_true(ISOMetadataElement$compare(dq, dq2)) + expect_true(ISOAbstractObject$compare(dq, dq2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISODate.R b/tests/testthat/test_ISODate.R index 10fa4844..f0c787ed 100644 --- a/tests/testthat/test_ISODate.R +++ b/tests/testthat/test_ISODate.R @@ -24,6 +24,6 @@ test_that("encoding",{ md2 <- ISODate$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISODefinitionReference.R b/tests/testthat/test_ISODefinitionReference.R index eb31d900..692b71c1 100644 --- a/tests/testthat/test_ISODefinitionReference.R +++ b/tests/testthat/test_ISODefinitionReference.R @@ -31,6 +31,6 @@ test_that("encoding",{ md2 <- ISODefinitionReference$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISODefinitionSource.R b/tests/testthat/test_ISODefinitionSource.R index cd7fc859..39963c51 100644 --- a/tests/testthat/test_ISODefinitionSource.R +++ b/tests/testthat/test_ISODefinitionSource.R @@ -30,6 +30,6 @@ test_that("encoding",{ md2 <- ISODefinitionSource$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISODigitalTransferOptions.R b/tests/testthat/test_ISODigitalTransferOptions.R index 73c1c3e9..53426477 100644 --- a/tests/testthat/test_ISODigitalTransferOptions.R +++ b/tests/testthat/test_ISODigitalTransferOptions.R @@ -26,6 +26,6 @@ test_that("encoding",{ md2 <- ISODigitalTransferOptions$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISODimension.R b/tests/testthat/test_ISODimension.R index 4282a02b..ffaf6fb6 100644 --- a/tests/testthat/test_ISODimension.R +++ b/tests/testthat/test_ISODimension.R @@ -27,5 +27,5 @@ test_that("ISODimension",{ md2 <- ISODimension$new(xml = xml) xml2 <- md2$encode() #identity - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) diff --git a/tests/testthat/test_ISODistribution.R b/tests/testthat/test_ISODistribution.R index 708a4ab7..d82dcb8d 100644 --- a/tests/testthat/test_ISODistribution.R +++ b/tests/testthat/test_ISODistribution.R @@ -29,6 +29,6 @@ test_that("encoding",{ md2 <- ISODistribution$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISODomainConsistency.R b/tests/testthat/test_ISODomainConsistency.R index 02344b60..7135e0e2 100644 --- a/tests/testthat/test_ISODomainConsistency.R +++ b/tests/testthat/test_ISODomainConsistency.R @@ -31,6 +31,6 @@ test_that("encoding",{ md2 <- ISODomainConsistency$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOExtent.R b/tests/testthat/test_ISOExtent.R index 32d58253..6b32a367 100644 --- a/tests/testthat/test_ISOExtent.R +++ b/tests/testthat/test_ISOExtent.R @@ -29,9 +29,6 @@ test_that("encoding",{ vert <- ISOVerticalExtent$new() vert$setMinimumValue(0) vert$setMaximumValue(19) - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") extent$setVerticalElement(vert) xml <- extent$encode() @@ -41,6 +38,6 @@ test_that("encoding",{ extent2 <- ISOExtent$new(xml = xml) xml2 <- extent2$encode() - expect_true(ISOMetadataElement$compare(extent, extent2)) + expect_true(ISOAbstractObject$compare(extent, extent2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOFeatureAttribute.R b/tests/testthat/test_ISOFeatureAttribute.R index 35d3bc76..0432dd2d 100644 --- a/tests/testthat/test_ISOFeatureAttribute.R +++ b/tests/testthat/test_ISOFeatureAttribute.R @@ -16,10 +16,15 @@ test_that("encoding",{ md$setDefinition("definition") md$setCardinality(lower=1,upper=1) md$setCode("code") - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - md$setValueMeasurementUnit(uom) + gml <- GMLBaseUnit$new(id = "ID") + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + md$setValueMeasurementUnit(gml) md$setValueType("typeName") expect_is(md, "ISOFeatureAttribute") xml <- md$encode() @@ -29,6 +34,6 @@ test_that("encoding",{ md2 <- ISOFeatureAttribute$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOFeatureCatalogue.R b/tests/testthat/test_ISOFeatureCatalogue.R index f6dad88b..bab2591d 100644 --- a/tests/testthat/test_ISOFeatureCatalogue.R +++ b/tests/testthat/test_ISOFeatureCatalogue.R @@ -47,10 +47,15 @@ test_that("encoding",{ fat$setCode(sprintf("code %s",i)) #add measurement unit - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - fat$setValueMeasurementUnit(uom) + gml <- GMLBaseUnit$new(id = sprintf("ID%s",i)) + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + fat$setValueMeasurementUnit(gml) #add listed values val1 <- ISOListedValue$new() @@ -81,6 +86,6 @@ test_that("encoding",{ fc2 <- ISOFeatureCatalogue$new(xml = xml) xml2 <- fc2$encode() - expect_true(ISOMetadataElement$compare(fc, fc2)) + expect_true(ISOAbstractObject$compare(fc, fc2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOFeatureCatalogueDescription.R b/tests/testthat/test_ISOFeatureCatalogueDescription.R index d787463f..d70cad7c 100644 --- a/tests/testthat/test_ISOFeatureCatalogueDescription.R +++ b/tests/testthat/test_ISOFeatureCatalogueDescription.R @@ -31,8 +31,6 @@ test_that("encoding",{ rp$setContactInfo(contact) cit$setCitedResponsibleParty(rp) md$addFeatureCatalogueCitation(cit) - - xml <- md$encode() expect_is(md, "ISOFeatureCatalogueDescription") xml <- md$encode() expect_is(xml, "XMLInternalNode") @@ -41,6 +39,6 @@ test_that("encoding",{ md2 <- ISOFeatureCatalogueDescription$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOFeatureOperation.R b/tests/testthat/test_ISOFeatureOperation.R index 1c8b1c34..ad96c830 100644 --- a/tests/testthat/test_ISOFeatureOperation.R +++ b/tests/testthat/test_ISOFeatureOperation.R @@ -25,6 +25,6 @@ test_that("encoding",{ md2 <- ISOFeatureOperation$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOFeatureType.R b/tests/testthat/test_ISOFeatureType.R index aed3f11f..20dec10c 100644 --- a/tests/testthat/test_ISOFeatureType.R +++ b/tests/testthat/test_ISOFeatureType.R @@ -29,10 +29,15 @@ test_that("encoding",{ fat$setCode(sprintf("code %s",i)) #add measurement unit - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - fat$setValueMeasurementUnit(uom) + gml <- GMLBaseUnit$new(id = sprintf("ID%s",i)) + gml$setDescriptionReference("someref") + gml$setIdentifier("identifier", "codespace") + gml$addName("name1", "codespace") + gml$addName("name2", "codespace") + gml$setQuantityTypeReference("someref") + gml$setCatalogSymbol("symbol") + gml$setUnitsSystem("somelink") + fat$setValueMeasurementUnit(gml) #add listed values val1 <- ISOListedValue$new() @@ -60,6 +65,6 @@ test_that("encoding",{ md2 <- ISOFeatureType$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOGeographicBoundingBox.R b/tests/testthat/test_ISOGeographicBoundingBox.R index a5c317ae..927254a7 100644 --- a/tests/testthat/test_ISOGeographicBoundingBox.R +++ b/tests/testthat/test_ISOGeographicBoundingBox.R @@ -19,6 +19,6 @@ test_that("encoding",{ md2 <- ISOGeographicBoundingBox$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOGeographicDescription.R b/tests/testthat/test_ISOGeographicDescription.R index d6c1d477..5a6c43ff 100644 --- a/tests/testthat/test_ISOGeographicDescription.R +++ b/tests/testthat/test_ISOGeographicDescription.R @@ -20,6 +20,6 @@ test_that("encoding",{ md2 <- ISOGeographicDescription$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOGeometricObjects.R b/tests/testthat/test_ISOGeometricObjects.R index 0cc3bcdf..0e7c84ff 100644 --- a/tests/testthat/test_ISOGeometricObjects.R +++ b/tests/testthat/test_ISOGeometricObjects.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOGeometricObjects$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOGeoreferenceable.R b/tests/testthat/test_ISOGeoreferenceable.R index e8e155b1..319ed08e 100644 --- a/tests/testthat/test_ISOGeoreferenceable.R +++ b/tests/testthat/test_ISOGeoreferenceable.R @@ -43,5 +43,5 @@ test_that("encoding",{ md2 <- ISOGeoreferenceable$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOGridSpatialRepresentation.R b/tests/testthat/test_ISOGridSpatialRepresentation.R index 31acb132..b82d9287 100644 --- a/tests/testthat/test_ISOGridSpatialRepresentation.R +++ b/tests/testthat/test_ISOGridSpatialRepresentation.R @@ -28,5 +28,5 @@ test_that("encoding",{ md2 <- ISOGridSpatialRepresentation$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOIdentifier.R b/tests/testthat/test_ISOIdentifier.R index b2cdbb93..fc742798 100644 --- a/tests/testthat/test_ISOIdentifier.R +++ b/tests/testthat/test_ISOIdentifier.R @@ -11,16 +11,16 @@ context("ISOIdentifier") test_that("encoding",{ #encoding - md <- ISOIdentifier$new(code = "identifier", prefix = "MD") + md <- ISOIdentifier$new(code = "identifier") expect_is(md, "ISOIdentifier") expect_equal(md$code, "identifier") - xml <- md$encode() + xml <- md$encode(validate=F) expect_is(xml, "XMLInternalNode") #decoding - md2 <- ISOIdentifier$new(xml = xml, prefix = "MD") - xml2 <- md2$encode() + md2 <- ISOIdentifier$new(xml = xml) + xml2 <- md2$encode(validate=F) - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOKeywords.R b/tests/testthat/test_ISOKeywords.R index e1211e1d..5746cc5f 100644 --- a/tests/testthat/test_ISOKeywords.R +++ b/tests/testthat/test_ISOKeywords.R @@ -33,6 +33,6 @@ test_that("encoding",{ md2 <- ISOKeywords$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOLegalConstraints.R b/tests/testthat/test_ISOLegalConstraints.R index 27016fe7..87d291e5 100644 --- a/tests/testthat/test_ISOLegalConstraints.R +++ b/tests/testthat/test_ISOLegalConstraints.R @@ -30,6 +30,6 @@ test_that("encoding",{ md2 <- ISOLegalConstraints$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOLineage.R b/tests/testthat/test_ISOLineage.R index 873ea7d2..6ad5ffe7 100644 --- a/tests/testthat/test_ISOLineage.R +++ b/tests/testthat/test_ISOLineage.R @@ -73,6 +73,6 @@ test_that("encoding",{ lineage2 <- ISOLineage$new(xml = xml) xml2 <- lineage2$encode() - expect_true(ISOMetadataElement$compare(lineage, lineage2)) + expect_true(ISOAbstractObject$compare(lineage, lineage2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOListedValue.R b/tests/testthat/test_ISOListedValue.R index e2ca075d..4d0a2772 100644 --- a/tests/testthat/test_ISOListedValue.R +++ b/tests/testthat/test_ISOListedValue.R @@ -23,6 +23,6 @@ test_that("encoding",{ md2 <- ISOListedValue$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOLocalName.R b/tests/testthat/test_ISOLocalName.R index 904f5908..139f6362 100644 --- a/tests/testthat/test_ISOLocalName.R +++ b/tests/testthat/test_ISOLocalName.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOLocalName$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOMaintenanceInformation.R b/tests/testthat/test_ISOMaintenanceInformation.R index 85e237b0..f6beebc0 100644 --- a/tests/testthat/test_ISOMaintenanceInformation.R +++ b/tests/testthat/test_ISOMaintenanceInformation.R @@ -20,6 +20,6 @@ test_that("encoding",{ md2 <- ISOMaintenanceInformation$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOMeasure.R b/tests/testthat/test_ISOMeasure.R index 1e14c6e4..8ced7b4c 100644 --- a/tests/testthat/test_ISOMeasure.R +++ b/tests/testthat/test_ISOMeasure.R @@ -17,7 +17,7 @@ test_that("ISOMeasure",{ md2 <- ISOMeasure$new(xml = xml) xml2 <- md2$encode() #identity - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) test_that("ISOLength",{ @@ -29,7 +29,7 @@ test_that("ISOLength",{ md2 <- ISOLength$new(xml = xml) xml2 <- md2$encode() #identity - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) test_that("ISODistance",{ @@ -41,7 +41,7 @@ test_that("ISODistance",{ md2 <- ISODistance$new(xml = xml) xml2 <- md2$encode() #identity - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) test_that("ISOAngle",{ @@ -53,7 +53,7 @@ test_that("ISOAngle",{ md2 <- ISOAngle$new(xml = xml) xml2 <- md2$encode() #identity - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) test_that("ISOScale",{ @@ -65,5 +65,5 @@ test_that("ISOScale",{ md2 <- ISOScale$new(xml = xml) xml2 <- md2$encode() #identity - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOMemberName.R b/tests/testthat/test_ISOMemberName.R index 4a928ebc..45699cd2 100644 --- a/tests/testthat/test_ISOMemberName.R +++ b/tests/testthat/test_ISOMemberName.R @@ -20,6 +20,6 @@ test_that("encoding",{ md2 <- ISOMemberName$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOMetaIdentifier.R b/tests/testthat/test_ISOMetaIdentifier.R index 5be31d0c..d3cf45f3 100644 --- a/tests/testthat/test_ISOMetaIdentifier.R +++ b/tests/testthat/test_ISOMetaIdentifier.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOMetaIdentifier$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOMetadata.R b/tests/testthat/test_ISOMetadata.R index 96b87c53..13630d1d 100644 --- a/tests/testthat/test_ISOMetadata.R +++ b/tests/testthat/test_ISOMetadata.R @@ -296,6 +296,6 @@ test_that("encoding/decoding",{ md2 <- ISOMetadata$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOMultiplicity.R b/tests/testthat/test_ISOMultiplicity.R index 596369e5..7f8a4d77 100644 --- a/tests/testthat/test_ISOMultiplicity.R +++ b/tests/testthat/test_ISOMultiplicity.R @@ -20,6 +20,6 @@ test_that("encoding",{ md2 <- ISOMultiplicity$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOMultiplicityRange.R b/tests/testthat/test_ISOMultiplicityRange.R index 8b9cd50a..41d050a7 100644 --- a/tests/testthat/test_ISOMultiplicityRange.R +++ b/tests/testthat/test_ISOMultiplicityRange.R @@ -20,6 +20,6 @@ test_that("encoding",{ md2 <- ISOMultiplicityRange$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOOnlineResource.R b/tests/testthat/test_ISOOnlineResource.R index 1523d088..fcdedc11 100644 --- a/tests/testthat/test_ISOOnlineResource.R +++ b/tests/testthat/test_ISOOnlineResource.R @@ -23,6 +23,6 @@ test_that("encoding",{ md2 <- ISOOnlineResource$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOProcessStep.R b/tests/testthat/test_ISOProcessStep.R index 6f94e08b..f630f247 100644 --- a/tests/testthat/test_ISOProcessStep.R +++ b/tests/testthat/test_ISOProcessStep.R @@ -43,6 +43,6 @@ test_that("encoding",{ md2 <- ISOProcessStep$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOPropertyType.R b/tests/testthat/test_ISOPropertyType.R index bae9b781..777897f4 100644 --- a/tests/testthat/test_ISOPropertyType.R +++ b/tests/testthat/test_ISOPropertyType.R @@ -23,6 +23,6 @@ test_that("encoding",{ md2 <- ISOPropertyType$new(xml = xml) xml2 <- md2$encode(validate = F) - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISORangeDimension.R b/tests/testthat/test_ISORangeDimension.R index c2c59b10..e5a58765 100644 --- a/tests/testthat/test_ISORangeDimension.R +++ b/tests/testthat/test_ISORangeDimension.R @@ -22,6 +22,6 @@ test_that("encoding",{ md2 <- ISORangeDimension$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISORecord.R b/tests/testthat/test_ISORecord.R index 72dc6cf7..8bdb1cd8 100644 --- a/tests/testthat/test_ISORecord.R +++ b/tests/testthat/test_ISORecord.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISORecord$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISORecordType.R b/tests/testthat/test_ISORecordType.R index 10c0ef3b..a84f3a2a 100644 --- a/tests/testthat/test_ISORecordType.R +++ b/tests/testthat/test_ISORecordType.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISORecordType$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOReferenceIdentifier.R b/tests/testthat/test_ISOReferenceIdentifier.R index bf11dae9..4c83deaa 100644 --- a/tests/testthat/test_ISOReferenceIdentifier.R +++ b/tests/testthat/test_ISOReferenceIdentifier.R @@ -22,6 +22,6 @@ test_that("encoding",{ md2 <- ISOReferenceIdentifier$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOReferenceSystem.R b/tests/testthat/test_ISOReferenceSystem.R index 3ed4bf31..4158be58 100644 --- a/tests/testthat/test_ISOReferenceSystem.R +++ b/tests/testthat/test_ISOReferenceSystem.R @@ -21,6 +21,6 @@ test_that("encoding/decoding",{ md2 <- ISOReferenceSystem$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISORepresentativeFraction.R b/tests/testthat/test_ISORepresentativeFraction.R index 08578ce3..9e601d74 100644 --- a/tests/testthat/test_ISORepresentativeFraction.R +++ b/tests/testthat/test_ISORepresentativeFraction.R @@ -19,6 +19,6 @@ test_that("encoding",{ md2 <- ISORepresentativeFraction$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOResponsibleParty.R b/tests/testthat/test_ISOResponsibleParty.R index 3f6a104b..b6ec8dde 100644 --- a/tests/testthat/test_ISOResponsibleParty.R +++ b/tests/testthat/test_ISOResponsibleParty.R @@ -43,6 +43,6 @@ test_that("encoding",{ md2 <- ISOResponsibleParty$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOScope.R b/tests/testthat/test_ISOScope.R index 3930feb5..2031add3 100644 --- a/tests/testthat/test_ISOScope.R +++ b/tests/testthat/test_ISOScope.R @@ -20,6 +20,6 @@ test_that("encoding",{ md2 <- ISOScope$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOSecurityConstraints.R b/tests/testthat/test_ISOSecurityConstraints.R index 2e00e5c4..0b33eb41 100644 --- a/tests/testthat/test_ISOSecurityConstraints.R +++ b/tests/testthat/test_ISOSecurityConstraints.R @@ -24,6 +24,6 @@ test_that("encoding",{ md2 <- ISOSecurityConstraints$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOSource.R b/tests/testthat/test_ISOSource.R index 4852f8bb..4e4c350b 100644 --- a/tests/testthat/test_ISOSource.R +++ b/tests/testthat/test_ISOSource.R @@ -39,6 +39,6 @@ test_that("encoding",{ md2 <- ISOSource$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOSpatialTemporalExtent.R b/tests/testthat/test_ISOSpatialTemporalExtent.R index da04528b..acb96441 100644 --- a/tests/testthat/test_ISOSpatialTemporalExtent.R +++ b/tests/testthat/test_ISOSpatialTemporalExtent.R @@ -26,6 +26,6 @@ test_that("encoding",{ md2 <- ISOSpatialTemporalExtent$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOTelephone.R b/tests/testthat/test_ISOTelephone.R index 300b7f37..520470a2 100644 --- a/tests/testthat/test_ISOTelephone.R +++ b/tests/testthat/test_ISOTelephone.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOTelephone$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOTemporalExtent.R b/tests/testthat/test_ISOTemporalExtent.R index 7a71a947..6ae27419 100644 --- a/tests/testthat/test_ISOTemporalExtent.R +++ b/tests/testthat/test_ISOTemporalExtent.R @@ -24,6 +24,6 @@ test_that("encoding",{ te2 <- ISOTemporalExtent$new(xml = xml) xml2 <- te2$encode() - expect_true(ISOMetadataElement$compare(te, te2)) + expect_true(ISOAbstractObject$compare(te, te2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOTypeName.R b/tests/testthat/test_ISOTypeName.R index 10de4700..6509e238 100644 --- a/tests/testthat/test_ISOTypeName.R +++ b/tests/testthat/test_ISOTypeName.R @@ -22,6 +22,6 @@ test_that("encoding",{ md2 <- ISOTypeName$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOURL.R b/tests/testthat/test_ISOURL.R index 5a03c6ef..37b80502 100644 --- a/tests/testthat/test_ISOURL.R +++ b/tests/testthat/test_ISOURL.R @@ -21,6 +21,6 @@ test_that("encoding",{ md2 <- ISOURL$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOUnitOfMeasure.R b/tests/testthat/test_ISOUnitOfMeasure.R deleted file mode 100644 index 52f0de81..00000000 --- a/tests/testthat/test_ISOUnitOfMeasure.R +++ /dev/null @@ -1,109 +0,0 @@ -# test_ISOUnitOfMeasure.R -# Author: Emmanuel Blondel -# -# Description: Unit tests for ISOUnitOfMeasure.R -#======================= -require(geometa, quietly = TRUE) -require(testthat) - -context("ISOUnitOfMeasure") - - -test_that("encoding UomAngle",{ - uom <- ISOUomAngle$new() - uom$setUomName("Degree") - uom$setUomSymbol("deg") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomAngle$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) - -test_that("encoding UomArea",{ - uom <- ISOUomArea$new() - uom$setUomName("Square meter") - uom$setUomSymbol("sqm") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomArea$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) - -test_that("encoding UomCurrency",{ - uom <- ISOUomCurrency$new() - uom$setUomName("Dollar") - uom$setUomSymbol("$") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomCurrency$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) - -test_that("encoding UomLength",{ - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomLength$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) - -test_that("encoding UomScale",{ - uom <- ISOUomScale$new() - uom$setUomName("Scale") - uom$setUomSymbol("scale") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomScale$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) - -test_that("encoding UomTime",{ - uom <- ISOUomTime$new() - uom$setUomName("Second") - uom$setUomSymbol("s") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomTime$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) - -test_that("encoding UomVelocity",{ - uom <- ISOUomVelocity$new() - uom$setUomName("Meter per second") - uom$setUomSymbol("m.s-1") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomVelocity$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) - -test_that("encoding UomVolume",{ - uom <- ISOUomVolume$new() - uom$setUomName("cubic meter") - uom$setUomSymbol("m3") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomVolume$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) - -test_that("encoding UomWeight",{ - uom <- ISOUomWeight$new() - uom$setUomName("Kilogram") - uom$setUomSymbol("kg") - xml <- uom$encode() - expect_is(xml, "XMLInternalNode") - uom2 <- ISOUomWeight$new(xml = xml) - xml2 <- uom2$encode() - expect_true(ISOMetadataElement$compare(uom,uom2)) -}) diff --git a/tests/testthat/test_ISOUnlimitedInteger.R b/tests/testthat/test_ISOUnlimitedInteger.R index bf71c53b..8d25135b 100644 --- a/tests/testthat/test_ISOUnlimitedInteger.R +++ b/tests/testthat/test_ISOUnlimitedInteger.R @@ -20,6 +20,6 @@ test_that("encoding",{ md2 <- ISOUnlimitedInteger$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOVectorSpatialRepresentation.R b/tests/testthat/test_ISOVectorSpatialRepresentation.R index 5d8a40f2..5928296b 100644 --- a/tests/testthat/test_ISOVectorSpatialRepresentation.R +++ b/tests/testthat/test_ISOVectorSpatialRepresentation.R @@ -34,5 +34,5 @@ test_that("encoding",{ md2 <- ISOVectorSpatialRepresentation$new(xml = xml) xml2 <- md2$encode() - expect_true(ISOMetadataElement$compare(md, md2)) + expect_true(ISOAbstractObject$compare(md, md2)) }) \ No newline at end of file diff --git a/tests/testthat/test_ISOVerticalExtent.R b/tests/testthat/test_ISOVerticalExtent.R index 7db53908..9ec482a0 100644 --- a/tests/testthat/test_ISOVerticalExtent.R +++ b/tests/testthat/test_ISOVerticalExtent.R @@ -14,16 +14,13 @@ test_that("encoding",{ ve <- ISOVerticalExtent$new() ve$setMinimumValue(0) ve$setMaximumValue(19) - uom <- ISOUomLength$new() - uom$setUomName("Meter") - uom$setUomSymbol("m") - ve$setUnitOfMeasure(uom) + xml <- ve$encode() expect_is(xml, "XMLInternalNode") #decoding ve2 <- ISOVerticalExtent$new(xml = xml) - expect_true(ISOMetadataElement$compare(ve, ve2)) + expect_true(ISOAbstractObject$compare(ve, ve2)) }) \ No newline at end of file