├── _pkgdown.yml
├── LICENSE
├── R
├── sysdata.rda
├── emld-package.R
├── emld-methods.R
├── emld.R
├── as_json.R
├── template.R
└── validate_units.R
├── docs
├── favicon.ico
├── pkgdown.yml
├── link.svg
└── docsearch.js
├── notebook
├── ex1.png
├── ex2.png
├── jq_maps.Rmd
├── big_solr_query.R
├── get_all_eml.R
├── XSD-to-RDFS.R
├── jq_maps.md
└── solr_functions.R
├── Dockerfile
├── inst
├── examples
│ ├── hf205-methods.docx
│ ├── hf205-abstract.docx
│ └── hf205-abstract.md
├── WORDLIST
├── context
│ ├── eml-2.1.1
│ │ └── eml-context.json
│ └── eml-2.2.0
│ │ └── eml-context.json
├── frame
│ ├── eml-2.1.1
│ │ └── eml-frame.json
│ └── eml-2.2.0
│ │ └── eml-frame.json
├── jq
│ ├── eml_to_schema.jq
│ └── schema_to_eml.jq
├── tests
│ ├── eml-2.1.1
│ │ ├── eml-offline.xml
│ │ ├── eml-units.xml
│ │ ├── eml-party.xml
│ │ ├── eml-access.xml
│ │ ├── eml-method.xml
│ │ ├── eml-project.xml
│ │ ├── eml-physical-inline.xml
│ │ ├── stmml_dictionaryWithDefintion.xml
│ │ ├── eml-literatureInPress.xml
│ │ ├── eml-datasetWhitespacePatterns.xml
│ │ ├── eml-literature.xml
│ │ ├── citation-sbclter-bibliography.233.xml
│ │ ├── eml-physical-inline-cdatasection.xml
│ │ ├── citation-sbclter-bibliography.231.xml
│ │ ├── citation-sbclter-bibliography.280.xml
│ │ ├── eml-entity.xml
│ │ ├── eml-physical.xml
│ │ ├── eml-view.xml
│ │ ├── citation-sbclter-bibliography.232.xml
│ │ ├── eml-protocol.xml
│ │ ├── eml-dataTable.xml
│ │ ├── eml-text.xml
│ │ ├── eml-spatialVector.xml
│ │ ├── citation-sbclter-bibliography.279.xml
│ │ ├── citation-sbclter-bibliography.51.xml
│ │ ├── citation-sbclter-bibliography.201.xml
│ │ ├── invalid
│ │ │ └── eml-2.1.1-invalidunit.xml
│ │ ├── eml-inline.xml
│ │ ├── eml-storedProcedure.xml
│ │ ├── eml-software.xml
│ │ ├── citation-sbclter-bibliography.297.xml
│ │ ├── citation-sbclter-bibliography.203.xml
│ │ ├── citation-sbclter-bibliography.202.xml
│ │ ├── citation-sbclter-bibliography.50.xml
│ │ ├── eml-citationWithContactReference.xml
│ │ ├── eml-citationWithContact.xml
│ │ ├── eml.xml
│ │ ├── identical-repeated-key-bibliography.289.xml
│ │ ├── eml-dataset.xml
│ │ ├── eml-softwareWithAcessDistribution.xml
│ │ ├── eml-datasetMultipleDistribution.xml
│ │ └── eml-datasetWithAccess.xml
│ └── eml-2.2.0
│ │ ├── eml-offline.xml
│ │ ├── eml-access.xml
│ │ ├── eml-party.xml
│ │ ├── eml-method.xml
│ │ ├── eml-project.xml
│ │ ├── eml-physical-inline.xml
│ │ ├── stmml_dictionaryWithDefintion.xml
│ │ ├── eml-literatureInPress.xml
│ │ ├── eml-datasetWhitespacePatterns.xml
│ │ ├── eml-literature.xml
│ │ ├── citation-sbclter-bibliography.233.xml
│ │ ├── eml-physical-inline-cdatasection.xml
│ │ ├── citation-sbclter-bibliography.231.xml
│ │ ├── citation-sbclter-bibliography.280.xml
│ │ ├── eml-entity.xml
│ │ ├── eml-physical.xml
│ │ ├── eml-view.xml
│ │ ├── citation-sbclter-bibliography.232.xml
│ │ ├── eml-protocol.xml
│ │ ├── eml-dataTable.xml
│ │ ├── eml-text.xml
│ │ ├── eml-2.2.0-milligramPerLiter.xml
│ │ ├── eml-spatialVector.xml
│ │ ├── citation-sbclter-bibliography.279.xml
│ │ ├── citation-sbclter-bibliography.51.xml
│ │ ├── citation-sbclter-bibliography.201.xml
│ │ ├── eml-inline.xml
│ │ ├── eml-storedProcedure.xml
│ │ ├── eml-datasetGRing.xml
│ │ ├── eml-software.xml
│ │ ├── citation-sbclter-bibliography.297.xml
│ │ ├── citation-sbclter-bibliography.203.xml
│ │ ├── citation-sbclter-bibliography.202.xml
│ │ ├── citation-sbclter-bibliography.50.xml
│ │ ├── eml-citationWithContactReference.xml
│ │ ├── eml-citationWithContact.xml
│ │ ├── eml-semantics.xml
│ │ ├── eml.xml
│ │ ├── eml-datasetNoSchemaLocationInvalid.xml
│ │ ├── eml-datasetGringpoint.xml
│ │ ├── skiptest-sbclter-bibliography.289.xml
│ │ ├── citation-sbclter-bibliography.289.xml
│ │ ├── eml-datasetNoSchemaLocation.xml
│ │ ├── eml-dataset.xml
│ │ ├── eml-software-dependency.xml
│ │ ├── eml-softwareWithAcessDistribution.xml
│ │ ├── eml-datasetMultipleDistribution.xml
│ │ └── eml-datasetWithAccess.xml
├── xsd
│ ├── eml-2.2.0
│ │ └── xml.xsd
│ └── eml-2.1.0
│ │ └── eml-documentation.xsd
├── CITATION
├── extdata
│ ├── example.xml
│ └── schema-org-dataset.json
└── notebook
│ └── emld_spec.Rmd
├── tests
├── testthat.R
├── spelling.R
└── testthat
│ ├── test-group_repeated_key.R
│ ├── test-template.R
│ ├── test-validator.R
│ ├── test-base.R
│ ├── test-version.R
│ └── test-rdf-roundtrip.R
├── .gitignore
├── data-raw
├── stmml_classes.txt
└── eml_db.R
├── CRAN-RELEASE
├── cran-comments.md
├── codecov.yml
├── test.sh
├── emld.Rproj
├── .travis.yml
├── .Rbuildignore
├── man
├── guess_root_schema.Rd
├── find_real_root_name.Rd
├── eml_ns.Rd
├── eml_version.Rd
├── template.Rd
├── as_emld.Rd
├── eml_validate.Rd
├── as_json.Rd
├── guess_schema_location.Rd
├── as_xml.Rd
└── emld-package.Rd
├── appveyor.yml
├── LICENSE.md
├── NAMESPACE
├── CODE_OF_CONDUCT.md
└── DESCRIPTION
/_pkgdown.yml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | YEAR: 2018
2 | COPYRIGHT HOLDER: Carl Boettiger
3 |
--------------------------------------------------------------------------------
/R/sysdata.rda:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/emld/HEAD/R/sysdata.rda
--------------------------------------------------------------------------------
/docs/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/emld/HEAD/docs/favicon.ico
--------------------------------------------------------------------------------
/notebook/ex1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/emld/HEAD/notebook/ex1.png
--------------------------------------------------------------------------------
/notebook/ex2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/emld/HEAD/notebook/ex2.png
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | from rocker/verse
2 |
3 | RUN apt-get update \
4 | && apt-get install -y libjq-dev
5 |
--------------------------------------------------------------------------------
/inst/examples/hf205-methods.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/emld/HEAD/inst/examples/hf205-methods.docx
--------------------------------------------------------------------------------
/inst/examples/hf205-abstract.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ropensci/emld/HEAD/inst/examples/hf205-abstract.docx
--------------------------------------------------------------------------------
/docs/pkgdown.yml:
--------------------------------------------------------------------------------
1 | pandoc: 2.7.3
2 | pkgdown: 1.4.1
3 | pkgdown_sha: ~
4 | articles:
5 | tutorial: tutorial.html
6 |
7 |
--------------------------------------------------------------------------------
/tests/testthat.R:
--------------------------------------------------------------------------------
1 | library(testthat)
2 | library(emld)
3 |
4 | options("emld_db" = "eml-2.2.0")
5 | test_check("emld")
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .Rproj.user
2 | .Rhistory
3 | .RData
4 | .Ruserdata
5 | inst/doc
6 | .DS_Store
7 | onboarding-submission.md
8 | test.R
9 |
--------------------------------------------------------------------------------
/R/emld-package.R:
--------------------------------------------------------------------------------
1 | #' @keywords internal
2 | "_PACKAGE"
3 |
4 | ## usethis namespace: start
5 | ## usethis namespace: end
6 | NULL
7 |
--------------------------------------------------------------------------------
/data-raw/stmml_classes.txt:
--------------------------------------------------------------------------------
1 | appinfo
2 | documentation
3 | annotation
4 | description
5 | dimension
6 | unitList
7 | unitType
8 | unit
9 |
--------------------------------------------------------------------------------
/CRAN-RELEASE:
--------------------------------------------------------------------------------
1 | This package was submitted to CRAN on 2020-09-27.
2 | Once it is accepted, delete this file and tag the release (commit ab6ccf7).
3 |
--------------------------------------------------------------------------------
/tests/spelling.R:
--------------------------------------------------------------------------------
1 | if(requireNamespace('spelling', quietly=TRUE))
2 | spelling::spell_check_test(vignettes = TRUE, error = FALSE, skip_on_cran = TRUE)
3 |
--------------------------------------------------------------------------------
/cran-comments.md:
--------------------------------------------------------------------------------
1 | Dear CRAN,
2 |
3 | This release provides the requested fix to use `xml2` 1.5.0, and addresses several
4 | unrelated bugs, as documented in NEWS.
5 |
6 | Cheers,
7 |
8 | Carl Boettiger
9 |
10 |
11 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | comment: false
2 |
3 | coverage:
4 | precision: 2
5 | round: down
6 | range: "65...100"
7 |
8 | status:
9 | project:
10 | default:
11 | threshold: 2%
12 | patch:
13 | default:
14 | target: auto
15 | threshold: 2%
16 | only_pulls: true
17 |
--------------------------------------------------------------------------------
/inst/WORDLIST:
--------------------------------------------------------------------------------
1 | AppVeyor
2 | EML
3 | EML's
4 | EML’s
5 | JQ
6 | LD
7 | ORCID
8 | RDF
9 | README
10 | Roundtrip
11 | SPARQL
12 | XPATH
13 | XPath
14 | XSD
15 | additionalMetadata
16 | bibentry
17 | eg
18 | eml
19 | framings
20 | github
21 | json
22 | jsonlite
23 | lifecycle
24 | packageId
25 | rOpenSci
26 | ropensci
27 | roundtrip
28 | roundtripped
29 |
--------------------------------------------------------------------------------
/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | echo 'devtools::install(dep=TRUE)
5 | status <- devtools::check()
6 | testthat::expect_length(status[["errors"]],0)
7 | testthat::expect_length(status[["warnings"]],0)
8 | status[["notes"]]' > test.R
9 |
10 | docker build . -t emld-tests
11 | docker run -ti \
12 | -v $(pwd):/home/rstudio/repo \
13 | -w /home/rstudio/repo \
14 | emld-tests \
15 | R -f test.R
16 |
--------------------------------------------------------------------------------
/inst/context/eml-2.1.1/eml-context.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": {
3 | "@vocab": "eml://ecoinformatics.org/eml-2.1.1/",
4 | "eml": "eml://ecoinformatics.org/eml-2.1.1/",
5 | "xsi": "http://www.w3.org/2001/XMLSchema-instance/",
6 | "xml": "http://www.w3.org/XML/1998/namespace",
7 | "stmml": "http://www.xml-cml.org/schema/stmml-1.1/",
8 | "id": "@id",
9 | "@base": "eml://"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/inst/context/eml-2.2.0/eml-context.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": {
3 | "@vocab": "https://eml.ecoinformatics.org/eml-2.2.0/",
4 | "eml": "https://eml.ecoinformatics.org/eml-2.2.0/",
5 | "xsi": "http://www.w3.org/2001/XMLSchema-instance/",
6 | "xml": "http://www.w3.org/XML/1998/namespace",
7 | "stmml": "http://www.xml-cml.org/schema/stmml-1.2/",
8 | "id": "@id",
9 | "@base": "eml://"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/inst/frame/eml-2.1.1/eml-frame.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": {
3 | "@vocab": "eml://ecoinformatics.org/eml-2.1.1/",
4 | "eml": "eml://ecoinformatics.org/eml-2.1.1/",
5 | "xsi": "http://www.w3.org/2001/XMLSchema-instance/",
6 | "xml": "http://www.w3.org/XML/1998/namespace",
7 | "stmml": "http://www.xml-cml.org/schema/stmml-1.1/",
8 | "id": "@id"
9 | },
10 | "@type": "EML",
11 | "@embed": "@always"
12 | }
13 |
--------------------------------------------------------------------------------
/inst/frame/eml-2.2.0/eml-frame.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context": {
3 | "@vocab": "https://eml.ecoinformatics.org/eml-2.2.0/",
4 | "eml": "https://eml.ecoinformatics.org/eml-2.2.0/",
5 | "xsi": "http://www.w3.org/2001/XMLSchema-instance/",
6 | "xml": "http://www.w3.org/XML/1998/namespace",
7 | "stmml": "http://www.xml-cml.org/schema/stmml-1.2/",
8 | "id": "@id"
9 | },
10 | "@type": "EML",
11 | "@embed": "@always"
12 | }
13 |
--------------------------------------------------------------------------------
/R/emld-methods.R:
--------------------------------------------------------------------------------
1 |
2 | #' @importFrom yaml as.yaml
3 | #' @importFrom jsonlite toJSON
4 | #' @export
5 | print.emld <- function(x, ...){
6 | x[["@context"]] <- NULL # context just adds clutter to display
7 | x[["@type"]] <- NULL
8 | style <- getOption("emld_print", "yaml")
9 | #cat("EML as an emld object:\n\n\n")
10 | switch(style,
11 | "yaml" = cat(yaml::as.yaml(x)),
12 | "json" = cat(jsonlite::toJSON(x, auto_unbox = TRUE, pretty = TRUE))
13 | )
14 | }
15 |
--------------------------------------------------------------------------------
/emld.Rproj:
--------------------------------------------------------------------------------
1 | Version: 1.0
2 |
3 | RestoreWorkspace: No
4 | SaveWorkspace: No
5 | AlwaysSaveHistory: Default
6 |
7 | EnableCodeIndexing: Yes
8 | UseSpacesForTab: Yes
9 | NumSpacesForTab: 2
10 | Encoding: UTF-8
11 |
12 | RnwWeave: knitr
13 | LaTeX: pdfLaTeX
14 |
15 | AutoAppendNewline: Yes
16 | StripTrailingWhitespace: Yes
17 |
18 | BuildType: Package
19 | PackageUseDevtools: Yes
20 | PackageInstallArgs: --no-multiarch --with-keep.source
21 | PackageRoxygenize: rd,collate,namespace
22 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | # R for travis: see documentation at https://docs.travis-ci.com/user/languages/r
2 | language: R
3 | cache: packages
4 | latex: false
5 |
6 | matrix:
7 | include:
8 | - os: linux
9 | r: devel
10 | - os: linux
11 | r: release
12 |
13 | addons:
14 | apt:
15 | sources:
16 | - sourceline: 'ppa:opencpu/jq'
17 | packages:
18 | - librdf0-dev
19 | - libv8-dev
20 | - libjq-dev
21 | after_success:
22 | - Rscript -e 'covr::codecov()'
23 |
--------------------------------------------------------------------------------
/data-raw/eml_db.R:
--------------------------------------------------------------------------------
1 | ## 2018-11-28
2 | ##
3 | ## Creates the `eml_db` reference list objects as internal data
4 | ## (in R/sysdata.rda) used by many core EML functions.
5 | ##
6 | ## The JSON files are currently created by XSD parsing scripts in
7 | ## data-raw/eml_schema_parser.R
8 |
9 |
10 | eml_db <- list("eml-2.1.1" = jsonlite::read_json("data-raw/eml-2.1.1.json"),
11 | "eml-2.2.0" = jsonlite::read_json("data-raw/eml-2.2.0.json"))
12 | usethis::use_data(eml_db, overwrite = TRUE, internal = TRUE)
13 |
--------------------------------------------------------------------------------
/.Rbuildignore:
--------------------------------------------------------------------------------
1 | ^CRAN-RELEASE$
2 | ^cran-comments\.md$
3 | ^codemeta\.json$
4 | ^CODE_OF_CONDUCT\.md$
5 | ^docs$
6 | ^_pkgdown\.yml$
7 | ^appveyor\.yml$
8 | ^.*\.Rproj$
9 | ^\.Rproj\.user$
10 | ^data-raw$
11 | ^notebook/
12 | ^README\.Rmd$
13 | ^README-.*\.png$
14 | ^\.travis\.yml$
15 | ^codecov\.yml$
16 | ^test\.sh$
17 | ^paper\.Rmd$
18 | ^paper\.md$
19 | ^paper\.bib$
20 | ^onboarding-submission\.md$
21 | LICENSE.md
22 | ^CONDUCT\.md$
23 | ^CONTRIBUTING\.md$
24 | ^\.github$
25 | .*-review.md$
26 | Dockerfile
27 | test.R
28 |
--------------------------------------------------------------------------------
/man/guess_root_schema.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eml_validate.R
3 | \name{guess_root_schema}
4 | \alias{guess_root_schema}
5 | \title{Find the root schema module and version}
6 | \usage{
7 | guess_root_schema(doc)
8 | }
9 | \arguments{
10 | \item{doc}{An \code{xml_document}}
11 | }
12 | \value{
13 | If found, a list with names 'version', 'module', and `namespace. If
14 | not found, throws an error.
15 | }
16 | \description{
17 | Find the root schema module and version
18 | }
19 |
--------------------------------------------------------------------------------
/inst/jq/eml_to_schema.jq:
--------------------------------------------------------------------------------
1 | .dataset |
2 | {
3 | id: .["@id"],
4 | type: .["@type"],
5 | temporalCoverage: .coverage.temporalCoverage.rangeOfDates |
6 | [.beginDate.calendarDate, .endDate.calendarDate] | join("/"),
7 | spatialCoverage: .coverage.geographicCoverage | {
8 | description: .geographicDescription,
9 | geo: {
10 | box: .boundingCoordinates |
11 | [.southBoundingCoordinate,
12 | .westBoundingCoordinate,
13 | .northBoundingCoordinate,
14 | .eastBoundingCoordinate] | join(" ")
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/testthat/test-group_repeated_key.R:
--------------------------------------------------------------------------------
1 | testthat::context("group repeated key")
2 |
3 | test_that("we can group repeated xml keys into json", {
4 | input <-
5 | '
6 | value1
7 | value2
8 | value3
9 | stuff
10 | '
11 |
12 | output <-
13 | '{
14 | "key" = ["value", "value2","value3"],
15 | "other" = "stuff"
16 | }'
17 |
18 | ## tests
19 | in_list <- xml2::as_list(xml2::read_xml(input))
20 | json <- jsonlite::toJSON(emld:::group_repeated_key(in_list), auto_unbox = TRUE)
21 | expect_is(json, "json")
22 |
23 | })
24 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-offline.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | offline_data
8 |
9 |
10 |
11 | myFormat
12 |
13 |
14 |
15 |
16 |
17 | my medium
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/inst/xsd/eml-2.2.0/xml.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-offline.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | offline_data
8 |
9 |
10 |
11 | myFormat
12 |
13 |
14 |
15 |
16 |
17 | my medium
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-units.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
7 |
9 |
10 |
--------------------------------------------------------------------------------
/man/find_real_root_name.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eml_validate.R
3 | \name{find_real_root_name}
4 | \alias{find_real_root_name}
5 | \title{Get the real \code{QName} for the root element, including its prefix}
6 | \usage{
7 | find_real_root_name(doc)
8 | }
9 | \arguments{
10 | \item{doc}{An \code{xml_document}}
11 | }
12 | \value{
13 | A \code{list} with elements \code{prefix} and \code{name}. \code{prefix} will be \code{NULL}
14 | if the element has no namespace prefix but \code{name} will always be a
15 | \code{character}.
16 | }
17 | \description{
18 | Note that if a default namespace is used, the prefix will be \code{d1}.
19 | }
20 |
--------------------------------------------------------------------------------
/inst/jq/schema_to_eml.jq:
--------------------------------------------------------------------------------
1 | . |
2 | {
3 | "@id": .["@id"],
4 | "@type": .["@type"],
5 | coverage: {
6 | temporalCoverage: {
7 | rangeOfDates: {
8 | beginDate : .temporalCoverage | split("/") |.[0],
9 | endDate : .temporalCoverage | split("/") |.[1]
10 | }
11 | },
12 | geographicCoverage: .spatialCoverage | {
13 | geographicDescription: .description,
14 | boundingCoordinates: {
15 | westBoundingCoordinate: .geo.box | split(" ") | .[1],
16 | eastBoundingCoordinate: .geo.box | split(" ") | .[3],
17 | northBoundingCoordinate: .geo.box | split(" ") | .[2],
18 | southBoundingCoordinate: .geo.box | split(" ") | .[0]
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/man/eml_ns.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eml_version.R
3 | \name{eml_ns}
4 | \alias{eml_ns}
5 | \title{Get the XML namespace for a version of EML}
6 | \usage{
7 | eml_ns(version = eml_version())
8 | }
9 | \arguments{
10 | \item{version}{EML version, currently either eml-2.2.0 (current version) or
11 | eml-2.1.1. Defaults to current version.}
12 | }
13 | \value{
14 | returns the full XML namespace URI for the specified version of the
15 | schema
16 | }
17 | \description{
18 | Utility function for use when filling in \code{xmlns}, \code{schemaLocation}, or
19 | \code{vocab} in various representations of EML. This is a little more future-proof
20 | than keeping a dictionary for each version since this won't break on the next
21 | release.
22 | }
23 |
--------------------------------------------------------------------------------
/tests/testthat/test-template.R:
--------------------------------------------------------------------------------
1 | testthat::context("template print method")
2 |
3 |
4 | test_that("We can show slots for the creator object", {
5 | expect_output(print(template("creator")), "individualName: \\{\\}")
6 | expect_output(print(template("creator")), "phone: ~")
7 |
8 | })
9 |
10 | test_that("template knows about internal classes too", {
11 | skip("internal class template deprecated")
12 | ## Only true in emld_db 2.1.1 right now... Probably deprecating this
13 | expect_output(print(template("ResponsibleParty")), "individualName: \\{\\}")
14 | })
15 |
16 | test_that("template knows about internal classes too", {
17 | options(emld_print = "json")
18 | expect_output(print(template("creator")), '"individualName": \\{\\}')
19 | options(emld_print = "yaml")
20 |
21 | })
22 |
23 |
24 |
--------------------------------------------------------------------------------
/man/eml_version.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eml_version.R
3 | \name{eml_version}
4 | \alias{eml_version}
5 | \title{Set or check the EML version default}
6 | \usage{
7 | eml_version(version = getOption("emld_db", "eml-2.2.0"))
8 | }
9 | \arguments{
10 | \item{version}{EML version, currently either eml-2.2.0 (current version), or
11 | eml-2.1.1. The 'eml-' prefix can be omitted.}
12 | }
13 | \value{
14 | returns the EML version string. As a side-effect, sets the
15 | requested version as the default version by setting the \code{emld_db}
16 | variable in \code{\link[=options]{options()}}.
17 | }
18 | \description{
19 | Set or check the EML version default
20 | }
21 | \examples{
22 | eml_version()
23 | eml_version("2.1.1")
24 | eml_version("eml-2.1.1")
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/tests/testthat/test-validator.R:
--------------------------------------------------------------------------------
1 |
2 |
3 | testthat::test_that("we can use emld validator", {
4 | f <- system.file("extdata", "example.xml", package = "emld")
5 | testthat::expect_true(eml_validate(f))
6 | testthat::expect_true(eml_validate(xml2::read_xml(f)))
7 | my_eml <- as_emld(f)
8 | testthat::expect_true(eml_validate(my_eml))
9 |
10 | testthat::expect_error(eml_validate(f, schema = "notafile"))
11 |
12 |
13 | })
14 |
15 |
16 | testthat::test_that("validation uses the right unitDictionary", {
17 | f <- system.file("tests", "eml-2.1.1", "invalid", "eml-2.1.1-invalidunit.xml", package = "emld")
18 | testthat::expect_warning(eml_validate(f), "not recognized")
19 |
20 | f <- system.file("tests", "eml-2.2.0", "eml-2.2.0-milligramPerLiter.xml", package = "emld")
21 | testthat::expect_true(eml_validate(f))
22 | })
23 |
--------------------------------------------------------------------------------
/R/emld.R:
--------------------------------------------------------------------------------
1 | #' emld: Ecological Metadata as Linked Data
2 | #'
3 | #' The goal of emld is to provide a way to work with EML metadata
4 | #' in the JSON-LD format. At it's heart, the package is simply a
5 | #' way to translate an EML XML document into JSON-LD and be able
6 | #' to reverse this so that any semantically equivalent JSON-LD
7 | #' file can be serialized into EML-schema valid XML.
8 | #'
9 | #' The package has only three core functions:
10 | #'
11 | #' - [as_emld()] Convert EML's `xml` files (or the `json` version created
12 | #' by this package) into a native R object (an S3 class called `emld`,
13 | #' essentially just a `list`).
14 | #' - [as_xml()] Convert the native R format, `emld`, back into
15 | #' XML-schema valid EML.
16 | #' - [as_json()] Convert the native R format, `emld`, into `json`(LD).
17 | #'
18 | "_PACKAGE"
19 |
--------------------------------------------------------------------------------
/man/template.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/template.R
3 | \name{template}
4 | \alias{template}
5 | \title{Create a template for an EML object}
6 | \usage{
7 | template(object)
8 | }
9 | \arguments{
10 | \item{object}{the name of an eml object to create}
11 | }
12 | \value{
13 | a list with elements named according to the properties of the object.
14 | This can be coerced into EML, see vignettes. NULL-valued elements (~)
15 | can take a data entry directly, while empty list()-valued elements ({})
16 | indicate properties that take other eml objects as values.
17 | }
18 | \description{
19 | Create a template for an EML object
20 | }
21 | \details{
22 | Note: while this function can be called in recursions, doing so may be a bad idea.
23 | }
24 | \examples{
25 | template("creator")
26 | }
27 |
--------------------------------------------------------------------------------
/inst/CITATION:
--------------------------------------------------------------------------------
1 |
2 | bibentry(
3 | bibtype = 'article',
4 | title = 'Ecological Metadata as Linked Data. Journal of Open Source Software',
5 | author = c(
6 | person( "Carl",
7 | "Boettiger",
8 | role = c("cre", "aut"),
9 | email = "cboettig@gmail.com",
10 | comment = c(ORCID = "http://orcid.org/0000-0002-1642-628X")
11 | )),
12 | month = 'feb',
13 | year = '2019',
14 | publisher = 'The Open Journals',
15 | journal = 'The Journal of Open Source Software',
16 | number = 34,
17 | volume = 4,
18 | pages = 1276,
19 | doi = '10.21105/joss.01276',
20 | url = 'https://doi.org/10.21105/joss.01276',
21 | textVersion = paste('Boettiger, (2019). Ecological Metadata as Linked Data.',
22 | 'Journal of Open Source Software, 4(34), 1276, https://doi.org/10.21105/joss.01276')
23 | )
24 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-party.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | University of California
9 |
10 |
11 | 123 Campus Dr.
12 | Santa Barbara
13 | CA
14 | 93101
15 | USA
16 |
17 |
18 | 805-123-1234
19 |
20 | joe@something.org
21 | www.something.org/~joe
22 | joe
23 |
24 |
--------------------------------------------------------------------------------
/docs/link.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
13 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-access.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | uid=brooke,o=NCEAS,dc=ecoinformatics,dc=org
10 | all
11 |
12 |
13 | public
14 | read
15 |
16 |
17 | uid=berkley,o=NCEAS,dc=ecoinformatics,dc=org
18 | read
19 | write
20 | all
21 |
22 |
23 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-access.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 | uid=brooke,o=NCEAS,dc=ecoinformatics,dc=org
9 | all
10 |
11 |
12 | public
13 | read
14 |
15 |
16 | uid=berkley,o=NCEAS,dc=ecoinformatics,dc=org
17 | read
18 | write
19 | all
20 |
21 |
22 |
--------------------------------------------------------------------------------
/man/as_emld.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/as_emld.R
3 | \name{as_emld}
4 | \alias{as_emld}
5 | \title{Coerce an EML file or object into an emld object.}
6 | \usage{
7 | as_emld(x, from = c("guess", "xml", "json", "list"))
8 | }
9 | \arguments{
10 | \item{x}{path to an EML file}
11 |
12 | \item{from}{explicit type for the input format. By default, will
13 | attempt to guess the format, but it always safer to specify the
14 | input format. This is essential for literal text strings or raw
15 | vectors where the type cannot be guessed by the R object class
16 | or file extension of the input.}
17 | }
18 | \value{
19 | an emld object
20 | }
21 | \description{
22 | Coerce an EML file or object into an emld object.
23 | }
24 | \examples{
25 | hf205 <- system.file("extdata/hf205.xml", package="emld")
26 | as_emld(hf205)
27 | }
28 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-party.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | University of California
9 |
10 |
11 | 123 Campus Dr.
12 | Santa Barbara
13 | CA
14 | 93101
15 | USA
16 |
17 |
18 | 805-123-1234
19 |
20 | joe@something.org
21 | http://www.something.org/~joe
22 | https://orcid.org/0000-0002-1825-0097
23 |
24 |
--------------------------------------------------------------------------------
/tests/testthat/test-base.R:
--------------------------------------------------------------------------------
1 | testthat::context("base methods")
2 |
3 | ## These tests show round trips with base jsonld and xml2 methods
4 | ## independent of the methods built into this package. The tests show
5 | ## that even these require a little care to work successfully
6 |
7 | library(jsonld)
8 | library(jsonlite)
9 | library(magrittr)
10 | library(xml2)
11 |
12 |
13 | test_that("we can roundtrip JSON-LD expansion and compaction", {
14 |
15 |
16 | ex <- system.file("extdata/hf205.json", package = "emld")
17 |
18 | x <- jsonlite::read_json(ex)
19 | json_context <- toJSON(x[["@context"]], auto_unbox = TRUE)
20 | roundtrip <-
21 | jsonld_expand(ex) %>%
22 | jsonld_compact(json_context)
23 |
24 | A <- unlist(read_json(ex))
25 | B <- unlist(fromJSON(roundtrip,simplifyVector = FALSE))
26 | testthat::expect_equivalent(length(A),
27 | length(B))
28 |
29 | })
30 |
31 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-method.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | some method
9 | stethescope
10 |
11 |
12 | some method
13 | stethescope
14 |
15 |
16 |
17 |
18 | some description
19 |
20 |
21 |
22 | we sampled some fishes
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/tests/testthat/test-version.R:
--------------------------------------------------------------------------------
1 | testthat::context("version")
2 |
3 | test_that("we can get the namespace for different EML versions", {
4 | expect_equal(eml_ns("eml-2.0.0"), "eml://eml.ecoinformatics.org/eml-2.0.0")
5 | expect_equal(eml_ns("eml-2.1.1"), "eml://eml.ecoinformatics.org/eml-2.1.1")
6 | expect_equal(eml_ns("eml-2.2.0"), "https://eml.ecoinformatics.org/eml-2.2.0")
7 | expect_equal(eml_ns("eml-2.2.1"), "https://eml.ecoinformatics.org/eml-2.2.1")
8 | })
9 |
10 | test_that("we can set the EML version", {
11 | expect_equal(eml_version("eml-2.1.1"), "eml-2.1.1")
12 | expect_equal(eml_version("eml-2.2.0"), "eml-2.2.0")
13 | expect_equal(eml_version("2.1.1"), "eml-2.1.1")
14 | expect_equal(eml_version("2.2.0"), "eml-2.2.0")
15 | })
16 |
17 | test_that("we throw a warning when a user specifies an invalid version", {
18 | expect_warning(eml_version("a"))
19 | expect_warning(eml_version("eml2.1.1"))
20 | })
21 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-method.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | some method
9 | stethescope
10 |
11 |
12 | some method
13 | stethescope
14 |
15 |
16 |
17 |
18 | some description
19 |
20 |
21 |
22 | we sampled some fishes
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-project.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | fish counting project
8 |
9 |
10 | University of California
11 |
12 |
13 | 123 Campus Dr.
14 | Santa Barbara
15 | CA
16 | 93101
17 | USA
18 |
19 |
20 | 805-123-1234
21 |
22 | joe@something.org
23 | www.something.org/~joe
24 | fish counter
25 |
26 |
27 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-project.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | fish counting project
8 |
9 |
10 | University of California
11 |
12 |
13 | 123 Campus Dr.
14 | Santa Barbara
15 | CA
16 | 93101
17 | USA
18 |
19 |
20 | 805-123-1234
21 |
22 | joe@something.org
23 | www.something.org/~joe
24 | fish counter
25 |
26 |
27 |
--------------------------------------------------------------------------------
/notebook/jq_maps.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | output: github_document
3 | ---
4 |
5 | # Mapping between Schema.Org and EML via JQ
6 |
7 |
8 |
9 | We will use J-Query as XSLT-like stylesheets. These two examples shipping in this package are currently a work in progress:
10 |
11 | ```{r}
12 | library(jqr)
13 | ```
14 |
15 |
16 | ```{r}
17 | eml_to_schema <- readr::read_file(system.file("jq/eml_to_schema.jq", package="emld"))
18 | schema_to_eml <- readr::read_file(system.file("jq/schema_to_eml.jq", package="emld"))
19 |
20 | ```
21 |
22 |
23 | Let's map a more complete EML document into schema.org:
24 |
25 | ```{r}
26 | eml <- readr::read_file("https://raw.githubusercontent.com/cboettig/emld/master/inst/extdata/hf205.json")
27 | jq(eml, eml_to_schema)
28 | ```
29 |
30 |
31 |
32 | Convert a dataset marked up in terms into EML
33 |
34 | ```{r}
35 | schema <- readr::read_file("../inst/extdata/schema-org-dataset.json")
36 |
37 | jq(schema, schema_to_eml)
38 | ```
39 |
40 |
41 |
--------------------------------------------------------------------------------
/man/eml_validate.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eml_validate.R
3 | \name{eml_validate}
4 | \alias{eml_validate}
5 | \title{eml_validate}
6 | \usage{
7 | eml_validate(eml, encoding = "UTF-8", schema = NULL)
8 | }
9 | \arguments{
10 | \item{eml}{file path, xml_document,}
11 |
12 | \item{encoding}{optional encoding for files, default UTF-8.}
13 |
14 | \item{schema}{path to schema}
15 | }
16 | \value{
17 | Whether the document is valid (logical)
18 | }
19 | \description{
20 | eml_validate processes an EML document using the XSD schema for the
21 | appropriate version of EML and determines if the document is schema-valid
22 | as defined by the XSD specification
23 | }
24 | \examples{
25 | \donttest{
26 |
27 | f <- system.file("extdata", "example.xml", package = "emld")
28 |
29 | ## validate file directly from disk:
30 | eml_validate(f)
31 |
32 | ## validate an eml object:
33 | eml <- as_emld(f)
34 | eml_validate(eml)
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-physical-inline.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | data.txt
8 | 4096
9 |
10 |
11 |
12 | 1
13 | \n
14 | 6
15 | column
16 |
17 | ,
18 | "
19 | \
20 |
21 |
22 |
23 |
24 |
25 | x,y,z
26 | 1,2,3
27 | 4,5,6
28 | 7,8,9
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-physical-inline.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | data.txt
8 | 4096
9 |
10 |
11 |
12 | 1
13 | \n
14 | 6
15 | column
16 |
17 | ,
18 | "
19 | \
20 |
21 |
22 |
23 |
24 |
25 | x,y,z
26 | 1,2,3
27 | 4,5,6
28 | 7,8,9
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/stmml_dictionaryWithDefintion.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 | a definition of my term
11 | myterm1
12 | description of myterm
13 | related entry for my term
14 |
15 |
16 | description of my other term
17 | another description, but a defintion is not allowed
18 |
19 | any text here.
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/stmml_dictionaryWithDefintion.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 | a definition of my term
11 | myterm1
12 | description of myterm
13 | related entry for my term
14 |
15 |
16 | description of my other term
17 | another description, but a defintion is not allowed
18 |
19 | any text here.
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/inst/examples/hf205-abstract.md:
--------------------------------------------------------------------------------
1 | The primary goal of this project is to determine
2 | experimentally the amount of lead time required to prevent a state
3 | change. To achieve this goal, we will (1) experimentally induce state
4 | changes in a natural aquatic ecosystem - the Sarracenia microecosystem;
5 | (2) use proteomic analysis to identify potential indicators of states
6 | and state changes; and (3) test whether we can forestall state changes
7 | by experimentally intervening in the system. This work uses state-of-the
8 | art molecular tools to identify early warning indicators in the field
9 | of aerobic to anaerobic state changes driven by nutrient enrichment
10 | in an aquatic ecosystem. The study tests two general hypotheses: (1)
11 | proteomic biomarkers can function as reliable indicators of impending
12 | state changes and may give early warning before increasing variances
13 | and statistical flickering of monitored variables; and (2) well-timed
14 | intervention based on proteomic biomarkers can avert future state changes
15 | in ecological systems.
--------------------------------------------------------------------------------
/inst/extdata/example.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 | Data from Cedar Creek LTER on productivity and species richness
11 | for use in a workshop titled "An Analysis of the Relationship between
12 | Productivity and Diversity using Experimental Results from the Long-Term
13 | Ecological Research Network" held at NCEAS in September 1996.
14 |
15 |
16 | Mr.
17 | Clarence
18 | MiddleName
19 | Lehman
20 |
21 |
22 |
23 | clarence.lehman
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/notebook/big_solr_query.R:
--------------------------------------------------------------------------------
1 | library("httr")
2 | library("jsonlite")
3 | library("jsonld")
4 | library("tidyverse")
5 | source(system.file("examples/solr_functions.R", package="emld"))
6 |
7 | ## See: https://cn.dataone.org/cn/v2/query/solr
8 |
9 | numFound <-
10 | GET(paste0("https://knb.ecoinformatics.org/knb/d1/mn/v2/query/solr",
11 | "?q=-obsoletedBy:*&fl=identifier&rows=1")) %>%
12 | content() %>%
13 | xml2::xml_find_first("//result") %>%
14 | xml2::xml_attr("numFound") %>%
15 | as.integer()
16 | message(paste(numFound, "records found"))
17 | rows <- 1000
18 | n_calls <- numFound %/% rows
19 |
20 | query <-
21 | paste0(
22 | "https://knb.ecoinformatics.org/knb/d1/mn/v2/query/solr?",
23 | "q=*:*&fl=identifier,",
24 | "northBoundCoord,eastBoundCoord,southBoundCoord,westBoundCoord,",
25 | "namedLocation,geohash_9",
26 | "scientificName,kingdom,phylum,class,order,family,genus,species,",
27 | "beginDate,endDate,originator",
28 | "&wt=json",
29 | "&-obsoletedBy:*",
30 | "&start=", rows*(0:n_calls), "&rows=", rows)
31 |
32 | df <- map_df(query, solr_df)
33 |
34 |
--------------------------------------------------------------------------------
/man/as_json.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/as_json.R
3 | \name{as_json}
4 | \alias{as_json}
5 | \title{Coerce an emld object into JSON}
6 | \usage{
7 | as_json(x, file = NULL)
8 | }
9 | \arguments{
10 | \item{x}{an emld object}
11 |
12 | \item{file}{optional path to write out to file.
13 | Otherwise, defaults to NULL and will return a json object.}
14 | }
15 | \value{
16 | a json object. Or if a file path is provided, the metadata
17 | is written out in JSON file and the function returns \code{NULL} invisibly.
18 | }
19 | \description{
20 | Coerce an emld object into JSON
21 | }
22 | \details{
23 | Note: since emld list object maintains a 1:1 correspondence with JSON,
24 | following the conventions of jsonlite, this function is basically trivial. The
25 | only purpose is to default to auto_unbox = TRUE in serializing lists to JSON.
26 | }
27 | \examples{
28 | f <- system.file("extdata/example.xml", package = "emld")
29 | emld <- as_emld(f)
30 | json <- as_json(emld)
31 | ## can also write a json file to disk:
32 | json_file <- tempfile()
33 | as_json(emld, json_file)
34 | }
35 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | # DO NOT CHANGE the "init" and "install" sections below
2 | environment:
3 | global:
4 | USE_RTOOLS: true
5 |
6 | # Download script file from GitHub
7 | init:
8 | - ps: |
9 | $ErrorActionPreference = "Stop"
10 | Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1"
11 | Import-Module '..\appveyor-tool.ps1'
12 |
13 |
14 | install:
15 | - ps: Bootstrap
16 |
17 | cache:
18 | - C:\RLibrary
19 |
20 | # Adapt as necessary starting from here
21 |
22 | build_script:
23 | - travis-tool.sh install_deps
24 |
25 | test_script:
26 | - travis-tool.sh run_tests
27 |
28 | on_failure:
29 | - 7z a failure.zip *.Rcheck\*
30 | - appveyor PushArtifact failure.zip
31 |
32 | artifacts:
33 | - path: '*.Rcheck\**\*.log'
34 | name: Logs
35 |
36 | - path: '*.Rcheck\**\*.out'
37 | name: Logs
38 |
39 | - path: '*.Rcheck\**\*.fail'
40 | name: Logs
41 |
42 | - path: '*.Rcheck\**\*.Rout'
43 | name: Logs
44 |
45 | - path: '\*_*.tar.gz'
46 | name: Bits
47 |
48 | - path: '\*_*.zip'
49 | name: Bits
50 |
--------------------------------------------------------------------------------
/man/guess_schema_location.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/eml_version.R
3 | \name{guess_schema_location}
4 | \alias{guess_schema_location}
5 | \title{Guess an appropriate \code{schemaLocation} value for a given version of the schema}
6 | \usage{
7 | guess_schema_location(version = eml_version())
8 | }
9 | \arguments{
10 | \item{version}{Optional. Override the version of the schema. Defaults to the
11 | current version returned by \code{eml_version}. See \code{eml_version} for information
12 | on how to change the current version.}
13 | }
14 | \value{
15 | Returns a string suitable as a value for \code{schemaLocation} or \code{NULL}
16 | if a value wasn't found.
17 | }
18 | \description{
19 | This is a simple helper to make filling in the \code{schemaLocation} attribute
20 | on documents this package creates. Supports EML 2.1.1 and newer.
21 | }
22 | \examples{
23 | \dontrun{
24 | # Get an appropriate schemaLocation value for the current version fo EML
25 | guess_schema_location()
26 |
27 | # Get an appropriate value for EML 2.1.1
28 | guess_schema_location("eml-2.1.1")
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | # MIT License
2 |
3 | Copyright (c) 2018 Carl Boettiger
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-literatureInPress.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Measuring the effectiveness of EML in the field.
8 |
9 |
10 | Matthew
11 | B.
12 | Jones
13 |
14 |
15 | 2002
16 | this is the abstract without TextType elements.
17 | This is the abstract's first paragraph.
18 | This is the abstract's second paragraph. With
19 | emphasis.
20 |
21 |
22 | Journal of Irreproducible Results
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-datasetWhitespacePatterns.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | A title:
7 | with
8 | carriage returns
9 | and newlines
10 |
11 |
12 | this surname-is-hyphenated
13 |
14 |
15 | keyword with leading whitespaces
16 |
17 |
18 | organization has leading whitespace and and trailing newline
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-literatureInPress.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Measuring the effectiveness of EML in the field.
8 |
9 |
10 | Matthew
11 | B.
12 | Jones
13 |
14 |
15 | 2002
16 | this is the abstract without TextType elements.
17 | This is the abstract's first paragraph.
18 | This is the abstract's second paragraph. With
19 | emphasis.
20 |
21 |
22 | Journal of Irreproducible Results
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-literature.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Measuring the effectiveness of EML in the field.
8 |
9 |
10 | Matthew
11 | B.
12 | Jones
13 |
14 |
15 | 2002
16 | this is the abstract without TextType elements.
17 | This is the abstract's first paragraph.
18 | This is the abstract's second paragraph. With
19 | emphasis.
20 |
21 |
22 | Journal of Irreproducible Results
23 | 23
24 | 5
25 | 44-63
26 |
27 |
28 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-datasetWhitespacePatterns.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 | A title:
7 | with
8 | carriage returns
9 | and newlines
10 |
11 |
12 | this surname-is-hyphenated
13 |
14 |
15 | keyword with leading whitespaces
16 |
17 |
18 | organization has leading whitespace and and trailing newline
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-literature.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Measuring the effectiveness of EML in the field.
8 |
9 |
10 | Matthew
11 | B.
12 | Jones
13 |
14 |
15 | 2002
16 | this is the abstract without TextType elements.
17 | This is the abstract's first paragraph.
18 | This is the abstract's second paragraph. With
19 | emphasis.
20 |
21 |
22 | Journal of Irreproducible Results
23 | 23
24 | 5
25 | 44-63
26 |
27 |
28 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.233.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 233
10 | Charting the course of human waste migration from watersheds through coastal waters
11 |
12 |
13 | P
14 | A
15 | Holden
16 |
17 |
18 | 2004
19 |
20 | 2004 ASLO Ocean Sciences
21 |
22 | Honolulu
23 | HI
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.233.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 233
10 | Charting the course of human waste migration from watersheds through coastal waters
11 |
12 |
13 | P
14 | A
15 | Holden
16 |
17 |
18 | 2004
19 |
20 | 2004 ASLO Ocean Sciences
21 |
22 | Honolulu
23 | HI
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-physical-inline-cdatasection.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | data.txt
8 | 4096
9 |
10 |
11 |
12 | 1
13 | \n
14 | 6
15 | column
16 |
17 | ,
18 | "
19 | \
20 |
21 |
22 |
23 |
24 |
25 |
26 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-physical-inline-cdatasection.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | data.txt
8 | 4096
9 |
10 |
11 |
12 | 1
13 | \n
14 | 6
15 | column
16 |
17 | ,
18 | "
19 | \
20 |
21 |
22 |
23 |
24 |
25 |
26 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/NAMESPACE:
--------------------------------------------------------------------------------
1 | # Generated by roxygen2: do not edit by hand
2 |
3 | S3method(as_emld,character)
4 | S3method(as_emld,json)
5 | S3method(as_emld,list)
6 | S3method(as_emld,raw)
7 | S3method(as_emld,xml_document)
8 | S3method(as_json,emld)
9 | S3method(as_json,list)
10 | S3method(as_jsonlist,xml_node)
11 | S3method(as_jsonlist,xml_nodeset)
12 | S3method(as_xml,emld)
13 | S3method(as_xml,list)
14 | S3method(print,emld)
15 | export(as_emld)
16 | export(as_json)
17 | export(as_xml)
18 | export(eml_validate)
19 | export(eml_version)
20 | export(template)
21 | importFrom(jsonld,jsonld_compact)
22 | importFrom(jsonld,jsonld_frame)
23 | importFrom(jsonlite,toJSON)
24 | importFrom(methods,is)
25 | importFrom(stats,setNames)
26 | importFrom(xml2,read_xml)
27 | importFrom(xml2,xml_add_child)
28 | importFrom(xml2,xml_attr)
29 | importFrom(xml2,xml_attrs)
30 | importFrom(xml2,xml_contents)
31 | importFrom(xml2,xml_find_all)
32 | importFrom(xml2,xml_find_first)
33 | importFrom(xml2,xml_name)
34 | importFrom(xml2,xml_new_document)
35 | importFrom(xml2,xml_ns)
36 | importFrom(xml2,xml_remove)
37 | importFrom(xml2,xml_root)
38 | importFrom(xml2,xml_set_attr)
39 | importFrom(xml2,xml_set_namespace)
40 | importFrom(xml2,xml_text)
41 | importFrom(xml2,xml_type)
42 | importFrom(xml2,xml_validate)
43 | importFrom(yaml,as.yaml)
44 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.231.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 231
10 | Water interfaces and environmental complexity at the microscale (Plenary talk)
11 |
12 |
13 | P
14 | A
15 | Holden
16 |
17 |
18 | 2004
19 |
20 | Water: Challenges at the Intersection of Human and Natural Systems Workshop, a PNL sponsored NSF/DOE Workshop
21 | September 16-17, 2004
22 |
23 | Richland
24 | WA
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/R/as_json.R:
--------------------------------------------------------------------------------
1 | #' Coerce an emld object into JSON
2 | #'
3 | #' @param x an emld object
4 | #' @param file optional path to write out to file.
5 | #' Otherwise, defaults to NULL and will return a json object.
6 | #' @export
7 | #' @details Note: since emld list object maintains a 1:1 correspondence with JSON,
8 | #' following the conventions of jsonlite, this function is basically trivial. The
9 | #' only purpose is to default to auto_unbox = TRUE in serializing lists to JSON.
10 | #' @examples
11 | #' f <- system.file("extdata/example.xml", package = "emld")
12 | #' emld <- as_emld(f)
13 | #' json <- as_json(emld)
14 | #' ## can also write a json file to disk:
15 | #' json_file <- tempfile()
16 | #' as_json(emld, json_file)
17 | #' @return a json object. Or if a file path is provided, the metadata
18 | #' is written out in JSON file and the function returns `NULL` invisibly.
19 | as_json <- function(x, file=NULL){ UseMethod("as_json") }
20 |
21 | #' @export
22 | as_json.emld <- function(x, file=NULL){
23 | # x <- drop_nulls(x) # recursion sometimes infinite / beyond stack limit
24 | if(is.null(file)){
25 | jsonlite::toJSON(x, pretty = TRUE, auto_unbox = TRUE)
26 | } else {
27 | jsonlite::write_json(x, file, pretty = TRUE, auto_unbox = TRUE)
28 | }
29 | }
30 |
31 | #' @export
32 | as_json.list <- function(x, file=NULL){
33 | class(x) <- c("emld", "list")
34 | as_json(x)
35 | }
36 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.231.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 231
10 | Water interfaces and environmental complexity at the microscale (Plenary talk)
11 |
12 |
13 | P
14 | A
15 | Holden
16 |
17 |
18 | 2004
19 |
20 | Water: Challenges at the Intersection of Human and Natural Systems Workshop, a PNL sponsored NSF/DOE Workshop
21 | September 16-17, 2004
22 |
23 | Richland
24 | WA
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.280.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 280
10 | Catchment and Sub-catchment Scale Linkages between Land Use and Nutrient Concentrations and Fluxes in Coastal California Streams
11 |
12 |
13 | T
14 | H
15 | Robinson
16 |
17 |
18 | 2006
19 |
20 | Ph.D.
21 |
22 | Bren School of Environmental Science and Management
23 |
24 | University of California
25 | Santa Barbara
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.280.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 280
10 | Catchment and Sub-catchment Scale Linkages between Land Use and Nutrient Concentrations and Fluxes in Coastal California Streams
11 |
12 |
13 | T
14 | H
15 | Robinson
16 |
17 |
18 | 2006
19 |
20 | Ph.D.
21 |
22 | Bren School of Environmental Science and Management
23 |
24 | University of California
25 | Santa Barbara
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-entity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | TEMPID234
8 | Test Data
9 | This is a test entity that is fake.
10 |
11 |
12 | rain
13 | Surface Rainfall
14 | The amount of rainfall on the sampling unit.
15 |
16 | float
17 | double
18 |
19 |
20 | millimeter
21 | 0.5
22 |
23 | real
24 |
25 | 0
26 |
27 |
28 |
29 |
30 |
31 |
32 | some other entity
33 |
34 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-physical.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | data.txt
8 | 22
9 |
10 |
11 |
12 | 1
13 | \n
14 | 10
15 | column
16 |
17 |
18 | ,
19 | "
20 | \
21 |
22 |
23 | 7
24 |
25 |
26 | 4
27 |
28 |
29 | ,
30 | "
31 | \
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | http://www.somewhere.org/data.txt
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-view.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | TEMPID234
8 | Test Data
9 | This is a test entity that is fake.
10 |
11 |
12 | rain
13 | Surface Rainfall
14 | The amount of rainfall on the sampling unit.
15 |
16 | float
17 | double
18 |
19 |
20 | millimeter
21 | 0.5
22 |
23 | real
24 |
25 | 0
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | select * from xml_documents;
35 |
36 |
37 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-entity.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | TEMPID234
8 | Test Data
9 | This is a test entity that is fake.
10 |
11 |
12 | rain
13 | Surface Rainfall
14 | The amount of rainfall on the sampling unit.
15 |
16 | float
17 | double
18 |
19 |
20 | millimeter
21 | 0.5
22 |
23 | real
24 |
25 | 0
26 |
27 |
28 |
29 |
30 |
31 |
32 | some other entity
33 |
34 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-physical.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | data.txt
8 | 22
9 |
10 |
11 |
12 | 1
13 | \n
14 | 10
15 | column
16 |
17 |
18 | ,
19 | "
20 | \
21 |
22 |
23 | 7
24 |
25 |
26 | 4
27 |
28 |
29 | ,
30 | "
31 | \
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | http://www.somewhere.org/data.txt
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-view.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | TEMPID234
8 | Test Data
9 | This is a test entity that is fake.
10 |
11 |
12 | rain
13 | Surface Rainfall
14 | The amount of rainfall on the sampling unit.
15 |
16 | float
17 | double
18 |
19 |
20 | millimeter
21 | 0.5
22 |
23 | real
24 |
25 | 0
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | select * from xml_documents;
35 |
36 |
37 |
--------------------------------------------------------------------------------
/notebook/get_all_eml.R:
--------------------------------------------------------------------------------
1 | library("httr")
2 | library("jsonlite")
3 | library("jsonld")
4 | library("tidyverse")
5 | library("xml2")
6 | source(system.file("examples/solr_functions.R", package="emld"))
7 |
8 | ## See: https://cn.dataone.org/cn/v2/query/solr/
9 |
10 | eml_solr_query <-
11 | "http://cn.dataone.org/cn/v2/query/solr/?q=formatId:eml*+AND+-obsoletedBy:*"
12 |
13 | numFound <-
14 | GET(eml_solr_query) %>%
15 | content() %>%
16 | xml2::xml_find_first("//result") %>%
17 | xml2::xml_attr("numFound") %>%
18 | as.integer()
19 | message(paste(numFound, "records found"))
20 | rows <- 1000
21 | n_calls <- numFound %/% rows
22 |
23 |
24 |
25 | query <-
26 | paste0(eml_solr_query,
27 | "&fl=identifier,formatId,dataUrl,fileName",
28 | "&wt=json",
29 | "&start=", rows*(0:n_calls), "&rows=", rows)
30 |
31 | solr_df <- function(q){
32 | message(paste(q))
33 | resp <- GET(q)
34 | if(!grepl("json", headers(resp)$`content-type`))
35 | return(tibble())
36 | json <- jsonlite::fromJSON(content(resp, as = "text"))
37 | json$response$docs
38 | }
39 |
40 | df <- map_dfr(query, solr_df)
41 |
42 | eml <- df %>%
43 | mutate(name = paste0("emls/", gsub("[\\/\\.]", "_", identifier), ".xml"))
44 |
45 | readr::write_csv(eml, "eml-solrs.csv.bz2")
46 |
47 |
48 | safe_down <- safely(function(url, dest){
49 | if(!file.exists(dest))
50 | download.file(url, dest)
51 | })
52 |
53 | dir.create("emls", FALSE)
54 | map2(eml$name, eml$dataUrl, ~safe_down(.y, .x))
55 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | As contributors and maintainers of this project, we pledge to respect all people who
4 | contribute through reporting issues, posting feature requests, updating documentation,
5 | submitting pull requests or patches, and other activities.
6 |
7 | We are committed to making participation in this project a harassment-free experience for
8 | everyone, regardless of level of experience, gender, gender identity and expression,
9 | sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
10 |
11 | Examples of unacceptable behavior by participants include the use of sexual language or
12 | imagery, derogatory comments or personal attacks, trolling, public or private harassment,
13 | insults, or other unprofessional conduct.
14 |
15 | Project maintainers have the right and responsibility to remove, edit, or reject comments,
16 | commits, code, wiki edits, issues, and other contributions that are not aligned to this
17 | Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
18 | from the project team.
19 |
20 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
21 | opening an issue or contacting one or more of the project maintainers.
22 |
23 | This Code of Conduct is adapted from the Contributor Covenant
24 | (http://contributor-covenant.org), version 1.0.0, available at
25 | http://contributor-covenant.org/version/1/0/0/
26 |
--------------------------------------------------------------------------------
/R/template.R:
--------------------------------------------------------------------------------
1 |
2 | ## Warning: do not attempt to request `recursive` on high-level objects
3 |
4 |
5 | #' Create a template for an EML object
6 | #'
7 | #' @param object the name of an eml object to create
8 | #'
9 | #' @return a list with elements named according to the properties of the object.
10 | #' This can be coerced into EML, see vignettes. NULL-valued elements (~)
11 | #' can take a data entry directly, while empty list()-valued elements ({})
12 | #' indicate properties that take other eml objects as values.
13 | #' @details Note: while this function can be called in recursions, doing so may be a bad idea.
14 | #' @export
15 | #'
16 | #' @examples
17 | #' template("creator")
18 | template <- function(object){
19 | properties <- gsub("^(@|#)", "", eml_db[[eml_version()]][[object]])
20 |
21 | output <- vector("list", length(properties))
22 | names(output) <- properties
23 |
24 |
25 | ## Recursive call is trouble, just single depth
26 | names(properties) <- properties
27 | children <-
28 | vapply(properties,
29 | function(x){
30 | properties <- eml_db[[eml_version()]][[x]]
31 | drop <- grep("^(@|#)\\w+", properties)
32 | if(length(drop) > 0 ) properties <- properties[-drop]
33 | length(properties)
34 | },
35 | integer(1))
36 |
37 |
38 | for(n in names(which(children > 0)))
39 | output[[n]] <- setNames(list(), character(0))
40 | class(output) <- c("emld", "list")
41 | output
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.232.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 232
10 | Molecular community analysis in environmental monitoring
11 |
12 |
13 | P
14 | A
15 | Holden
16 |
17 |
18 |
19 |
20 | M
21 | G
22 | LaMontagne
23 |
24 |
25 | 2004
26 |
27 | Association of Environmental Health Sciences (AEHS)
28 | March 16, 2004
29 |
30 | San Diego
31 | CA
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-protocol.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | fish counting
9 |
10 |
11 |
12 | University of California
13 |
14 |
15 | 123 Campus Dr.
16 | Santa Barbara
17 | CA
18 | 93101
19 | USA
20 |
21 |
22 | 805-123-1234
23 |
24 | joe@something.org
25 | www.something.org/~joe
26 |
27 | 1999
28 | English
29 |
30 | fish
31 | lake
32 | jim's thesaurus
33 |
34 |
35 | This is some other fake info.
36 |
37 |
38 |
39 |
40 |
41 | catch a fish, make a hash mark, weigh it,
42 | enter the data in the spreadsheet
43 |
44 |
45 | scale
46 |
47 |
48 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.232.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 232
10 | Molecular community analysis in environmental monitoring
11 |
12 |
13 | P
14 | A
15 | Holden
16 |
17 |
18 |
19 |
20 | M
21 | G
22 | LaMontagne
23 |
24 |
25 | 2004
26 |
27 | Association of Environmental Health Sciences (AEHS)
28 | March 16, 2004
29 |
30 | San Diego
31 | CA
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-protocol.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | fish counting
9 |
10 |
11 |
12 | University of California
13 |
14 |
15 | 123 Campus Dr.
16 | Santa Barbara
17 | CA
18 | 93101
19 | USA
20 |
21 |
22 | 805-123-1234
23 |
24 | joe@something.org
25 | www.something.org/~joe
26 |
27 | 1999
28 | English
29 |
30 | fish
31 | lake
32 | jim's thesaurus
33 |
34 |
35 | This is some other fake info.
36 |
37 |
38 |
39 |
40 |
41 | catch a fish, make a hash mark, weigh it,
42 | enter the data in the spreadsheet
43 |
44 |
45 | scale
46 |
47 |
48 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-dataTable.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 | TEMPID234
9 | Test Data
10 | This is a test entity that is fake.
11 | This is test data
12 |
13 |
14 | rain
15 | Surface Rainfall
16 | The amount of rainfall on the sampling unit.
17 |
18 | float
19 | double
20 |
21 |
22 | millimeter
23 | 0.5
24 |
25 | real
26 |
27 | 0
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-text.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | This is some text.
8 |
9 | Subsection title
10 | Some text in the subsection
11 |
12 |
13 |
14 | Start with some text, and then mix in some elements:
15 |
16 | Item numero uno
17 | Item numero dos
18 | Item three contains a list itself:
19 |
20 | Oranges
21 | Apples
22 |
23 |
24 |
25 | And then some text with emphasis
26 | following the list of items.
27 |
28 |
29 |
30 | Test of sub and super scripts
31 | Subscript: H2O
32 | Superscript: y=x3
33 | Nested superscript:
34 | y=x34
35 | Nested subscript:
36 | x34
37 |
38 |
39 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-dataTable.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 | TEMPID234
9 | Test Data
10 | This is a test entity that is fake.
11 | This is test data
12 |
13 |
14 | rain
15 | Surface Rainfall
16 | The amount of rainfall on the sampling unit.
17 |
18 | float
19 | double
20 |
21 |
22 | millimeter
23 | 0.5
24 |
25 | real
26 |
27 | 0
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-text.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | This is some text.
8 |
9 | Subsection title
10 | Some text in the subsection
11 |
12 |
13 |
14 | Start with some text, and then mix in some elements:
15 |
16 | Item numero uno
17 | Item numero dos
18 | Item three contains a list itself:
19 |
20 | Oranges
21 | Apples
22 |
23 |
24 |
25 | And then some text with emphasis
26 | following the list of items.
27 |
28 |
29 |
30 | Test of sub and super scripts
31 | Subscript: H2O
32 | Superscript: y=x3
33 | Nested superscript:
34 | y=x34
35 | Nested subscript:
36 | x34
37 |
38 |
39 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-spatialVector.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | Test Data
10 | This is a test entity that is fake.
11 |
12 |
13 | rain
14 | Surface Rainfall
15 | The amount of rainfall on the sampling unit.
16 |
17 | float
18 | double
19 |
20 |
21 | millimeter
22 | 0.5
23 |
24 | real
25 |
26 | 0
27 |
28 |
29 |
30 |
31 |
32 |
33 | Point
34 | 1
35 |
36 | GCS_Accra
37 |
38 |
39 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.279.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 279
10 | Species Invasions: Insights into Ecology, Evolution, and Biogeography
11 |
12 |
13 | Dov
14 | F
15 | Sax
16 |
17 |
18 |
19 |
20 | John
21 | J
22 | Stachowicz
23 |
24 |
25 |
26 |
27 | Steven
28 | D
29 | Gaines
30 |
31 |
32 | 2005
33 |
34 |
35 | Sinauer Associates
36 |
37 | 480
38 |
39 |
40 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-2.2.0-milligramPerLiter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | EML 2.2.0 milligramPerLiter test
5 |
6 |
7 | Example
8 | User
9 |
10 |
11 |
12 | example.user
13 |
14 |
15 | entity
16 | entity description
17 |
18 |
19 | attribute1
20 | attribute1definition
21 | float
22 |
23 |
24 |
25 | milligramPerLiter
26 |
27 | 0.1
28 |
29 | real
30 |
31 | 0
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-spatialVector.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | Test Data
10 | This is a test entity that is fake.
11 |
12 |
13 | rain
14 | Surface Rainfall
15 | The amount of rainfall on the sampling unit.
16 |
17 | float
18 | double
19 |
20 |
21 | millimeter
22 | 0.5
23 |
24 | real
25 |
26 | 0
27 |
28 |
29 |
30 |
31 |
32 |
33 | Point
34 | 1
35 |
36 | GCS_Accra
37 |
38 |
39 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.279.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 279
10 | Species Invasions: Insights into Ecology, Evolution, and Biogeography
11 |
12 |
13 | Dov
14 | F
15 | Sax
16 |
17 |
18 |
19 |
20 | John
21 | J
22 | Stachowicz
23 |
24 |
25 |
26 |
27 | Steven
28 | D
29 | Gaines
30 |
31 |
32 | 2005
33 |
34 |
35 | Sinauer Associates
36 |
37 | 480
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.51.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 51
10 | Hopping with Life: The Ecology of Kelp on the Beach
11 |
12 |
13 | Jenifer
14 | Dugan
15 |
16 |
17 | 2002
18 |
19 | This 4 minute video describes the ecology of kelp wrack on the sandy beaches of Southern California, USA. The kelp wrack provides an important food source and habitat for kelp flies, maggots and small crustaceans on which several species of shore birds, starlings, common crows, black phoebes and warblers feed.
20 |
21 |
22 |
23 | http://www.ocean.com
24 |
25 |
26 |
27 |
28 | The Ocean Channel (for Ty Warner Sea Center)
29 |
30 | Carpinteria, CA
31 |
32 |
33 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.201.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 201
10 | A conceptual model for river water and sediment dispersal in the Santa Barbara Channel, California
11 |
12 |
13 | J
14 | A
15 | Warrick
16 |
17 |
18 |
19 |
20 | L
21 | A
22 | K
23 | Mertes
24 |
25 |
26 |
27 |
28 | D
29 | A
30 | Siegel
31 |
32 |
33 | 2004
34 |
35 | Continental-Shelf Research
36 | 24
37 | 2029-2043
38 |
39 |
40 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.51.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 51
10 | Hopping with Life: The Ecology of Kelp on the Beach
11 |
12 |
13 | Jenifer
14 | Dugan
15 |
16 |
17 | 2002
18 |
19 | This 4 minute video describes the ecology of kelp wrack on the sandy beaches of Southern California, USA. The kelp wrack provides an important food source and habitat for kelp flies, maggots and small crustaceans on which several species of shore birds, starlings, common crows, black phoebes and warblers feed.
20 |
21 |
22 |
23 | http://www.ocean.com
24 |
25 |
26 |
27 |
28 | The Ocean Channel (for Ty Warner Sea Center)
29 |
30 | Carpinteria, CA
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.201.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 201
10 | A conceptual model for river water and sediment dispersal in the Santa Barbara Channel, California
11 |
12 |
13 | J
14 | A
15 | Warrick
16 |
17 |
18 |
19 |
20 | L
21 | A
22 | K
23 | Mertes
24 |
25 |
26 |
27 |
28 | D
29 | A
30 | Siegel
31 |
32 |
33 | 2004
34 |
35 | Continental-Shelf Research
36 | 24
37 | 2029-2043
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/notebook/XSD-to-RDFS.R:
--------------------------------------------------------------------------------
1 | ## EXPERIMENTAL ONLY
2 |
3 | library(xml2)
4 | library(purrr)
5 |
6 | ## List all Classes
7 |
8 | ## class, description, inherits, inherits2, inherits3,
9 |
10 | ## class, property, type, description, accepted_types
11 | #
12 | ## Define properties of every class
13 | ## property definitions
14 |
15 |
16 |
17 | ### Get all xs:complexType
18 |
19 | xsd <- "inst/xsd/eml-2.2.0/eml-attribute.xsd"
20 |
21 | xml <- xml2::read_xml(xsd)
22 |
23 | ## Types. Just get the docs and stick stuff back together later??
24 | complex <- xml_find_all(xml, "//xs:complexType[@name]") %>% xml_attr("name")
25 | simple <- xml_find_all(xml, "//xs:simpleType[@name]") %>% xml_attr("name")
26 | groups <- xml_find_all(xml, "//xs:group[@name]") %>% xml_attr("name")
27 |
28 |
29 | xml_find_all(xml, "//xs:complexType[@name]/xs:annotation") %>% xml_children() %>% xml_children() %>% xml_text(TRUE)
30 |
31 |
32 | xml_find_all(xml, "//xs:complexType[@name='NonNumericDomainType']//xs:element[@name]") %>% xml_attr("name")
33 | xml_find_all(xml, "//xs:complexType[@name='NonNumericDomainType']/child::*/xs:element[@name]") %>% xml_attr("name")
34 | xml_find_all(xml, "//xs:complexType[@name='NonNumericDomainType']/child::*/child::*/xs:element[@name]") %>% xml_attr("name")
35 |
36 | xml_find_all(xml, "//xs:complexType[@name='NonNumericDomainType']/child::*/(xs:choice | xs:sequence)")
37 |
38 |
39 | xml_find_all(xml, "//xs:complexType[@name='NonNumericDomainType']") %>% xml_children() %>% xml_children()
40 |
41 | xml_find_all(xml, "//xs:complexType[@name='NonNumericDomainType']/child::*/child::*/child::*")
42 |
43 |
44 | named_elements <- xml_find_all(xml, "//xs:element[@name]") %>% xml_attr("name")
45 |
46 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/invalid/eml-2.1.1-invalidunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | EML 2.1.1 invalid units test
5 |
6 |
7 | Example
8 | User
9 |
10 |
11 |
12 | example.user
13 |
14 |
15 | entity
16 | entity description
17 |
18 |
19 | attribute1
20 | attribute1definition
21 | float
22 |
23 |
24 |
25 | milligramPerLiter
26 |
27 | 0.1
28 |
29 | real
30 |
31 | 0
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-inline.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | inline_xml_data
8 |
9 |
10 |
11 | XML
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Some Peptide
20 |
21 | Operator
22 | PSI
23 | EBI-EMBL
24 |
25 |
26 | somepeptide.raw
27 | xcalibur 1.3
28 |
29 |
30 |
31 | LCQ
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | PSI-MS
40 | 1.1
41 | PSI-MS Converter
42 |
43 |
44 |
45 | centroid
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-inline.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | inline_xml_data
8 |
9 |
10 |
11 | XML
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | Some Peptide
20 |
21 | Operator
22 | PSI
23 | EBI-EMBL
24 |
25 |
26 | somepeptide.raw
27 | xcalibur 1.3
28 |
29 |
30 |
31 | LCQ
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | PSI-MS
40 | 1.1
41 | PSI-MS Converter
42 |
43 |
44 |
45 | centroid
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-storedProcedure.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | TEMPID234
8 | Test Data
9 | This is a test entity that is fake.
10 |
11 |
12 | rain
13 | Surface Rainfall
14 | The amount of rainfall on the sampling unit.
15 |
16 | float
17 | double
18 |
19 |
20 | millimeter
21 | 0.5
22 |
23 | real
24 |
25 | 0
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | x
35 | This is an integer between 0 and 10,003, which can
36 | be represented using the xs:integer type from XML Schema datatypes.
37 |
38 | true
39 | false
40 |
41 |
42 |
--------------------------------------------------------------------------------
/inst/notebook/emld_spec.Rmd:
--------------------------------------------------------------------------------
1 | ---
2 | title: "emld Spec"
3 | author: "Carl Boettiger"
4 | date: "1/13/2018"
5 | output: github_document
6 | ---
7 |
8 | This document outlines the conventions used in mapping EML XML into JSON-LD.
9 |
10 | - XML node names become JSON keys
11 | - XML node contents (either text/data or node names) become the corresponding JSON value to the key
12 | - Repeated elements become list-valued:
13 |
14 | ```xml
15 | http://example.com/1
16 | http://example.com/2
17 | http://example.com/3
18 | ```
19 |
20 | becomes:
21 |
22 | ```json
23 | "url": ["http://example.com/1", "http://example.com/2", "http://example.com/3"]
24 | ```
25 |
26 | - XML node attribute names are converted into JSON keys prefixed with `#`, unless the attribute name is `id`, in which case it uses the special JSON-LD prefix, `@`. For instance:
27 |
28 |
29 | ```xml
30 | The Title
31 | ```
32 |
33 | becomes
34 |
35 | ```json
36 | "dataset": {
37 | "@id": "abc123",
38 | "#system": "knb",
39 | "title": "The Title"
40 | }
41 |
42 | ```
43 |
44 |
45 | - If a node contains text/data and an attribute, the node name is repeated to denote the value as well:
46 |
47 | ```xml
48 | http://example.com
49 | ```
50 |
51 | becomes:
52 |
53 | ```json
54 | "url": {
55 | "#function"="download"
56 | "url": "http://example.com"
57 | }
58 | ```
59 |
60 | - Contents of `para` and `section` (the two choices for components of any `TextType` content) are encoded as literal character strings and not parsed.
61 |
62 | - references are expanded:
63 |
64 | - Semantic annotations (EML 2.2) are expanded into native JSON-LD
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-storedProcedure.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | TEMPID234
8 | Test Data
9 | This is a test entity that is fake.
10 |
11 |
12 | rain
13 | Surface Rainfall
14 | The amount of rainfall on the sampling unit.
15 |
16 | float
17 | double
18 |
19 |
20 | millimeter
21 | 0.5
22 |
23 | real
24 |
25 | 0
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | x
35 | This is an integer between 0 and 10,003, which can
36 | be represented using the xs:integer type from XML Schema datatypes.
37 |
38 | true
39 | false
40 |
41 |
42 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-datasetGRing.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | A title dataset with bad gringpoints.
6 |
7 |
8 |
9 | surname-is-hyphenated
10 |
11 |
12 |
13 |
14 | this coverage tree has invalid gring points
15 |
16 | 23
17 | 23
18 | 23
19 | 23
20 |
21 |
22 |
23 | 12,34 13,34 34,34
24 |
25 |
26 |
27 |
28 |
29 | my org
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-software.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | fish counting
9 |
10 |
11 |
12 | University of California
13 |
14 |
15 | 123 Campus Dr.
16 | Santa Barbara
17 | CA
18 | 93101
19 | USA
20 |
21 |
22 | 805-123-1234
23 |
24 | joe@something.org
25 | www.something.org/~joe
26 |
27 | 1999
28 | English
29 |
30 | fish
31 | lake
32 | jim's thesaurus
33 |
34 |
35 | This is some other fake info.
36 |
37 |
38 |
39 |
40 |
41 | http://www.something.org
42 |
43 |
44 |
45 | 123 MB
46 |
47 | Linux
48 | JVM
49 | 123 MB
50 | Java
51 |
52 |
53 | GPL
54 |
55 |
56 | 1.0
57 |
58 |
59 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-software.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | fish counting
9 |
10 |
11 |
12 | University of California
13 |
14 |
15 | 123 Campus Dr.
16 | Santa Barbara
17 | CA
18 | 93101
19 | USA
20 |
21 |
22 | 805-123-1234
23 |
24 | joe@something.org
25 | www.something.org/~joe
26 |
27 | 1999
28 | English
29 |
30 | fish
31 | lake
32 | jim's thesaurus
33 |
34 |
35 | This is some other fake info.
36 |
37 |
38 |
39 |
40 |
41 | http://www.something.org
42 |
43 |
44 |
45 | 123 MB
46 |
47 | Linux
48 | JVM
49 | 123 MB
50 | Java
51 |
52 |
53 | GPL
54 |
55 |
56 | 1.0
57 |
58 |
59 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.297.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 297
10 | An experimental investigation of the use of artificial reefs to mitigate the loss of giant kelp forest habitat. A case study of the San Onofre Nuclear Generating Station's artificial reef project
11 |
12 |
13 | D
14 | C
15 | Reed
16 |
17 |
18 |
19 |
20 | Steve
21 | C
22 | Schroeter
23 |
24 |
25 |
26 |
27 | D
28 | Huang
29 |
30 |
31 | 2006
32 |
33 | T-058
34 |
35 | California Sea Grant College Program, University of California, San Diego, CA
36 |
37 | 143
38 |
39 |
40 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.297.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 297
10 | An experimental investigation of the use of artificial reefs to mitigate the loss of giant kelp forest habitat. A case study of the San Onofre Nuclear Generating Station's artificial reef project
11 |
12 |
13 | D
14 | C
15 | Reed
16 |
17 |
18 |
19 |
20 | Steve
21 | C
22 | Schroeter
23 |
24 |
25 |
26 |
27 | D
28 | Huang
29 |
30 |
31 | 2006
32 |
33 | T-058
34 |
35 | California Sea Grant College Program, University of California, San Diego, CA
36 |
37 | 143
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.203.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 203
10 | Dispersal forcing of southern California river plumes based on field and remote sensing observations
11 |
12 |
13 | J
14 | A
15 | Warrick
16 |
17 |
18 |
19 |
20 | L
21 | A
22 | K
23 | Mertes
24 |
25 |
26 |
27 |
28 | L
29 | Washburn
30 |
31 |
32 |
33 |
34 | D
35 | A
36 | Siegel
37 |
38 |
39 | 2004
40 |
41 | Geo-Marine Letters
42 | 24
43 | 46-52
44 |
45 |
46 |
--------------------------------------------------------------------------------
/tests/testthat/test-rdf-roundtrip.R:
--------------------------------------------------------------------------------
1 | testthat::context("test rdf roundtrips")
2 |
3 | library(rdflib)
4 | library(jsonlite)
5 | library(jsonld)
6 | library(magrittr)
7 | library(testthat)
8 |
9 | f <- system.file(file.path("tests",
10 | eml_version(),
11 | "eml.xml"), package="emld")
12 |
13 | test_that("We can roundtrip into rdf and validate", {
14 |
15 | eml.json <- tempfile("eml", fileext = ".json")
16 | eml.xml <- tempfile("eml", fileext = ".xml")
17 |
18 | f %>%
19 | as_emld() %>%
20 | as_json() %>%
21 | rdf_parse("jsonld") %>%
22 | rdf_serialize(eml.json, "jsonld")
23 |
24 | ## frame & compact explicitly, even though as_emld should now do this on json input
25 | frame <- system.file(paste0("frame/",
26 | eml_version(),
27 | "/eml-frame.json"), package = "emld")
28 | context <- system.file(paste0("context/",
29 | eml_version(),
30 | "/eml-context.json"), package = "emld")
31 | jsonld_frame(eml.json, frame) %>%
32 | jsonld_compact(context) %>%
33 | as_emld() %>%
34 | as_xml(eml.xml)
35 | expect_true(eml_validate(eml.xml))
36 | })
37 |
38 | test_that("We can roundtrip out to rdf-xml", {
39 | eml.rdf <- tempfile("eml", fileext = ".rdf")
40 | eml.json <- tempfile("eml", fileext = ".json")
41 | eml.xml <- tempfile("eml", fileext = ".xml")
42 |
43 | ## Into RDF-XML
44 | f %>%
45 | as_emld() %>%
46 | as_json() %>%
47 | rdf_parse("jsonld") %>%
48 | rdf_serialize(eml.rdf, "rdfxml")
49 |
50 | ## Back into jsonld (via rdflib)
51 | rdf_parse(eml.rdf, "rdfxml") %>%
52 | rdf_serialize(eml.json, "jsonld")
53 |
54 |
55 | ## Prove that as_emld frames and compacts automatically:
56 | as_emld(eml.json) %>%
57 | as_xml(eml.xml)
58 | expect_true(eml_validate(eml.xml))
59 |
60 | })
61 |
62 |
63 |
--------------------------------------------------------------------------------
/inst/extdata/schema-org-dataset.json:
--------------------------------------------------------------------------------
1 | {
2 | "@context":"http://schema.org/",
3 | "@type":"Dataset",
4 | "name":"NCDC Storm Events Database",
5 | "description":"Storm Data is provided by the National Weather Service (NWS) and contain statistics on...",
6 | "url":"https://catalog.data.gov/dataset/ncdc-storm-events-database",
7 | "sameAs":"https://gis.ncdc.noaa.gov/geoportal/catalog/search/resource/details.page?id=gov.noaa.ncdc:C00510",
8 | "keywords":[
9 | "ATMOSPHERE > ATMOSPHERIC PHENOMENA > CYCLONES",
10 | "ATMOSPHERE > ATMOSPHERIC PHENOMENA > DROUGHT",
11 | "ATMOSPHERE > ATMOSPHERIC PHENOMENA > FOG",
12 | "ATMOSPHERE > ATMOSPHERIC PHENOMENA > FREEZE"
13 | ],
14 | "creator":{
15 | "@type":"Organization",
16 | "url": "https://www.ncei.noaa.gov/",
17 | "name":"OC/NOAA/NESDIS/NCEI > National Centers for Environmental Information, NESDIS, NOAA, U.S. Department of Commerce",
18 | "contactPoint":{
19 | "@type":"ContactPoint",
20 | "contactType": "customer service",
21 | "telephone":"+1-828-271-4800",
22 | "email":"ncei.orders@noaa.gov"
23 | }
24 | },
25 | "includedInDataCatalog":{
26 | "@type":"DataCatalog",
27 | "name":"data.gov"
28 | },
29 | "distribution":[
30 | {
31 | "@type":"DataDownload",
32 | "encodingFormat":"CSV",
33 | "contentUrl":"http://www.ncdc.noaa.gov/stormevents/ftp.jsp"
34 | },
35 | {
36 | "@type":"DataDownload",
37 | "encodingFormat":"XML",
38 | "contentUrl":"http://gis.ncdc.noaa.gov/all-records/catalog/search/resource/details.page?id=gov.noaa.ncdc:C00510"
39 | }
40 | ],
41 | "temporalCoverage":"1950-01-01/2013-12-18",
42 | "spatialCoverage":{
43 | "@type":"Place",
44 | "geo":{
45 | "@type":"GeoShape",
46 | "box":"18.0 -65.0 72.0 172.0"
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.202.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 202
10 | Estimating suspended sediment concentrations in turbid coastal waters with SeaWiFS
11 |
12 |
13 | J
14 | A
15 | Warrick
16 |
17 |
18 |
19 |
20 | L
21 | A
22 | K
23 | Mertes
24 |
25 |
26 |
27 |
28 | D
29 | A
30 | Siegel
31 |
32 |
33 |
34 |
35 | C
36 | MacKenzie
37 |
38 |
39 | 2004
40 |
41 | International Journal of Remote Sensing
42 | 25
43 | 1995-2002
44 |
45 |
46 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.203.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 203
10 | Dispersal forcing of southern California river plumes based on field and remote sensing observations
11 |
12 |
13 | J
14 | A
15 | Warrick
16 |
17 |
18 |
19 |
20 | L
21 | A
22 | K
23 | Mertes
24 |
25 |
26 |
27 |
28 | L
29 | Washburn
30 |
31 |
32 |
33 |
34 | D
35 | A
36 | Siegel
37 |
38 |
39 | 2004
40 |
41 | Geo-Marine Letters
42 | 24
43 | 46-52
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.202.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 202
10 | Estimating suspended sediment concentrations in turbid coastal waters with SeaWiFS
11 |
12 |
13 | J
14 | A
15 | Warrick
16 |
17 |
18 |
19 |
20 | L
21 | A
22 | K
23 | Mertes
24 |
25 |
26 |
27 |
28 | D
29 | A
30 | Siegel
31 |
32 |
33 |
34 |
35 | C
36 | MacKenzie
37 |
38 |
39 | 2004
40 |
41 | International Journal of Remote Sensing
42 | 25
43 | 1995-2002
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/R/validate_units.R:
--------------------------------------------------------------------------------
1 | # Validate that every `standardUnit` is a standardUnit
2 | # Validate that any `customUnit` is defined in the customUnits
3 | validate_units <- function(eml,
4 | encoding = "UTF-8") {
5 |
6 | doc <- generalized_parser(eml, encoding = encoding)
7 | ns <- xml_ns(doc)
8 | standard_units <- unique(xml2::xml_text(
9 | xml2::xml_find_all(doc, "//standardUnit", ns = ns),
10 | trim = TRUE))
11 | custom_units <- unique(xml2::xml_text(
12 | xml2::xml_find_all(doc, "//customUnit", ns = ns),
13 | trim = TRUE))
14 |
15 | # Read in the version of eml-unitDictionary.xml to match this document's
16 | # schema version
17 | root_schema <- guess_root_schema(eml)
18 |
19 | standard <- xml2::read_xml(system.file("tests",
20 | paste(root_schema$module, root_schema$version, sep = "-"),
21 | "eml-unitDictionary.xml",
22 | package = "emld"
23 | ))
24 |
25 | standard_defs <- xml_attr(
26 | xml2::xml_find_all(standard,
27 | "//*[local-name()='unitList']/*[local-name()='unit']"),
28 | "id"
29 | )
30 |
31 | custom_defs <- xml2::xml_attr(xml2::xml_find_all(
32 | doc,
33 | "//*[local-name()='unitList']/*[local-name()='unit']"
34 | ), "id")
35 |
36 | error_log <- character()
37 | if(!all(standard_units %in% standard_defs))
38 | error_log <- c(error_log, "some standardUnit elements are not recognized.")
39 |
40 | if(!all(custom_units %in% custom_defs))
41 | error_log <- c(error_log, "not all 'custom units are defined.")
42 |
43 | # If no validity errors are found above or by the parser, then the document is valid
44 | if(length(error_log) == 0)
45 | result <- TRUE
46 | else {
47 | warning(paste("Document is invalid. Found the following errors:\n",
48 | paste(error_log, collapse = "\n")))
49 | result <- FALSE
50 | }
51 | attr(result, "errors") <- error_log
52 | result
53 | }
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/citation-sbclter-bibliography.50.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 50
10 | Satellite Views of Plumes and Blooms in the Santa Barbara Channel (in) Channel Islands I: Introduction to Channel Islands National Marine Sanctuary
11 |
12 |
13 | S
14 | Fangman
15 |
16 |
17 |
18 |
19 | D
20 | A
21 | Siegel
22 |
23 |
24 | 2002
25 |
26 | This 30 min video is an introduction to the Channel Islands National Marine Sanctuary designed for a nation-wide audience of middle school aged students. It includes six minutes on satellite views of sediment plumes and phytoplankton blooms in the Santa Barbara Channel.
27 |
28 |
29 |
30 | http://www.marine.usf.edu/pjocean/video/index.html
31 |
32 |
33 |
34 |
35 | Project Oceanography, University of South Florida
36 |
37 | Tampa, FL
38 |
39 |
40 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-citationWithContactReference.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 289
5 | 10.1029/2005GL023017
6 | Sub-mesoscale coastal eddies observed by high frequency radar: A new mechanism for delivering nutrients to kelp forests in the Southern California Bight
7 |
8 |
9 | Corinne
10 | J
11 | Bassin
12 |
13 |
14 |
15 |
16 | Libe
17 | Washburn
18 |
19 | washburn@icess.ucsb.edu
20 |
21 |
22 |
23 | M
24 | A
25 | Brzezinski
26 |
27 |
28 |
29 | washburn
30 |
31 | 2005
32 |
33 |
34 | Libe
35 | Washburn
36 |
37 | washburn@icess.ucsb.edu
38 |
39 |
40 | Geophysical Research Letters
41 | 32
42 | LI2604
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.50.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 50
10 | Satellite Views of Plumes and Blooms in the Santa Barbara Channel (in) Channel Islands I: Introduction to Channel Islands National Marine Sanctuary
11 |
12 |
13 | S
14 | Fangman
15 |
16 |
17 |
18 |
19 | D
20 | A
21 | Siegel
22 |
23 |
24 | 2002
25 |
26 | This 30 min video is an introduction to the Channel Islands National Marine Sanctuary designed for a nation-wide audience of middle school aged students. It includes six minutes on satellite views of sediment plumes and phytoplankton blooms in the Santa Barbara Channel.
27 |
28 |
29 |
30 | http://www.marine.usf.edu/pjocean/video/index.html
31 |
32 |
33 |
34 |
35 | Project Oceanography, University of South Florida
36 |
37 | Tampa, FL
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-citationWithContactReference.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 289
5 | 10.1029/2005GL023017
6 | Sub-mesoscale coastal eddies observed by high frequency radar: A new mechanism for delivering nutrients to kelp forests in the Southern California Bight
7 |
8 |
9 | Corinne
10 | J
11 | Bassin
12 |
13 |
14 |
15 |
16 | Libe
17 | Washburn
18 |
19 | washburn@icess.ucsb.edu
20 |
21 |
22 |
23 | M
24 | A
25 | Brzezinski
26 |
27 |
28 |
29 | washburn
30 |
31 | 2005
32 |
33 |
34 | Libe
35 | Washburn
36 |
37 | washburn@icess.ucsb.edu
38 |
39 |
40 | Geophysical Research Letters
41 | 32
42 | LI2604
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-citationWithContact.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 289
5 | 10.1029/2005GL023017
6 | Sub-mesoscale coastal eddies observed by high frequency radar: A new mechanism for delivering nutrients to kelp forests in the Southern California Bight
7 |
8 |
9 | Corinne
10 | J
11 | Bassin
12 |
13 |
14 |
15 |
16 | Libe
17 | Washburn
18 |
19 | washburn@icess.ucsb.edu
20 |
21 |
22 |
23 | M
24 | A
25 | Brzezinski
26 |
27 |
28 |
29 |
30 | E
31 | B
32 | McPhee-Shaw
33 |
34 |
35 | 2005
36 |
37 |
38 | Libe
39 | Washburn
40 |
41 | washburn@icess.ucsb.edu
42 |
43 |
44 | Geophysical Research Letters
45 | 32
46 | LI2604
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-citationWithContact.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 289
5 | 10.1029/2005GL023017
6 | Sub-mesoscale coastal eddies observed by high frequency radar: A new mechanism for delivering nutrients to kelp forests in the Southern California Bight
7 |
8 |
9 | Corinne
10 | J
11 | Bassin
12 |
13 |
14 |
15 |
16 | Libe
17 | Washburn
18 |
19 | washburn@icess.ucsb.edu
20 |
21 |
22 |
23 | M
24 | A
25 | Brzezinski
26 |
27 |
28 |
29 |
30 | E
31 | E
32 | McPhee-Shaw
33 |
34 |
35 | 2005
36 |
37 |
38 | Libe
39 | Washburn
40 |
41 | washburn@icess.ucsb.edu
42 |
43 |
44 | Geophysical Research Letters
45 | 32
46 | LI2604
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-semantics.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | TEMPID234
8 | Test Data
9 | This is a test entity that is fake.
10 | This is test data
11 |
12 |
13 | tmpair
14 | Air Temperature
15 | Air temperature at 1m from ground.
16 | float
17 |
18 |
19 | celsius
20 | 0.5
21 |
22 | real
23 |
24 |
25 |
26 |
27 | http://ecoinformatics.org/oboe/oboe.1.2/oboe-core.owl#ofCharacteristic
28 | http://ecoinformatics.org/oboe/oboe.1.2/oboe-characteristics.owl#Temperature
29 |
30 |
31 | http://ecoinformatics.org/oboe/oboe.1.2/oboe-core.owl#ofEntity
32 | http://purl.obolibrary.org/obo/ENVO_00002005
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Sample dataset Description
11 |
12 |
13 | Smith
14 |
15 |
16 |
17 |
18 | Smith
19 |
20 |
21 | My comments go here.
22 |
23 |
24 |
25 |
26 |
27 |
28 | sde
29 | The SDE scheme used at CAP LTER
30 |
31 | hostname
32 | The host
33 | mohave.asu.edu
34 |
35 |
36 | databaseName
37 | The name of the database or catalog
38 |
39 |
40 | owner
41 | The owner catalog
42 | dbo
43 |
44 |
45 |
46 |
47 |
48 | Provide data to the whole world.
49 |
50 |
51 | Johnson
52 |
53 |
54 |
55 | 23445
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | Sample dataset Description
11 |
12 |
13 | Smith
14 |
15 |
16 |
17 |
18 | Smith
19 |
20 |
21 | My comments go here.
22 |
23 |
24 |
25 |
26 |
27 |
28 | sde
29 | The SDE scheme used at CAP LTER
30 |
31 | hostname
32 | The host
33 | mohave.asu.edu
34 |
35 |
36 | databaseName
37 | The name of the database or catalog
38 |
39 |
40 | owner
41 | The owner catalog
42 | dbo
43 |
44 |
45 |
46 |
47 |
48 | Provide data to the whole world.
49 |
50 |
51 | Johnson
52 |
53 |
54 |
55 | 23445
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/notebook/jq_maps.md:
--------------------------------------------------------------------------------
1 |
2 | Mapping between Schema.Org and EML via JQ
3 | =========================================
4 |
5 | We will use J-Query as XSLT-like stylesheets. These two examples shipping in this package are currently a work in progress:
6 |
7 | ``` r
8 | library(jqr)
9 | ```
10 |
11 | ``` r
12 | eml_to_schema <- readr::read_file(system.file("jq/eml_to_schema.jq", package="emld"))
13 | schema_to_eml <- readr::read_file(system.file("jq/schema_to_eml.jq", package="emld"))
14 | ```
15 |
16 | Let's map a more complete EML document into schema.org:
17 |
18 | ``` r
19 | eml <- readr::read_file("https://raw.githubusercontent.com/cboettig/emld/master/inst/extdata/hf205.json")
20 | jq(eml, eml_to_schema)
21 | ```
22 |
23 | ## {
24 | ## "id": "HF205",
25 | ## "type": null,
26 | ## "temporalCoverage": "2012-06-01/2013-12-31",
27 | ## "spatialCoverage": {
28 | ## "description": "Harvard Forest Greenhouse, Tom Swamp Tract (Harvard Forest)",
29 | ## "geo": {
30 | ## "box": "+42.42 -72.29 +42.55 -72.10"
31 | ## }
32 | ## }
33 | ## }
34 |
35 | Convert a dataset marked up in terms into EML
36 |
37 | ``` r
38 | schema <- readr::read_file("../inst/extdata/schema-org-dataset.json")
39 |
40 | jq(schema, schema_to_eml)
41 | ```
42 |
43 | ## {
44 | ## "@id": null,
45 | ## "@type": "Dataset",
46 | ## "coverage": {
47 | ## "temporalCoverage": {
48 | ## "rangeOfDates": {
49 | ## "beginDate": "1950-01-01",
50 | ## "endDate": "2013-12-18"
51 | ## }
52 | ## },
53 | ## "geographicCoverage": {
54 | ## "geographicDescription": null,
55 | ## "boundingCoordinates": {
56 | ## "westBoundingCoordinate": "-65.0",
57 | ## "eastBoundingCoordinate": "172.0",
58 | ## "northBoundingCoordinate": "72.0",
59 | ## "southBoundingCoordinate": "18.0"
60 | ## }
61 | ## }
62 | ## }
63 | ## }
64 |
--------------------------------------------------------------------------------
/man/as_xml.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/as_xml.R
3 | \name{as_xml}
4 | \alias{as_xml}
5 | \title{Coerce an emld object into XML (EML's standard format)}
6 | \usage{
7 | as_xml(x, file = NULL, root = "eml", ns = "eml", schemaLocation = TRUE)
8 | }
9 | \arguments{
10 | \item{x}{an emld object}
11 |
12 | \item{file}{optional path to write out to file.
13 | Otherwise, defaults to NULL and will return an xml_document object.}
14 |
15 | \item{root}{name for the root node; default to 'eml'}
16 |
17 | \item{ns}{namespace abbreviation on root node, default 'eml'}
18 |
19 | \item{schemaLocation}{If not explicitly set on \code{x}, automatically set
20 | \code{xsi:schemaLocation} based upon the root namespace (\code{TRUE}, default), do not
21 | set a \code{xsi:schemaLocation} (\code{FALSE}), or set a specific \code{xsi:schemaLocation}
22 | value (\code{"Your value here..."}). See Examples.}
23 | }
24 | \value{
25 | a xml_document object. Or if a file path is provided, the metadata
26 | is written out in XML file and the function returns \code{NULL} invisibly.
27 | }
28 | \description{
29 | Coerce an emld object into XML (EML's standard format)
30 | }
31 | \details{
32 | Unlike as_json, this function cannot rely on the existing
33 | convention of serializing a list to xml, eg, as defined by xml2::as_xml_document()
34 | Instead, this relies on a modified version, as_eml_document. In addition
35 | further steps must be taken when working with JSON-LD to deal with
36 | different possible framings and namespaces from the JSON-LD context
37 | element. Thus this \code{as_xml} function is particular to EML and \code{emld}
38 | objects alone.
39 | }
40 | \examples{
41 | f <- system.file("extdata/example.xml", package = "emld")
42 | emld <- as_emld(f)
43 | xml <- as_xml(emld)
44 |
45 | ## can also write directly to a file:
46 | xml_file <- tempfile()
47 | as_xml(emld, xml_file)
48 |
49 | ## if you don't want the `xsi:schemaLocation` attribute set
50 | as_xml(emld, schemaLocation = FALSE)
51 |
52 | ## or if you want to set your own value
53 | as_xml(emld, schemaLocation = "https://eml.ecoinformatics.org/eml-2.2.0
54 | http://example.com/eml-2.2.0/eml.xsd")
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-datasetNoSchemaLocationInvalid.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | Sample datset Description
6 |
7 | My comments go here.
8 |
9 |
10 |
11 |
12 |
13 |
14 | sde
15 | The SDE scheme used at CAP LTER
16 |
17 | hostname
18 | The host
19 | mohave.asu.edu
20 |
21 |
22 | databaseName
23 | The name of the database or catalog
24 |
25 |
26 | owner
27 | The owner catalog
28 | dbo
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | def.1
37 |
38 |
39 | databaseName
40 | landuse95
41 |
42 |
43 | owner
44 | sde
45 |
46 |
47 |
48 |
49 | Provide data to the whole world.
50 |
51 |
52 | Johnson
53 |
54 |
55 |
56 | 23445
57 |
58 |
59 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-datasetGringpoint.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | A title dataset with bad gringpoints.
6 |
7 |
8 |
9 | surname-is-hyphenated
10 |
11 |
12 |
13 |
14 | this coverage tree has invalid gring points
15 |
16 | 23
17 | 23
18 | 23
19 | 23
20 |
21 |
22 |
23 |
24 | 12
25 | 123
26 |
27 |
28 | 12.7
29 | 123
30 |
31 |
32 | 13
33 | 120.5555555
34 |
35 |
36 |
37 |
38 |
39 |
40 | my org
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/skiptest-sbclter-bibliography.289.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 289
10 | 10.1029/2005GL023017
11 | Sub-mesoscale coastal eddies observed by high frequency radar: A new mechanism for delivering nutrients to kelp forests in the Southern California Bight
12 |
13 |
14 | C
15 | J
16 | Bassin
17 |
18 |
19 |
20 |
21 | L
22 | Washburn
23 |
24 |
25 |
26 |
27 | M
28 | A
29 | Brzezinski
30 |
31 |
32 |
33 |
34 | E
35 | E
36 | McPhee-Shaw
37 |
38 |
39 | 2005
40 |
41 |
42 | Libe
43 | Washburn
44 |
45 | washburn@icess.ucsb.edu
46 |
47 |
48 | Geophysical Research Letters
49 | 32
50 | LI2604
51 |
52 |
53 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/identical-repeated-key-bibliography.289.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 289
10 | 10.1029/2005GL023017
11 | Sub-mesoscale coastal eddies observed by high frequency radar: A new mechanism for delivering nutrients to kelp forests in the Southern California Bight
12 |
13 |
14 | C
15 | J
16 | Bassin
17 |
18 |
19 |
20 |
21 | L
22 | Washburn
23 |
24 |
25 |
26 |
27 | M
28 | A
29 | Brzezinski
30 |
31 |
32 |
33 |
34 | E
35 | E
36 | McPhee-Shaw
37 |
38 |
39 | 2005
40 |
41 |
42 | Libe
43 | Washburn
44 |
45 | washburn@icess.ucsb.edu
46 |
47 |
48 | Geophysical Research Letters
49 | 32
50 | LI2604
51 |
52 |
53 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/citation-sbclter-bibliography.289.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | 289
10 | 10.1029/2005GL023017
11 | Sub-mesoscale coastal eddies observed by high frequency radar: A new mechanism for delivering nutrients to kelp forests in the Southern California Bight
12 |
13 |
14 | C
15 | J
16 | Bassin
17 |
18 |
19 |
20 |
21 | L
22 | Washburn
23 |
24 |
25 |
26 |
27 | M
28 | A
29 | Brzezinski
30 |
31 |
32 |
33 |
34 | E
35 | E
36 | McPhee-Shaw
37 |
38 |
39 | 2005
40 |
41 |
42 | Libe
43 | Washburn
44 |
45 | washburn@icess.ucsb.edu
46 |
47 |
48 | Geophysical Research Letters
49 | 32
50 | LI2604
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/DESCRIPTION:
--------------------------------------------------------------------------------
1 | Package: emld
2 | Title: Ecological Metadata as Linked Data
3 | Version: 0.5.2
4 | Authors@R: c(
5 | person("Carl", "Boettiger",
6 | email = "cboettig@gmail.com",
7 | role = c("aut", "cre", "cph"),
8 | comment=c(ORCID = "0000-0002-1642-628X")),
9 | person("Matthew B.", "Jones",
10 | email = "jones@nceas.ucsb.edu",
11 | role = c("aut", "cph"),
12 | comment=c(ORCID = "0000-0003-0077-4738")),
13 | person("Bryce", "Mecum",
14 | email = "mecum@nceas.ucsb.edu",
15 | role = c("aut", "cph"),
16 | comment=c(ORCID = "0000-0002-0381-3766"))
17 | )
18 | Description: This is a utility for transforming Ecological Metadata Language
19 | ('EML') files into 'JSON-LD' and back into 'EML.' Doing so creates a
20 | list-based representation of 'EML' in R, so that 'EML' data can easily
21 | be manipulated using standard 'R' tools. This makes this package an
22 | effective backend for other 'R'-based tools working with 'EML.' By
23 | abstracting away the complexity of 'XML' Schema, developers can
24 | build around native 'R' list objects and not have to worry about satisfying
25 | many of the additional constraints of set by the schema (such as element
26 | ordering, which is handled automatically). Additionally, the 'JSON-LD'
27 | representation enables the use of developer-friendly 'JSON' parsing and
28 | serialization that may facilitate the use of 'EML' in contexts outside of 'R,'
29 | as well as the informatics-friendly serializations such as 'RDF' and
30 | 'SPARQL' queries.
31 | URL: https://docs.ropensci.org/emld/, https://github.com/ropensci/emld
32 | BugReports: https://github.com/ropensci/emld/issues
33 | Depends: R (>= 3.1.0)
34 | License: MIT + file LICENSE
35 | Encoding: UTF-8
36 | RoxygenNote: 7.3.3
37 | Roxygen: list(markdown = TRUE)
38 | Suggests:
39 | spelling,
40 | testthat,
41 | magrittr,
42 | rmarkdown,
43 | covr,
44 | knitr,
45 | rdflib,
46 | jqr
47 | Imports:
48 | xml2,
49 | jsonlite,
50 | jsonld,
51 | methods,
52 | yaml
53 | VignetteBuilder: knitr
54 | Language: en-US
55 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-datasetNoSchemaLocation.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | Sample datset Description
6 |
7 |
8 | Smith
9 |
10 |
11 | My comments go here.
12 |
13 |
14 |
15 |
16 |
17 |
18 | sde
19 | The SDE scheme used at CAP LTER
20 |
21 | hostname
22 | The host
23 | mohave.asu.edu
24 |
25 |
26 | databaseName
27 | The name of the database or catalog
28 |
29 |
30 | owner
31 | The owner catalog
32 | dbo
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | def.1
41 |
42 |
43 | databaseName
44 | landuse95
45 |
46 |
47 | owner
48 | sde
49 |
50 |
51 |
52 |
53 | Provide data to the whole world.
54 |
55 |
56 | Johnson
57 |
58 |
59 |
60 | 23445
61 |
62 |
63 |
--------------------------------------------------------------------------------
/notebook/solr_functions.R:
--------------------------------------------------------------------------------
1 |
2 | ## get JSON!
3 | # json_queries <- paste0(query, "&wt=json")
4 |
5 | q = "https://knb.ecoinformatics.org/knb/d1/mn/v2/query/solr?q=genus:*&fl=identifier,northBoundCoord,eastBoundCoord,southBoundCoord,westBoundCoord,namedLocation,scientificName,kingdom,phylum,class,order,family,genus,species,beginDate,endDate&-obsoletedBy:*&start=0&rows=1000&wt=json"
6 | # solr_df(q)
7 |
8 | solr_df <- function(q){
9 | message(paste(q))
10 | resp <- GET(q)
11 | if(!grepl("json", headers(resp)$`content-type`))
12 | return(tibble())
13 | json <- content(resp, as = "parsed", type = "application/json")
14 | docs_to_nquads(json$response$docs, append = TRUE)
15 | }
16 |
17 | docs_to_nquads <- function(docs, f = tempfile(), ...){
18 | list("@context" = list("@vocab"="http://ecoinformatics.org/eml-2.1.1/",
19 | "identifier" = "@id"),
20 | "@graph" = docs) %>%
21 | toJSON(pretty=TRUE, auto_unbox = TRUE) %>%
22 | jsonld_to_rdf() %>%
23 | write_lines(path = f, ...)
24 | tabularize(f)
25 | }
26 |
27 |
28 | tabularize <- function(file){
29 |
30 | ## Express type string inside "" so we can parse
31 | read_lines(file) %>% str_replace("\"\\^\\^(.*)>", "\\^\\^\\1\"") %>% write_lines(file)
32 |
33 | df <- readr::read_delim(file, delim = " ", col_names = FALSE, col_types = "cccc")
34 | names(df) <- c("id", "property", "value", "about")
35 | df %>%
36 | mutate(property = gsub("", "\\1", property)) %>%
37 | separate(value, c("value", "type"), sep="\\^\\^<", fill="right")
38 |
39 | }
40 |
41 | spread_nquads <- function(file){
42 |
43 | tabularize(file) %>%
44 | select(id, property, value) %>%
45 | group_by(id, property) %>%
46 | mutate(key = row_number()) %>%
47 | spread(property, value) %>%
48 | select(-key) %>%
49 | fill(-id) %>% ## Fill in NA based on known properties for id, needs group_by id
50 | ungroup() %>%
51 | select(-identifier) %>% View()
52 | }
53 |
54 |
55 |
56 |
57 |
58 | ## Attempt a json & unnest strategy
59 | pure_json <- function(docs){
60 | toJSON(auto_unbox = TRUE) %>%
61 | fromJSON() %>% as_tibble() -> df
62 |
63 | ## cannot unnest appropriately across multiple areas
64 | df$scientificName[[1]] <- ""
65 | df$species[[1]] <- ""
66 | unnest(df, scientificName) %>% distinct() %>% View()
67 | }
68 |
69 |
70 |
--------------------------------------------------------------------------------
/docs/docsearch.js:
--------------------------------------------------------------------------------
1 | $(function() {
2 |
3 | // register a handler to move the focus to the search bar
4 | // upon pressing shift + "/" (i.e. "?")
5 | $(document).on('keydown', function(e) {
6 | if (e.shiftKey && e.keyCode == 191) {
7 | e.preventDefault();
8 | $("#search-input").focus();
9 | }
10 | });
11 |
12 | $(document).ready(function() {
13 | // do keyword highlighting
14 | /* modified from https://jsfiddle.net/julmot/bL6bb5oo/ */
15 | var mark = function() {
16 |
17 | var referrer = document.URL ;
18 | var paramKey = "q" ;
19 |
20 | if (referrer.indexOf("?") !== -1) {
21 | var qs = referrer.substr(referrer.indexOf('?') + 1);
22 | var qs_noanchor = qs.split('#')[0];
23 | var qsa = qs_noanchor.split('&');
24 | var keyword = "";
25 |
26 | for (var i = 0; i < qsa.length; i++) {
27 | var currentParam = qsa[i].split('=');
28 |
29 | if (currentParam.length !== 2) {
30 | continue;
31 | }
32 |
33 | if (currentParam[0] == paramKey) {
34 | keyword = decodeURIComponent(currentParam[1].replace(/\+/g, "%20"));
35 | }
36 | }
37 |
38 | if (keyword !== "") {
39 | $(".contents").unmark({
40 | done: function() {
41 | $(".contents").mark(keyword);
42 | }
43 | });
44 | }
45 | }
46 | };
47 |
48 | mark();
49 | });
50 | });
51 |
52 | /* Search term highlighting ------------------------------*/
53 |
54 | function matchedWords(hit) {
55 | var words = [];
56 |
57 | var hierarchy = hit._highlightResult.hierarchy;
58 | // loop to fetch from lvl0, lvl1, etc.
59 | for (var idx in hierarchy) {
60 | words = words.concat(hierarchy[idx].matchedWords);
61 | }
62 |
63 | var content = hit._highlightResult.content;
64 | if (content) {
65 | words = words.concat(content.matchedWords);
66 | }
67 |
68 | // return unique words
69 | var words_uniq = [...new Set(words)];
70 | return words_uniq;
71 | }
72 |
73 | function updateHitURL(hit) {
74 |
75 | var words = matchedWords(hit);
76 | var url = "";
77 |
78 | if (hit.anchor) {
79 | url = hit.url_without_anchor + '?q=' + escape(words.join(" ")) + '#' + hit.anchor;
80 | } else {
81 | url = hit.url + '?q=' + escape(words.join(" "));
82 | }
83 |
84 | return url;
85 | }
86 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-dataset.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Sample datset Description
8 |
9 |
10 | Smith
11 |
12 |
13 | My comments go here.
14 |
15 |
16 |
17 |
18 |
19 |
20 | sde
21 | The SDE scheme used at CAP LTER
22 |
23 | hostname
24 | The host
25 | mohave.asu.edu
26 |
27 |
28 | databaseName
29 | The name of the database or catalog
30 |
31 |
32 | owner
33 | The owner catalog
34 | dbo
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | def.1
43 |
44 |
45 | databaseName
46 | landuse95
47 |
48 |
49 | owner
50 | sde
51 |
52 |
53 |
54 |
55 | Provide data to the whole world.
56 |
57 |
58 | Johnson
59 |
60 |
61 |
62 | 23445
63 |
64 |
65 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-dataset.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 | Sample datset Description
8 |
9 |
10 | Smith
11 |
12 |
13 | My comments go here.
14 |
15 |
16 |
17 |
18 |
19 |
20 | sde
21 | The SDE scheme used at CAP LTER
22 |
23 | hostname
24 | The host
25 | mohave.asu.edu
26 |
27 |
28 | databaseName
29 | The name of the database or catalog
30 |
31 |
32 | owner
33 | The owner catalog
34 | dbo
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | def.1
43 |
44 |
45 | databaseName
46 | landuse95
47 |
48 |
49 | owner
50 | sde
51 |
52 |
53 |
54 |
55 | Provide data to the whole world.
56 |
57 |
58 | Johnson
59 |
60 |
61 |
62 | 23445
63 |
64 |
65 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-softwareWithAcessDistribution.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | uid=joe,o=lter,dc=ecoinformatics,dc=org
6 | all
7 |
8 |
9 | public
10 | read
11 |
12 |
13 |
14 |
15 | fish counting
16 |
17 |
18 |
19 | University of California
20 |
21 |
22 | 123 Campus Dr.
23 | Santa Barbara
24 | CA
25 | 93101
26 | USA
27 |
28 |
29 | 805-123-1234
30 |
31 | joe@something.org
32 | www.something.org/~joe
33 |
34 | 1999
35 | English
36 |
37 | fish
38 | lake
39 | jim's thesaurus
40 |
41 |
42 | This is some other fake info.
43 |
44 |
45 |
46 | you gotta buy the cd
47 |
48 |
49 |
50 |
51 |
52 | http://www.something.org
53 |
54 |
55 |
56 | uid=joe,o=lter,dc=ecoinformatics,dc=org
57 | all
58 |
59 |
60 | public
61 | read
62 |
63 |
64 |
65 |
66 | 123 MB
67 |
68 | Linux
69 | JVM
70 | 123 MB
71 | Java
72 |
73 |
74 | GPL
75 |
76 |
77 | 1.0
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-software-dependency.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | eml2
8 | eml2: Create and Manipulate Data using the Ecological Metadata Language
9 |
10 |
11 | Carl
12 | Boettiger
13 |
14 |
15 | cboettig@gmail.com
16 |
17 | A successor to the 'EML' R package which provides the same high level
18 | functions for creating and extracting data from 'EML' files, while
19 | providing a simpler and more user friendly lower level interface.
20 |
21 |
22 |
23 |
24 | https://github.com/cboettig/eml2
25 |
26 |
27 | 466.612KB
28 | R 3.5.0
29 |
30 |
31 | install
32 |
33 | xml2
34 | xml2
35 |
36 | http://orcid.org/0000-0002-1642-628X
37 |
38 |
39 |
40 |
41 | https://github.com/cboettig/eml2
42 |
43 |
44 | 466.612KB
45 | R 3.5.0
46 |
47 | https://spdx.org/licenses/MIT
48 | 1.4
49 |
50 |
51 | https://spdx.org/licenses/MIT
52 | xxx
53 |
54 |
55 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-softwareWithAcessDistribution.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | uid=joe,o=lter,dc=ecoinformatics,dc=org
6 | all
7 |
8 |
9 | public
10 | read
11 |
12 |
13 |
14 |
15 | fish counting
16 |
17 |
18 |
19 | University of California
20 |
21 |
22 | 123 Campus Dr.
23 | Santa Barbara
24 | CA
25 | 93101
26 | USA
27 |
28 |
29 | 805-123-1234
30 |
31 | joe@something.org
32 | www.something.org/~joe
33 |
34 | 1999
35 | English
36 |
37 | fish
38 | lake
39 | jim's thesaurus
40 |
41 |
42 | This is some other fake info.
43 |
44 |
45 |
46 | you gotta buy the cd
47 |
48 |
49 |
50 |
51 |
52 | http://www.something.org
53 |
54 |
55 |
56 | uid=joe,o=lter,dc=ecoinformatics,dc=org
57 | all
58 |
59 |
60 | public
61 | read
62 |
63 |
64 |
65 |
66 | 123 MB
67 |
68 | Linux
69 | JVM
70 | 123 MB
71 | Java
72 |
73 |
74 | GPL
75 |
76 |
77 | 1.0
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-datasetMultipleDistribution.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | Sample datset Description
6 |
7 |
8 | Smith
9 |
10 |
11 |
12 | My comments go here.
13 |
14 |
15 |
16 | Anyone can use it.
17 |
18 |
19 |
20 |
21 |
22 | sde
23 |
24 | The SDE scheme used at CAP LTER
25 |
26 |
27 | hostname
28 | The host
29 | mohave.asu.edu
30 |
31 |
32 | databaseName
33 | The name of the database or catalog
34 |
35 |
36 | owner
37 | The owner catalog
38 | dbo
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | def.1
48 |
49 |
50 | databaseName
51 | landuse95
52 |
53 |
54 | owner
55 | sde
56 |
57 |
58 |
59 |
60 |
61 |
62 | http://my.url.edu
63 |
64 |
65 |
66 | 23445
67 |
68 |
69 | Provide data to the whole world.
70 |
71 |
72 |
73 | Johnson
74 |
75 |
76 |
77 | 23445
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-datasetMultipleDistribution.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 | Sample datset Description
6 |
7 |
8 | Smith
9 |
10 |
11 |
12 | My comments go here.
13 |
14 |
15 |
16 | Anyone can use it.
17 |
18 |
19 |
20 |
21 |
22 | sde
23 |
24 | The SDE scheme used at CAP LTER
25 |
26 |
27 | hostname
28 | The host
29 | mohave.asu.edu
30 |
31 |
32 | databaseName
33 | The name of the database or catalog
34 |
35 |
36 | owner
37 | The owner catalog
38 | dbo
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | def.1
48 |
49 |
50 | databaseName
51 | landuse95
52 |
53 |
54 | owner
55 | sde
56 |
57 |
58 |
59 |
60 |
61 |
62 | http://my.url.edu
63 |
64 |
65 |
66 | 23445
67 |
68 |
69 | Provide data to the whole world.
70 |
71 |
72 |
73 | Johnson
74 |
75 |
76 |
77 | 23445
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/man/emld-package.Rd:
--------------------------------------------------------------------------------
1 | % Generated by roxygen2: do not edit by hand
2 | % Please edit documentation in R/emld-package.R, R/emld.R
3 | \docType{package}
4 | \name{emld-package}
5 | \alias{emld-package}
6 | \title{emld: Ecological Metadata as Linked Data}
7 | \description{
8 | This is a utility for transforming Ecological Metadata Language ('EML') files into 'JSON-LD' and back into 'EML.' Doing so creates a list-based representation of 'EML' in R, so that 'EML' data can easily be manipulated using standard 'R' tools. This makes this package an effective backend for other 'R'-based tools working with 'EML.' By abstracting away the complexity of 'XML' Schema, developers can build around native 'R' list objects and not have to worry about satisfying many of the additional constraints of set by the schema (such as element ordering, which is handled automatically). Additionally, the 'JSON-LD' representation enables the use of developer-friendly 'JSON' parsing and serialization that may facilitate the use of 'EML' in contexts outside of 'R,' as well as the informatics-friendly serializations such as 'RDF' and 'SPARQL' queries.
9 |
10 | The goal of emld is to provide a way to work with EML metadata
11 | in the JSON-LD format. At it's heart, the package is simply a
12 | way to translate an EML XML document into JSON-LD and be able
13 | to reverse this so that any semantically equivalent JSON-LD
14 | file can be serialized into EML-schema valid XML.
15 | }
16 | \details{
17 | The package has only three core functions:
18 | \itemize{
19 | \item \code{\link[=as_emld]{as_emld()}} Convert EML's \code{xml} files (or the \code{json} version created
20 | by this package) into a native R object (an S3 class called \code{emld},
21 | essentially just a \code{list}).
22 | \item \code{\link[=as_xml]{as_xml()}} Convert the native R format, \code{emld}, back into
23 | XML-schema valid EML.
24 | \item \code{\link[=as_json]{as_json()}} Convert the native R format, \code{emld}, into \code{json}(LD).
25 | }
26 | }
27 | \seealso{
28 | Useful links:
29 | \itemize{
30 | \item \url{https://docs.ropensci.org/emld/}
31 | \item \url{https://github.com/ropensci/emld}
32 | \item Report bugs at \url{https://github.com/ropensci/emld/issues}
33 | }
34 |
35 |
36 | Useful links:
37 | \itemize{
38 | \item \url{https://docs.ropensci.org/emld/}
39 | \item \url{https://github.com/ropensci/emld}
40 | \item Report bugs at \url{https://github.com/ropensci/emld/issues}
41 | }
42 |
43 | }
44 | \author{
45 | \strong{Maintainer}: Carl Boettiger \email{cboettig@gmail.com} (\href{https://orcid.org/0000-0002-1642-628X}{ORCID}) [copyright holder]
46 |
47 | Authors:
48 | \itemize{
49 | \item Matthew B. Jones \email{jones@nceas.ucsb.edu} (\href{https://orcid.org/0000-0003-0077-4738}{ORCID}) [copyright holder]
50 | \item Bryce Mecum \email{mecum@nceas.ucsb.edu} (\href{https://orcid.org/0000-0002-0381-3766}{ORCID}) [copyright holder]
51 | }
52 |
53 | }
54 | \keyword{internal}
55 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.2.0/eml-datasetWithAccess.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | uid=brooke,o=NCEAS,dc=ecoinformatics,dc=org
11 | all
12 |
13 |
14 | public
15 | read
16 |
17 |
18 | uid=berkley,o=NCEAS,dc=ecoinformatics,dc=org
19 | read
20 | write
21 | all
22 |
23 |
24 |
25 |
26 | Sample datset Description
27 |
28 |
29 | Smith
30 |
31 |
32 | My comments go here.
33 |
34 |
35 |
36 |
37 |
38 |
39 | sde
40 | The SDE scheme used at CAP LTER
41 |
42 | hostname
43 | The host
44 | mohave.asu.edu
45 |
46 |
47 | databaseName
48 | The name of the database or catalog
49 |
50 |
51 | owner
52 | The owner catalog
53 | dbo
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | def.1
62 |
63 |
64 | databaseName
65 | landuse95
66 |
67 |
68 | owner
69 | sde
70 |
71 |
72 |
73 |
74 | Provide data to the whole world.
75 |
76 |
77 | Johnson
78 |
79 |
80 |
81 | 23445
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/inst/tests/eml-2.1.1/eml-datasetWithAccess.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 | uid=brooke,o=NCEAS,dc=ecoinformatics,dc=org
11 | all
12 |
13 |
14 | public
15 | read
16 |
17 |
18 | uid=berkley,o=NCEAS,dc=ecoinformatics,dc=org
19 | read
20 | write
21 | all
22 |
23 |
24 |
25 |
26 | Sample datset Description
27 |
28 |
29 | Smith
30 |
31 |
32 | My comments go here.
33 |
34 |
35 |
36 |
37 |
38 |
39 | sde
40 | The SDE scheme used at CAP LTER
41 |
42 | hostname
43 | The host
44 | mohave.asu.edu
45 |
46 |
47 | databaseName
48 | The name of the database or catalog
49 |
50 |
51 | owner
52 | The owner catalog
53 | dbo
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | def.1
62 |
63 |
64 | databaseName
65 | landuse95
66 |
67 |
68 | owner
69 | sde
70 |
71 |
72 |
73 |
74 | Provide data to the whole world.
75 |
76 |
77 | Johnson
78 |
79 |
80 |
81 | 23445
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/inst/xsd/eml-2.1.0/eml-documentation.xsd:
--------------------------------------------------------------------------------
1 |
2 |
8 |
10 |
11 |
12 | '$RCSfile: eml-documentation.xsd,v $'
13 | Copyright: 1997-2002 Regents of the University of California,
14 | University of New Mexico, and
15 | Arizona State University
16 | Sponsors: National Center for Ecological Analysis and Synthesis and
17 | Partnership for Interdisciplinary Studies of Coastal Oceans,
18 | University of California Santa Barbara
19 | Long-Term Ecological Research Network Office,
20 | University of New Mexico
21 | Center for Environmental Studies, Arizona State University
22 | Other funding: National Science Foundation (see README for details)
23 | The David and Lucile Packard Foundation
24 | For Details: http://knb.ecoinformatics.org/
25 |
26 | '$Author: obrien $'
27 | '$Date: 2008-08-27 21:30:04 $'
28 | '$Revision: 1.27 $'
29 |
30 | This program is free software; you can redistribute it and/or modify
31 | it under the terms of the GNU General Public License as published by
32 | the Free Software Foundation; either version 2 of the License, or
33 | (at your option) any later version.
34 |
35 | This program is distributed in the hope that it will be useful,
36 | but WITHOUT ANY WARRANTY; without even the implied warranty of
37 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 | GNU General Public License for more details.
39 |
40 | You should have received a copy of the GNU General Public License
41 | along with this program; if not, write to the Free Software
42 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------