Title: | Create DCAT-AP CH Metadata Files |
---|---|
Description: | Create DCAT-AP CH metadata files, typically in rdf format. |
Authors: | Sandro Burri [aut, cre] |
Maintainer: | Sandro Burri <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.0.1 |
Built: | 2025-01-22 04:56:30 UTC |
Source: | https://github.com/SwissStatsR/dcatapchr |
Adds quotes to a character string
add_quotes(x)
add_quotes(x)
x |
a character string (or vector) |
Check language validity ("de", "fr", "it", "en")
check_language(language)
check_language(language)
language |
one of "de", "fr", "it" or "en" |
Create a dcat:accessService property in DCAT-AP CH standard
dcat_accessService(x = dcat_DataService())
dcat_accessService(x = dcat_DataService())
x |
things to include in a dcat:accessService, typically one or more dcat:DataService |
Create a dcat:accessURL property in DCAT-AP CH standard
dcat_accessURL( access_url = "https://www3.ti.ch/DFE/DR/USTAT/allegati/cubo/cubi_POL_01_csv.zip" )
dcat_accessURL( access_url = "https://www3.ti.ch/DFE/DR/USTAT/allegati/cubo/cubi_POL_01_csv.zip" )
access_url |
url of the resource Mandatory property of |
Create a dcat:byteSize property in DCAT-AP CH standard
dcat_byteSize(size = 0)
dcat_byteSize(size = 0)
size |
size of the resource (in bytes) Property of |
Create a DCAT-AP CH Catalog (dcat:Catalog)
dcat_catalog( catalog_endpoint = "https://swisstopo/catalog-endpoint.rdf", datasets = "<dcat:dataset rdf:resource=\"https://swisstopo/123\"/>", ... )
dcat_catalog( catalog_endpoint = "https://swisstopo/catalog-endpoint.rdf", datasets = "<dcat:dataset rdf:resource=\"https://swisstopo/123\"/>", ... )
catalog_endpoint |
URL/URI of the catalog endpoint |
datasets |
character vector with one or more dcat:dataset(s), see
|
... |
any other property to be included to a dcat:Catalog |
A dcat:Catalog class, created with dcat_catalog(), can/must have the following properties (M stands for mandatory; R for recommended):
dcat:dataset, M in V1, R in V2: see dcat_dataset()
dct:description, M in V2: see dct_description()
dct:publisher, M in V2: see dct_publisher()
dct:title, M in V2: see dct_title()
foaf:homepage, R in V2: see foaf_homepage()
dct:language, R in V2: see dct_language()
dct:license, R in V2: see dct_license()
dct:issued, R in V2: see dct_issued()
dct:rights, R in V2: see dct_rights()
dct:spatial, R in V2: see dct_spatial()
dcat:themeTaxonomy, R in V2: see dcat_themeTaxonomy()
dct:modified, R in V2: see dct_modified()
dcat:service, R in V2: see dcat_service()
A character vector of length greater than one,
where each element is a line of the catalog in rdf
format. The catalog can be exported in a file with
unix file endings and UTF-8 encoding with
write_unix()
.
dcat_catalog() dcat_catalog(catalog_endpoint = "") # Add some properties (...) dcat_catalog( title = dct_title("Catalogo Ustat", language = "it"), description = dct_description("Descrizione catalogo", language = "it") )
dcat_catalog() dcat_catalog(catalog_endpoint = "") # Add some properties (...) dcat_catalog( title = dct_title("Catalogo Ustat", language = "it"), description = dct_description("Descrizione catalogo", language = "it") )
Create a dcat:contactPoint property in DCAT-AP CH standard
dcat_contactPoint( nodeID = paste(sample(letters), collapse = ""), email = "[email protected]", fn = "Ufficio di statistica del Canton Ticino (Ustat)" )
dcat_contactPoint( nodeID = paste(sample(letters), collapse = ""), email = "[email protected]", fn = "Ufficio di statistica del Canton Ticino (Ustat)" )
nodeID |
organization id (character string) |
email |
email address |
fn |
name of the organization Mandatory property of |
Create a DCAT-AP CH DataService (dcat:DataService)
dcat_DataService(about = "", endpointURL = dcat_endpointURL(), ...)
dcat_DataService(about = "", endpointURL = dcat_endpointURL(), ...)
about |
url of the DataService |
endpointURL |
enpointURL of the dataset, see dcat_endpointURL() |
... |
any other property to be included to a dcat:Dataset |
A dcat:DataService class, created with dcat_DataService(), can/must have the following properties (M stands for mandatory; R for recommended):
dcat:endpointURL, M in V2: see dcat_endpointURL()
dcat:contactPoint, M in V2: see dcat_contactPoint()
dct:publisher, M in V2: see dct_publisher()
dct:title, M in V2: see dct_title()
dct:endpointDescription, R in V2: see dcat_endpointDescription()
dct:license, R in V2: see dct_license()
and/or dct_license2()
dcat:servesDataset, R in V2: see dcat_servesDataset()
A character vector of length greater than one.
A dcat:dataset must have one or more dcat:distribution(s).
dcat_dataset( title = dct_title(), description = dct_description(), publisher = dct_publisher(), contactPoint = dcat_contactPoint(), identifier = dct_identifier(), distribution = dcat_distribution(), ... )
dcat_dataset( title = dct_title(), description = dct_description(), publisher = dct_publisher(), contactPoint = dcat_contactPoint(), identifier = dct_identifier(), distribution = dcat_distribution(), ... )
title |
title of the dataset, see |
description |
description of the dataset, see |
publisher |
publisher of the dataset, see |
contactPoint |
contactPoint of the dataset, see |
identifier |
identifier of the dataset, see |
distribution |
one or more distributions, see |
... |
any other property to be included to a dcat:Dataset |
A dcat:Dataset class, created with dcat_dataset(), can/must have the following properties (M stands for mandatory; R for recommended):
dcat:contactPoint, M in V1 and V2: see dcat_contactPoint()
dct:description, M in V1 and V2: see dct_description()
dct:identifier, M in V1 and V2: see dct_identifier()
dct:publisher, M in V1 and V2: see dct_publisher()
dct:title, M in V1 and V2: see dct_title()
dcat:distribution, M in V1, R in V2: see dcat_distribution()
dcat:keyword, R in V2: see dcat_keyword()
dcat:landingPage, R in V2: see dcat_landingPage()
dct:issued, R in V2: see dct_issued()
dct:spatial, R in V2: see dct_spatial()
dct:temporal, R in V2: see dct_temporal()
dcat:theme, R in V2: see dcat_theme()
dct:modified, R in V2: see dct_modified()
A character vector of length greater than one.
Create a dcat:distribution/dcat:Distribution property
dcat_distribution( issued = dct_issued(), access_url = dcat_accessURL(), license = dct_license2(), ... )
dcat_distribution( issued = dct_issued(), access_url = dcat_accessURL(), license = dct_license2(), ... )
issued |
dct:issued property, see |
access_url |
dcat:accessURL property, see |
license |
dct:license property, see |
... |
any other property to be included to a dcat:Distribution |
A dcat:Dataset class, created with dcat_dataset(), can/must have the following properties (M stands for mandatory; R for recommended):
dct:issued, M in V1, R in V2: see dct_issued()
dcat:accessURL, M in V1 and V2: see dcat_accessURL()
dct:license, M in V1 and V2: see dct_license()
dcatap:availability, R in V2: not yet implemented
dct:description, R in V1 and V2: see dct_description()
dct:format, R in V2: see dct_format()
dct:rights, R in V2: see dct_rights()
dct:title, M in V1, R in V2: see dct_title()
dct:modified, R in V2: see dct_modified()
dcat:accessService, R in V2: see dcat_accessService()
A character vector of length greater than one.
dcat_distribution() dcat_distribution(description = dct_description("Un archivio zip con un csv"))
dcat_distribution() dcat_distribution(description = dct_description("Un archivio zip con un csv"))
Create a dcat:downloadURL property in DCAT-AP CH standard
dcat_downloadURL( download_url = "https://www3.ti.ch/DFE/DR/USTAT/allegati/cubo/cubi_POL_01_csv.zip" )
dcat_downloadURL( download_url = "https://www3.ti.ch/DFE/DR/USTAT/allegati/cubo/cubi_POL_01_csv.zip" )
download_url |
url of the resource Property of |
Create a dcat:endpointDescription property in DCAT-AP CH standard
dcat_endpointDescription(x = "")
dcat_endpointDescription(x = "")
x |
a url |
Create a dcat:endpointURL property in DCAT-AP CH standard
dcat_endpointURL(x = "")
dcat_endpointURL(x = "")
x |
a url |
Create a dcat:keyword property in DCAT-AP CH standard
dcat_keyword(x = "", language = c("de", "fr", "it", "en"))
dcat_keyword(x = "", language = c("de", "fr", "it", "en"))
x |
keyword |
language |
one of "de", "fr", "it" or "en" |
dcat_keyword() dcat_keyword("Cani", language = "it") dcat_keyword("Hunde", language = "de")
dcat_keyword() dcat_keyword("Cani", language = "it") dcat_keyword("Hunde", language = "de")
Create a dcat:landingPage property in DCAT-AP CH standard
dcat_landingPage(x = "https://www.example.com")
dcat_landingPage(x = "https://www.example.com")
x |
an url (character string). Default: https://www.example.com |
dcat_landingPage()
dcat_landingPage()
Create a dcat:servesDataset property in DCAT-AP CH standard
dcat_servesDataset(x = "https://example.com")
dcat_servesDataset(x = "https://example.com")
x |
a url |
dcat_servesDataset("https://example.com")
dcat_servesDataset("https://example.com")
Create a dcat:service property in DCAT-AP CH standard
dcat_service(x = "")
dcat_service(x = "")
x |
things to include in a dcat:service, typically one or more dcat:DataService |
Create a dcat:theme property in DCAT-AP CH standard
dcat_theme(x = "http://dcat-ap.ch/vocabulary/themes/work")
dcat_theme(x = "http://dcat-ap.ch/vocabulary/themes/work")
x |
a theme url |
Create a dcat:themeTaxonomy property in DCAT-AP CH standard
dcat_themeTaxonomy( x = "http://publications.europa.eu/resource/authority/data-theme" )
dcat_themeTaxonomy( x = "http://publications.europa.eu/resource/authority/data-theme" )
x |
an url |
Create a dct:accrualPeriodicity property in DCAT-AP CH standard
dct_accrualPeriodicity( freq = c("https://publications.europa.eu/resource/authority/frequency/ANNUAL", "https://publications.europa.eu/resource/authority/frequency/QUARTERLY", "https://publications.europa.eu/resource/authority/frequency/MONTHLY", "https://publications.europa.eu/resource/authority/frequency/DAILY") )
dct_accrualPeriodicity( freq = c("https://publications.europa.eu/resource/authority/frequency/ANNUAL", "https://publications.europa.eu/resource/authority/frequency/QUARTERLY", "https://publications.europa.eu/resource/authority/frequency/MONTHLY", "https://publications.europa.eu/resource/authority/frequency/DAILY") )
freq |
frequency with which a dataset is updated (see https://publications.europa.eu/resource/authority/frequency) |
Create a dct:description property in DCAT-AP CH standard
dct_description(description = "", language = "it")
dct_description(description = "", language = "it")
description |
character string with a description |
language |
language of the title (one of "it", "de", "fr", "en") |
Create a dct:format property in DCAT-AP CH standard
dct_format( x = "http://publications.europa.eu/resource/authority/file-type/CSV" )
dct_format( x = "http://publications.europa.eu/resource/authority/file-type/CSV" )
x |
a filetype resource url/uri. See https://publications.europa.eu/resource/authority/file-type |
Create a dct:identifier property in DCAT-AP CH standard
dct_identifier(identifier = "xyz456@cantone_ticino")
dct_identifier(identifier = "xyz456@cantone_ticino")
identifier |
character string with and identifier |
Create a dct:issued property in DCAT-AP CH standard
dct_issued(date = Sys.Date(), hour_minutes_seconds = "00:00:00")
dct_issued(date = Sys.Date(), hour_minutes_seconds = "00:00:00")
date |
date or character vector in yyyy-mm-dd format |
hour_minutes_seconds |
hour, minutes and seconds (default: "00:00:00") |
Create a dct:language property in DCAT-AP CH standard
dct_language(language = c("de", "fr", "it", "en"))
dct_language(language = c("de", "fr", "it", "en"))
language |
two-letters abbreviation of the language (one of "de", "fr", "it" or "en") |
Create a dct:license property in DCAT-AP CH standard
dct_license(about = "http://dcat-ap.ch/vocabulary/licenses/terms_open") dct_license2( license = c("NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired", "NonCommercialAllowed-CommercialAllowed-ReferenceRequired", "NonCommercialAllowed-CommercialWithPermission-ReferenceNotRequired", "NonCommercialAllowed-CommercialWithPermission-ReferenceRequired") )
dct_license(about = "http://dcat-ap.ch/vocabulary/licenses/terms_open") dct_license2( license = c("NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired", "NonCommercialAllowed-CommercialAllowed-ReferenceRequired", "NonCommercialAllowed-CommercialWithPermission-ReferenceNotRequired", "NonCommercialAllowed-CommercialWithPermission-ReferenceRequired") )
about |
a dct:license uri. See https://www.dcat-ap.ch/vocabulary/licenses/20210623.html |
license |
one of the licenses allowed in opendata.swiss See also https://dcat-ap.ch/vocabulary/licenses/20210623.html#terms_open for a list of possible licenses. |
Create a dct:modified property in DCAT-AP CH standard
dct_modified(date = Sys.Date(), hour_minutes_seconds = "00:00:00")
dct_modified(date = Sys.Date(), hour_minutes_seconds = "00:00:00")
date |
date or character vector in yyyy-mm-dd format |
hour_minutes_seconds |
hour, minutes and seconds (default: "00:00:00") |
Create a dct:publisher property in DCAT-AP CH standard
dct_publisher( publisher = "https://www.ti.ch/ustat", foaf_name = "Ufficio di statistica del Cantone Ticino (Ustat)" )
dct_publisher( publisher = "https://www.ti.ch/ustat", foaf_name = "Ufficio di statistica del Cantone Ticino (Ustat)" )
publisher |
character string with a publisher (usually an URL) |
foaf_name |
name of the organization/publisher |
Create a dct:rights property in DCAT-AP CH standard
dct_rights( license = c("NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired", "NonCommercialAllowed-CommercialAllowed-ReferenceRequired", "NonCommercialAllowed-CommercialWithPermission-ReferenceNotRequired", "NonCommercialAllowed-CommercialWithPermission-ReferenceRequired") )
dct_rights( license = c("NonCommercialAllowed-CommercialAllowed-ReferenceNotRequired", "NonCommercialAllowed-CommercialAllowed-ReferenceRequired", "NonCommercialAllowed-CommercialWithPermission-ReferenceNotRequired", "NonCommercialAllowed-CommercialWithPermission-ReferenceRequired") )
license |
one of the licenses allowed in opendata.swiss See also https://dcat-ap.ch/vocabulary/licenses/20210623.html#terms_open for a list of possible licenses. |
Create a dct:spatial property in DCAT-AP CH standard
dct_spatial(x = "Switzerland")
dct_spatial(x = "Switzerland")
x |
spatial reference (default: "Switzerland") |
Create a dct:temporal property in DCAT-AP CH standard
dct_temporal(startDate = Sys.Date() - 1, endDate = Sys.Date())
dct_temporal(startDate = Sys.Date() - 1, endDate = Sys.Date())
startDate |
start date (default: Sys.Date() - 1). Date in yyyy-mm-dd format |
endDate |
end date (default: Sys.Date()). Date in yyyy-mm-dd format |
Create a dct:title property in DCAT-AP CH standard
dct_title(title = "", language = "it")
dct_title(title = "", language = "it")
title |
character string with a title |
language |
language of the title (one of "it", "de", "fr", "en") Mandatory property of |
A closure to create a function that generates a tag like
f_gen_tag(tag = "dct:identifier")
f_gen_tag(tag = "dct:identifier")
tag |
character string with the desired tag |
# Create an f function to generate a dct:identifier tag f <- f_gen_tag(tag = "dct:identifier") f(x = "an_identifier")
# Create an f function to generate a dct:identifier tag f <- f_gen_tag(tag = "dct:identifier") f(x = "an_identifier")
A closure to create a function that generates a tag like
f_gen_tag2(tag = "dcat:accessURL", rdf_resource = "rdf:resource")
f_gen_tag2(tag = "dcat:accessURL", rdf_resource = "rdf:resource")
tag |
character string with the desired tag |
rdf_resource |
character string that comes afer the tag (default: "rdf:resource") |
# Create an f function to generate a dcat:accessURL tag f <- f_gen_tag2(tag = "dcat:accessURL") f(x = "https://www.example.com")
# Create an f function to generate a dcat:accessURL tag f <- f_gen_tag2(tag = "dcat:accessURL") f(x = "https://www.example.com")
Create a foaf:homepage tag
foaf_homepage(x = "http://www.example.com")
foaf_homepage(x = "http://www.example.com")
x |
an url of a homepage |
Generate a tag like
gen_tag(tag = "dct:identifier", x = "...")
gen_tag(tag = "dct:identifier", x = "...")
tag |
character string with the desired tag |
x |
the content to be encapsulated inside the tag |
Generate a tag like
gen_tag2( tag = "dcat:accessURL", x = "https://example.com", rdf_resource = "rdf:resource" )
gen_tag2( tag = "dcat:accessURL", x = "https://example.com", rdf_resource = "rdf:resource" )
tag |
character string with the desired tag |
x |
the content to be encapsulated inside the tag. Note that this content is enclosed in quotation marks (by the function) |
rdf_resource |
character string that comes afer the tag (default: "rdf:resource") |
Indent a character vector by some spaces
indent(x, nspaces = 2L)
indent(x, nspaces = 2L)
x |
a character vector |
nspaces |
number of desired spaces to indent (default: 2) |
Prepare a dataset to be exported in rdf/xml
rdf_dataset( dataset = dcat_dataset(), namespaces = c("xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"", "xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"", "xmlns:hydra=\"http://www.w3.org/ns/hydra/core#\"", "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"", "xmlns:dcat=\"http://www.w3.org/ns/dcat#\"", "xmlns:dct=\"http://purl.org/dc/terms/\"", "xmlns:vcard=\"http://www.w3.org/2006/vcard/ns#\"", "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"", "xmlns:schema=\"http://schema.org/\"") )
rdf_dataset( dataset = dcat_dataset(), namespaces = c("xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"", "xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"", "xmlns:hydra=\"http://www.w3.org/ns/hydra/core#\"", "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"", "xmlns:dcat=\"http://www.w3.org/ns/dcat#\"", "xmlns:dct=\"http://purl.org/dc/terms/\"", "xmlns:vcard=\"http://www.w3.org/2006/vcard/ns#\"", "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"", "xmlns:schema=\"http://schema.org/\"") )
dataset |
a dataset created with |
namespaces |
character vector with xml/rdf namespaces |
Create a character vector with some xml/rdf namespaces
rdf_namespaces( namespaces = c("xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"", "xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"", "xmlns:hydra=\"http://www.w3.org/ns/hydra/core#\"", "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"", "xmlns:dcat=\"http://www.w3.org/ns/dcat#\"", "xmlns:dct=\"http://purl.org/dc/terms/\"", "xmlns:vcard=\"http://www.w3.org/2006/vcard/ns#\"", "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"", "xmlns:schema=\"http://schema.org/\""), nspaces = 2L )
rdf_namespaces( namespaces = c("xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"", "xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"", "xmlns:hydra=\"http://www.w3.org/ns/hydra/core#\"", "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"", "xmlns:dcat=\"http://www.w3.org/ns/dcat#\"", "xmlns:dct=\"http://purl.org/dc/terms/\"", "xmlns:vcard=\"http://www.w3.org/2006/vcard/ns#\"", "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema#\"", "xmlns:schema=\"http://schema.org/\""), nspaces = 2L )
namespaces |
character vector with xml/rdf namespaces |
nspaces |
number of spaces to indent (default: 2) |
Write a character vector to a file with unix file endings and UTF-8 encoding
write_unix(x, filename)
write_unix(x, filename)
x |
a character vector |
filename |
filename |