Skip to content

Commit

Permalink
#9 more oxygen + fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 26, 2015
1 parent 71a8a12 commit 28976fd
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 113 deletions.
39 changes: 35 additions & 4 deletions R/Class-SDMXAttribute.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
# E.Blondel - 2014/08/21
#=======================

#SDMX Attribute class
#' @name SDMXAttribute
#' @docType class
#' @aliases SDMXAttribute-class
#'
#' @title Class "SDMXAttribute"
#' @description A basic class to handle a SDMX Attribute
#'
#' @slot conceptRef Object of class "character" giving the attribute conceptRef (required)
#' @slot conceptVersion Object of class "character" giving the attribute concept version
#' @slot conceptAgency Object of class "character" giving the attribute concept agency
#' @slot conceptSchemeRef Object of class "character" giving the attribute conceptScheme ref
#' @slot conceptSchemeAgency Object of class "character" giving the attribute conceptScheme agency
#' @slot codelist Object of class "character" giving the codelist ref name
#' @slot codelistVersion Object of class "character" giving the codelist ref version
#' @slot codelistAgency Object of class "character" giving the codelist ref agency
#' @slot attachmentLevel Object of class "character" giving the attachment level (e.g. DataSet)
#' @slot assignmentStatus Object of class "character" giving the assignment status (e.g. Mandatory)
#' @slot isTimeFormat Object of class "logical"
#' @slot crossSectionalAttachDataset Object of class "logical"
#' @slot crossSectionalAttachGroup Object of class "logical"
#' @slot crossSectionalAttachSection Object of class "logical"
#' @slot crossSectionalAttachObservation Object of class "logical"
#' @slot isEntityAttribute Object of class "logical" indicating if the Attribute is an entity Attribute. Default value is FALSE
#' @slot isNonObservationTimeAttribute Object of class "logical" indicating if the Attribute is a non-observation Attribute. Default value is FALSE
#' @slot isCountAttribute Object of class "logical" indicating if the Attribute is a count Attribute. Default value is FALSE
#' @slot isFrequencyAttribute Object of class "logical" indicating if the Attribute is a frequency Attribute. Default value is FALSE
#' @slot isIdentityAttribute Object of class "logical" indicating if the Attribute is an identity Attribute. Default value is FALSE
#'
#' @section Warning:
#' This class is not useful in itself, but all SDMX non-abstract classes will
#' encapsulate it as slot, when parsing an SDMX-ML document (DataStructures, or
#' DataStructureDefinitions)
#'
#' @author Emmanuel Blondel, \email{emmanuel.blondel1@@gmail.com}
#'
setClass("SDMXAttribute",
representation(
#attributes
Expand Down
15 changes: 12 additions & 3 deletions R/SDMXAttribute-methods.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# E.Blondel - 2014/08/21
#=======================

#' @name SDMXAttribute
#' @rdname SDMXAttribute
#' @aliases SDMXAttribute,SDMXAttribute-method
#'
#' @usage
#' SDMXAttribute(xmlObj)
#'
#' @param xmlObj object of class "XMLInternalDocument derived from XML package
#' @return an object of class "SDMXAttribute"
#'
#' @seealso \link{readSDMX}
#'
SDMXAttribute <- function(xmlObj){

sdmxVersion <- version.SDMXSchema(xmlDoc(xmlObj))
Expand Down
27 changes: 27 additions & 0 deletions R/rsdmx.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#' @name rsdmx
#' @aliases rsdmx-package
#' @aliases rsdmx
#' @docType package
#'
#' @title Tools for Reading SDMX Data and Metadata
#' @description
#' RSDMX is a package to parse/read SDMX documents in R. It provides:
#' - a set of classes and methods to read data and metadata documents exchanged
#' through theStatistical Data and Metadata Exchange (SDMX) framework. The package
#' currently focuses on the SDMX XML standard format (SDMX-ML).
#' - an web-service interface to well-known SDMX data providers
#'
#' @details
#' \tabular{ll}{
#' Package: \tab rsdmx\cr
#' Type: \tab Package\cr
#' Version
#' : \tab 0.5-1\cr
#' Date: \tab 2015-10-08\cr
#' License: \tab GPL(>=2.0)\cr
#' LazyLoad: \tab yes\cr
#' }
#'
#'@author Emmanuel Blondel \email{emmanuel.blondel1@@gmail.com}
#'
NULL
47 changes: 0 additions & 47 deletions man/SDMXAttribute-class.Rd

This file was deleted.

76 changes: 76 additions & 0 deletions man/SDMXAttribute.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/Class-SDMXAttribute.R, R/SDMXAttribute-methods.R
\docType{class}
\name{SDMXAttribute}
\alias{SDMXAttribute}
\alias{SDMXAttribute,SDMXAttribute-method}
\alias{SDMXAttribute-class}
\title{Class "SDMXAttribute"}
\usage{
SDMXAttribute(xmlObj)
}
\arguments{
\item{xmlObj}{object of class "XMLInternalDocument derived from XML package}
}
\value{
an object of class "SDMXAttribute"
}
\description{
A basic class to handle a SDMX Attribute
}
\section{Slots}{
\describe{
\item{\code{conceptRef}}{Object of class "character" giving the attribute conceptRef (required)}
\item{\code{conceptVersion}}{Object of class "character" giving the attribute concept version}
\item{\code{conceptAgency}}{Object of class "character" giving the attribute concept agency}
\item{\code{conceptSchemeRef}}{Object of class "character" giving the attribute conceptScheme ref}
\item{\code{conceptSchemeAgency}}{Object of class "character" giving the attribute conceptScheme agency}
\item{\code{codelist}}{Object of class "character" giving the codelist ref name}
\item{\code{codelistVersion}}{Object of class "character" giving the codelist ref version}
\item{\code{codelistAgency}}{Object of class "character" giving the codelist ref agency}
\item{\code{attachmentLevel}}{Object of class "character" giving the attachment level (e.g. DataSet)}
\item{\code{assignmentStatus}}{Object of class "character" giving the assignment status (e.g. Mandatory)}
\item{\code{isTimeFormat}}{Object of class "logical"}
\item{\code{crossSectionalAttachDataset}}{Object of class "logical"}
\item{\code{crossSectionalAttachGroup}}{Object of class "logical"}
\item{\code{crossSectionalAttachSection}}{Object of class "logical"}
\item{\code{crossSectionalAttachObservation}}{Object of class "logical"}
\item{\code{isEntityAttribute}}{Object of class "logical" indicating if the Attribute is an entity Attribute. Default value is FALSE}
\item{\code{isNonObservationTimeAttribute}}{Object of class "logical" indicating if the Attribute is a non-observation Attribute. Default value is FALSE}
\item{\code{isCountAttribute}}{Object of class "logical" indicating if the Attribute is a count Attribute. Default value is FALSE}
\item{\code{isFrequencyAttribute}}{Object of class "logical" indicating if the Attribute is a frequency Attribute. Default value is FALSE}
\item{\code{isIdentityAttribute}}{Object of class "logical" indicating if the Attribute is an identity Attribute. Default value is FALSE}
}}
\section{Warning}{
This class is not useful in itself, but all SDMX non-abstract classes will
encapsulate it as slot, when parsing an SDMX-ML document (DataStructures, or
DataStructureDefinitions)
}
\author{
Emmanuel Blondel, \email{emmanuel.blondel1@gmail.com}
}
\seealso{
\link{readSDMX}
}
31 changes: 0 additions & 31 deletions man/rsdmx-package.Rd

This file was deleted.

29 changes: 29 additions & 0 deletions man/rsdmx.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
% Generated by roxygen2 (4.1.1): do not edit by hand
% Please edit documentation in R/rsdmx.R
\docType{package}
\name{rsdmx}
\alias{rsdmx}
\alias{rsdmx-package}
\title{Tools for Reading SDMX Data and Metadata}
\description{
RSDMX is a package to parse/read SDMX documents in R. It provides:
- a set of classes and methods to read data and metadata documents exchanged
through theStatistical Data and Metadata Exchange (SDMX) framework. The package
currently focuses on the SDMX XML standard format (SDMX-ML).
- an web-service interface to well-known SDMX data providers
}
\details{
\tabular{ll}{
Package: \tab rsdmx\cr
Type: \tab Package\cr
Version
: \tab 0.5-1\cr
Date: \tab 2015-10-08\cr
License: \tab GPL(>=2.0)\cr
LazyLoad: \tab yes\cr
}
}
\author{
Emmanuel Blondel \email{emmanuel.blondel1@gmail.com}
}

20 changes: 0 additions & 20 deletions tests/testthat/test_Main.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ test_that("getSDMXSchema - 2.0",{
expect_is(schema, "SDMXSchema")
})

test_that("getSDMXHeader - 2.0",{
header <- getSDMXHeader(sdmxObj)
expect_is(header, "SDMXHeader")
})

test_that("getSDMXType - 2.0",{
type <- getSDMXType(sdmxObj)
expect_is(type, "SDMXType")
})

#tests for 2.1
file2 <- system.file("extdata", "SDMXGenericDataExample_2.1.xml", package = "rsdmx")
sdmxObj2 <- readSDMX(file2, isURL = FALSE)
Expand All @@ -55,16 +45,6 @@ test_that("getSDMXSchema - 2.1",{
expect_is(schema, "SDMXSchema")
})

test_that("getSDMXHeader - 2.1",{
header <- getSDMXHeader(sdmxObj2)
expect_is(header, "SDMXHeader")
})

test_that("getSDMXType - 2.1",{
type <- getSDMXType(sdmxObj2)
expect_is(type, "SDMXType")
})

#SDMXConcepts
#-----------
test_that("readSDMX - SDMXConcepts - 2.0",{
Expand Down
6 changes: 2 additions & 4 deletions tests/testthat/test_Schema.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ test_that("SDMXSchema - 2.1",{

test_that("getVersion - 2.0",{
obj1 = SDMXSchema(xmlObj1)
schema1 = getVersion(obj1)
expect_equal(schema1, "2.0")
expect_equal(obj1@version, "2.0")
})

test_that("getVersion - 2.1",{
obj2 = SDMXSchema(xmlObj2)
schema2 = getVersion(obj2)
expect_equal(schema2, "2.1")
expect_equal(obj2@version, "2.1")
})


Expand Down
6 changes: 2 additions & 4 deletions tests/testthat/test_Type.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ test_that("SDMXType - 2.1",{

test_that("getType - 2.0",{
obj1 <- SDMXType(xmlObj1)
type1 <- getType(obj1)
expect_equal(type1, "GenericDataType")
expect_equal(obj1@type, "GenericDataType")
})

test_that("getType - 2.1",{
obj2 <- SDMXType(xmlObj2)
type2 <- getType(obj2)
expect_equal(type2, "GenericDataType")
expect_equal(obj2@type, "GenericDataType")
})

0 comments on commit 28976fd

Please sign in to comment.