ISOKeywords

ISOKeywords

Format

R6Class object.

Value

Object of R6Class for modelling a ISO set of keywords

Author

Emmanuel Blondel <emmanuel.blondel1@gmail.com>

Super classes

geometa::geometaLogger -> geometa::ISOAbstractObject -> ISOKeywords

Public fields

keyword

keyword

type

type

thesaurusName

thesaurus name

Methods

Inherited methods


Method new()

Initializes object

Usage

ISOKeywords$new(xml = NULL)

Arguments

xml

object of class XMLInternalNode-class


Method addKeyword()

Adds keyword

Usage

ISOKeywords$addKeyword(keyword, locales = NULL)

Arguments

keyword

keyword

locales

list of localized texts. Default is NULL

Returns

TRUE if added, FALSe otherwise


Method delKeyword()

Deletes keyword

Usage

ISOKeywords$delKeyword(keyword, locales = NULL)

Arguments

keyword

keyword

locales

list of localized texts. Default is NULL

Returns

TRUE if deleted, FALSe otherwise


Method setKeywordType()

Set keyword type

Usage

ISOKeywords$setKeywordType(keywordType)

Arguments

keywordType

object of class ISOKeywordType or any character among values returned by ISOKeywordType$values()


Method setThesaurusName()

Set thesaurus name

Usage

ISOKeywords$setThesaurusName(thesaurusName)

Arguments

thesaurusName

object of class ISOCitation


Method clone()

The objects of this class are cloneable with this method.

Usage

ISOKeywords$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

  #a basic keyword set
  md <- ISOKeywords$new()
  md$addKeyword("keyword1")
#> [1] TRUE
  md$addKeyword("keyword2")
#> [1] TRUE
  md$setKeywordType("theme")
  th <- ISOCitation$new()
  th$setTitle("General")
  md$setThesaurusName(th)
  xml <- md$encode()
#> [geometa][WARN] Element '{http://www.isotc211.org/2005/gmd}CI_Citation': Missing child element(s). Expected is one of ( {http://www.isotc211.org/2005/gmd}alternateTitle, {http://www.isotc211.org/2005/gmd}date ) at line 12. 
#> [geometa][WARN] Object 'ISOKeywords' is INVALID according to ISO 19139 XML schemas! 
  
  #a keyword set with anchors
  md <- ISOKeywords$new()
  kwd1 <- ISOAnchor$new(
    name = "keyword1",
    href = "http://myvocabulary.geometa/keyword1"
  )
  md$addKeyword(kwd1)
#> [1] TRUE
  kwd2 <- ISOAnchor$new(
    name = "keyword2",
    href = "http://myvocabulary.geometa/keyword2"
  )
  md$addKeyword(kwd2)
#> [1] TRUE
  md$setKeywordType("theme")
  xml <- md$encode()
#> [geometa][WARN] Element '{http://www.isotc211.org/2005/gmx}Anchor': This element is not expected. Expected is one of ( {http://www.isotc211.org/2005/gco}CharacterString, {http://www.isotc211.org/2005/gmd}CI_RoleCode, {http://www.isotc211.org/2005/gmd}CI_PresentationFormCode, {http://www.isotc211.org/2005/gmd}CI_OnLineFunctionCode, {http://www.isotc211.org/2005/gmd}CI_DateTypeCode, {http://www.isotc211.org/2005/gmd}MD_PixelOrientationCode, {http://www.isotc211.org/2005/gmd}MD_TopologyLevelCode, {http://www.isotc211.org/2005/gmd}MD_GeometricObjectTypeCode, {http://www.isotc211.org/2005/gmd}MD_CellGeometryCode, {http://www.isotc211.org/2005/gmd}MD_DimensionNameTypeCode ) at line 3. 
#> [geometa][WARN] Element '{http://www.isotc211.org/2005/gmx}Anchor': This element is not expected. Expected is one of ( {http://www.isotc211.org/2005/gco}CharacterString, {http://www.isotc211.org/2005/gmd}CI_RoleCode, {http://www.isotc211.org/2005/gmd}CI_PresentationFormCode, {http://www.isotc211.org/2005/gmd}CI_OnLineFunctionCode, {http://www.isotc211.org/2005/gmd}CI_DateTypeCode, {http://www.isotc211.org/2005/gmd}MD_PixelOrientationCode, {http://www.isotc211.org/2005/gmd}MD_TopologyLevelCode, {http://www.isotc211.org/2005/gmd}MD_GeometricObjectTypeCode, {http://www.isotc211.org/2005/gmd}MD_CellGeometryCode, {http://www.isotc211.org/2005/gmd}MD_DimensionNameTypeCode ) at line 6. 
#> [geometa][WARN] Object 'ISOKeywords' is INVALID according to ISO 19139 XML schemas! 
  
  #Example for INSPIRE (GEMET Spatial Data Theme)
  inspire_kwd <- ISOKeywords$new()
  anc1 <- ISOAnchor$new(
    name = "Environmental monitoring facilities",
    href = "http://inspire.ec.europa.eu/theme/ef"
  )
  inspire_kwd$addKeyword(anc1)
#> [1] TRUE
  inspire_kwd$setKeywordType("theme")
  th <- ISOCitation$new()
  th$setTitle(
    ISOAnchor$new(
     name = "GEMET - INSPIRE themes, version 1.0",
     href="http://www.eionet.europa.eu/gemet/inspire_themes"
    )
  )
  inspire_date <- ISODate$new()
  inspire_date$setDate(as.Date("2008-06-01"))
  inspire_date$setDateType("publication")
  th$addDate(inspire_date)
  inspire_kwd$setThesaurusName(th)