Reference¶
datacatalogtordf.resource¶
Resource module for mapping a sub-classes to rdf.
This module contains methods for mapping a sub-class objects to rdf according to the dcat-ap-no v.2 standard
Refer to sub-class for typical usage examples.
-
class
datacatalogtordf.resource.
Resource
¶ Bases:
abc.ABC
An abstract class representing a dcat:Resource.
Ref: dcat:Resource.
-
access_rights
¶ A link to information about who can access the resource or an indication of its security status.
- Type
-
conformsTo
¶ A list of links to established standards to which the described resource conforms.
- Type
List[URI]
-
contactpoint
¶ Relevant contact information for the cataloged resource.
- Type
Contact
-
description
¶ A free-text account of the item. key is language code.
- Type
dict
-
title
¶ A name given to the item. key is langauge code.
- Type
dict
-
language
¶ A list of links to languages of the item.
- Type
List[str]
-
publisher
¶ A URI uniquely identifying the publisher of the resource
- Type
Any
-
resource_relation
¶ A list of links to resources with an unspecified relationship to the cataloged item.
- Type
List[URI]
-
qualified_relation
¶ A list of links to a description of a relationship with another resource
- Type
List[Relationship]
-
keyword
¶ A keyword or tag describing the resource. key is language code.
- Type
dict
-
landing_page
¶ A list of links to web pages that can be navigated to in a Web browser to gain access to the catalog, a dataset, its distributions and/or additional information.
- Type
List[URI]
-
qualified_attributions
¶ List of links to an Agent having some form of responsibility for the resource
- Type
List[dict]
-
rights
¶ A link to a statement that concerns all rights not addressed with dct:license or dct:accessRights, such as copyright statements.
- Type
-
has_policy
¶ A link to an ODRL conformant policy expressing the rights associated with the resource.
- Type
-
is_referenced_by
¶ A list of related resources, such as a publication, that references, cites, or otherwise points to the cataloged resource.
- Type
List[Resource]
-
property
access_rights
¶ Get/set for access_rights.
- Return type
str
-
property
conformsTo
¶ Get/set for conformsTo.
- Return type
List
[str
]
-
property
contactpoint
¶ Get/set for contactpoint.
- Return type
Contact
-
property
creator
¶ Get/set for creator.
- Return type
str
-
property
description
¶ Description attribute.
- Return type
dict
-
property
has_policy
¶ Get/set for has_policy.
- Return type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
property
keyword
¶ Title attribute.
- Return type
dict
-
property
landing_page
¶ Get/set for landing_page.
- Return type
List
[str
]
-
property
language
¶ Get/set for language.
- Return type
List
[str
]
-
property
license
¶ Get/set for license.
- Return type
str
-
property
modification_date
¶ Get/set for modification_date.
- Return type
str
-
property
publisher
¶ Get/set for publisher.
- Return type
Any
-
property
qualified_attributions
¶ Get/set for qualified_attributions.
- Return type
List
[dict
]
-
property
qualified_relation
¶ Get/set for qualified_relation.
- Return type
List[Relationship]
-
property
release_date
¶ Get/set for release_date.
- Return type
str
-
property
resource_relation
¶ Get/set for resource_relation.
- Return type
List
[str
]
-
property
rights
¶ Get/set for rights.
- Return type
str
-
property
theme
¶ Get/set for theme.
- Return type
List
[str
]
-
property
title
¶ Title attribute.
- Return type
dict
-
to_rdf
(format='turtle', encoding='utf-8')¶ Maps the distribution to rdf.
- Available formats:
turtle (default)
xml
json-ld
- Parameters
format (
str
) – a valid format.encoding (
Optional
[str
]) – the encoding to serialize into
- Return type
Union
[bytes
,str
]- Returns
a rdf serialization as a bytes literal according to format.
Example
>>> from datacatalogtordf import Catalog >>> >>> catalog = Catalog() >>> catalog.identifier = "http://example.com/catalogs/1" >>> catalog.title = {'en': 'Title of catalog'} >>> bool(catalog.to_rdf()) True
-
property
type_genre
¶ Get/set for type_genre.
- Return type
str
-
datacatalogtordf.relationship¶
Relationship module for mapping a relationship to rdf.
This module contains methods for mapping a relationship object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import Relationship
>>>
>>> relationship = Relationship()
>>> relationship.identifier = "http://example.com/relations/1"
>>> relationship.title = {"en": "Title of relationship"}
>>>
>>> bool(relationship.to_rdf())
True
-
class
datacatalogtordf.relationship.
Relationship
(identifier=None)¶ Bases:
object
A class representing a dcat:Relationship.
Ref: dcat:Relationship
-
property
had_role
¶ Get/set for had_role.
- Return type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
to_rdf
(format='turtle', encoding='utf-8')¶ Maps the relationship to rdf.
- Parameters
format (
str
) – a valid format. Default: turtleencoding (
Optional
[str
]) – the encoding to serialize into
- Return type
Union
[bytes
,str
]- Returns
a rdf serialization as a bytes literal according to format.
-
property
datacatalogtordf.catalog¶
Catalog module for mapping a catalog to rdf.
This module contains methods for mapping a catalog object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import Catalog, Dataset
>>>
>>> catalog = Catalog()
>>> catalog.identifier = "http://example.com/catalogs/1"
>>> catalog.title = {"en": "Title of catalog"}
>>>
>>> a_dataset = Dataset()
>>> a_dataset.identifier = "http://example.com/datasets/1"
>>> catalog.datasets.append(a_dataset)
>>>
>>> bool(catalog.to_rdf())
True
-
class
datacatalogtordf.catalog.
Catalog
(identifier=None)¶ Bases:
datacatalogtordf.dataset.Dataset
A class representing a dcat:Catalog.
Ref: dcat:Catalog.
-
themes
¶ A list of links to knowledge organization system (KOS) used to classify catalog
- Type
List[URI]
-
services
¶ A list of dataservices of sites or end-points that is listed in the catalog.
- Type
List[DataService]
-
catalogs
¶ A list of catalogs that are of interest in the context of this catalog.
- Type
List[Catalog]
-
catalogrecords
¶ A list of records describing the registration of a single dataset or data service that is part of the catalog.
- Type
List[CatalogRecord]
-
property
access_rights
¶ Get/set for access_rights.
- Return type
str
-
property
access_rights_comments
¶ Get/set for access_rights_comments.
- Return type
List
[str
]
-
property
catalogrecords
¶ Get/set for catalogrecords.
- Return type
List
[CatalogRecord
]
-
property
conformsTo
¶ Get/set for conformsTo.
- Return type
List
[str
]
-
property
contactpoint
¶ Get/set for contactpoint.
- Return type
Contact
-
property
contains_services
¶ Get/set for contains_services.
- Return type
List
[Any
]
-
property
creator
¶ Get/set for creator.
- Return type
str
-
property
dct_identifier
¶ Get for dct_identifier.
- Return type
str
-
property
description
¶ Description attribute.
- Return type
dict
-
property
distributions
¶ Get/set for distributions.
- Return type
List
[Distribution
]
-
property
frequency
¶ Get/set for frequency.
- Return type
str
-
property
has_policy
¶ Get/set for has_policy.
- Return type
str
-
property
homepage
¶ Get/set for homepage.
- Return type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
property
in_series
¶ Get/set for in_series.
- Return type
-
property
keyword
¶ Title attribute.
- Return type
dict
-
property
landing_page
¶ Get/set for landing_page.
- Return type
List
[str
]
-
property
language
¶ Get/set for language.
- Return type
List
[str
]
-
property
license
¶ Get/set for license.
- Return type
str
-
property
models
¶ Get/set for models.
- Return type
List
[Any
]
-
property
modification_date
¶ Get/set for modification_date.
- Return type
str
-
property
publisher
¶ Get/set for publisher.
- Return type
Any
-
property
qualified_attributions
¶ Get/set for qualified_attributions.
- Return type
List
[dict
]
-
property
qualified_relation
¶ Get/set for qualified_relation.
- Return type
List[Relationship]
-
property
release_date
¶ Get/set for release_date.
- Return type
str
-
property
resource_relation
¶ Get/set for resource_relation.
- Return type
List
[str
]
-
property
rights
¶ Get/set for rights.
- Return type
str
-
property
services
¶ Get/set for services.
- Return type
List
[DataService
]
-
property
spatial_resolution_in_meters
¶ Get/set for spatial_resolution_in_meters.
- Return type
List
[Decimal
]
-
property
temporal
¶ Get/set for temporal.
- Return type
List
[PeriodOfTime
]
-
property
temporal_resolution
¶ Get/set for temporal_resolution.
- Return type
List
[str
]
-
property
theme
¶ Get/set for theme.
- Return type
List
[str
]
-
property
themes
¶ Get/set for themes.
- Return type
List
[str
]
-
property
title
¶ Title attribute.
- Return type
dict
-
to_rdf
(format='turtle', encoding='utf-8', include_datasets=True, include_services=True, include_models=True, include_contains_services=True)¶ Maps the catalog to rdf.
- Available formats:
turtle (default)
xml
json-ld
- Parameters
format (str) – a valid format.
encoding (str) – the encoding to serialize into
include_datasets (bool) – includes the dataset graphs in the catalog
include_services (bool) – includes the services in the catalog
include_models (bool) – includes the models in the catalog
include_contains_services (bool) – includes the services (cpsvno) in the catalog
- Return type
Union
[bytes
,str
]- Returns
a rdf serialization as a bytes literal according to format.
-
property
type_genre
¶ Get/set for type_genre.
- Return type
str
-
property
was_generated_by
¶ Get/set for was_generated_by.
- Return type
str
-
datacatalogtordf.catalogrecord¶
CatalogRecord module for mapping a catalogrecord to rdf.
This module contains methods for mapping a catalogrecord object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import CatalogRecord
>>>
>>> catalogrecord = CatalogRecord()
>>> catalogrecord.identifier = "http://example.com/catalogrecords/1"
>>> catalogrecord.title = {"en": "Title of catalogrecord"}
>>>
>>> bool(catalogrecord.to_rdf())
True
-
class
datacatalogtordf.catalogrecord.
CatalogRecord
(identifier=None)¶ Bases:
object
A class representing a dcat:CatalogRecord.
Ref: https://www.w3.org/TR/vocab-dcat-2/#Class:Catalog_Record
-
title
¶ A name given to the record. key is language code.
- Type
dict
-
description
¶ A free-text account of the record. key is language code.
- Type
dict
-
property
conforms_to
¶ Get/set for conforms_to.
- Return type
List
[str
]
-
property
description
¶ Description attribute.
- Return type
dict
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
property
listing_date
¶ Get/set for listing_date.
- Return type
str
-
property
modification_date
¶ Get/set for modification_date.
- Return type
str
-
property
title
¶ Title attribute.
- Return type
dict
-
to_rdf
(format='turtle', encoding='utf-8')¶ Maps the catalogrecord to rdf.
- Return type
Union
[bytes
,str
]
-
datacatalogtordf.dataservice¶
DataService module for mapping a dataService to rdf.
This module contains methods for mapping a dataservice object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import DataService
>>>
>>> dataservice = DataService()
>>> dataservice.identifier = "http://example.com/dataservices/1"
>>> dataservice.title = {"en": "Title of dataservice"}
>>>
>>> bool(dataservice.to_rdf())
True
-
class
datacatalogtordf.dataservice.
DataService
(identifier=None)¶ Bases:
datacatalogtordf.resource.Resource
A class representing a dcat:DataService.
Ref: dcat:DataService.
-
endpointDescription
¶ A description of the services available via the end-points, including their operations, parameters etc.
- Type
-
media_types
¶ A list of media types that is offered in the responses
- Type
List[src]
-
property
access_rights
¶ Get/set for access_rights.
- Return type
str
-
property
conformsTo
¶ Get/set for conformsTo.
- Return type
List
[str
]
-
property
contactpoint
¶ Get/set for contactpoint.
- Return type
Contact
-
property
creator
¶ Get/set for creator.
- Return type
str
-
property
description
¶ Description attribute.
- Return type
dict
-
property
endpointDescription
¶ Get/set for endpointDescription.
- Return type
str
-
property
endpointURL
¶ Get/set for endpointURL.
- Return type
str
-
property
has_policy
¶ Get/set for has_policy.
- Return type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
property
keyword
¶ Title attribute.
- Return type
dict
-
property
landing_page
¶ Get/set for landing_page.
- Return type
List
[str
]
-
property
language
¶ Get/set for language.
- Return type
List
[str
]
-
property
license
¶ Get/set for license.
- Return type
str
-
property
media_types
¶ Get/set for media_type.
- Return type
List
[str
]
-
property
modification_date
¶ Get/set for modification_date.
- Return type
str
-
property
publisher
¶ Get/set for publisher.
- Return type
Any
-
property
qualified_attributions
¶ Get/set for qualified_attributions.
- Return type
List
[dict
]
-
property
qualified_relation
¶ Get/set for qualified_relation.
- Return type
List[Relationship]
-
property
release_date
¶ Get/set for release_date.
- Return type
str
-
property
resource_relation
¶ Get/set for resource_relation.
- Return type
List
[str
]
-
property
rights
¶ Get/set for rights.
- Return type
str
-
property
theme
¶ Get/set for theme.
- Return type
List
[str
]
-
property
title
¶ Title attribute.
- Return type
dict
-
to_rdf
(format='turtle', encoding='utf-8')¶ Maps the distribution to rdf.
- Available formats:
turtle (default)
xml
json-ld
- Parameters
format (
str
) – a valid format.encoding (
Optional
[str
]) – the encoding to serialize into
- Return type
Union
[bytes
,str
]- Returns
a rdf serialization as a bytes literal according to format.
Example
>>> from datacatalogtordf import Catalog >>> >>> catalog = Catalog() >>> catalog.identifier = "http://example.com/catalogs/1" >>> catalog.title = {'en': 'Title of catalog'} >>> bool(catalog.to_rdf()) True
-
property
type_genre
¶ Get/set for type_genre.
- Return type
str
-
datacatalogtordf.dataset¶
Dataset module for mapping a dataset to rdf.
This module contains methods for mapping a dataset object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import Dataset, Distribution
>>>
>>> dataset = Dataset()
>>> dataset.identifier = "http://example.com/datasets/1"
>>> dataset.title = {"en": "Title of dataset"}
>>>
>>> a_distribution = Distribution()
>>> a_distribution.identifier = "http://example.com/dataservices/1"
>>> a_distribution.title = {"en": "Title of distribution"}
>>> dataset.distributions.append(a_distribution)
>>>
>>> bool(dataset.to_rdf())
True
-
class
datacatalogtordf.dataset.
Dataset
(identifier=None)¶ Bases:
datacatalogtordf.resource.Resource
A class representing a dcat:Dataset.
Ref: dcat:Dataset.
-
distributions
¶ A list of distributions of the dataset
- Type
List[Distribution]
-
spatial_resolution_in_meters
¶ A list of minimum spatial separation resolvables in a dataset, measured in meters.
- Type
List[Decimal]
-
temporal
¶ A list of temporal periods that the dataset covers.
- Type
List[PeriodOfTime]
-
temporal_resolution
¶ A list of minimum time period resolvables in the dataset.
- Type
List[str]
-
was_generated_by
¶ A link to an activity that generated, or provides the business context for, the creation of the dataset.
- Type
-
access_rights_comments
¶ Referanse til hjemmel (kilde for påstand) i offentlighetsloven, sikkerhetsloven, beskyttelsesinstruksen eller annet lovverk som ligger til grunn for vurdering av tilgangsnivå.
- Type
List[URI]
-
in_series
¶ A dataset series of which the dataset is part.
- Type
-
property
access_rights
¶ Get/set for access_rights.
- Return type
str
-
property
access_rights_comments
¶ Get/set for access_rights_comments.
- Return type
List
[str
]
-
property
conformsTo
¶ Get/set for conformsTo.
- Return type
List
[str
]
-
property
contactpoint
¶ Get/set for contactpoint.
- Return type
Contact
-
property
creator
¶ Get/set for creator.
- Return type
str
-
property
dct_identifier
¶ Get for dct_identifier.
- Return type
str
-
property
description
¶ Description attribute.
- Return type
dict
-
property
distributions
¶ Get/set for distributions.
- Return type
List
[Distribution
]
-
property
frequency
¶ Get/set for frequency.
- Return type
str
-
property
has_policy
¶ Get/set for has_policy.
- Return type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
property
in_series
¶ Get/set for in_series.
- Return type
-
property
keyword
¶ Title attribute.
- Return type
dict
-
property
landing_page
¶ Get/set for landing_page.
- Return type
List
[str
]
-
property
language
¶ Get/set for language.
- Return type
List
[str
]
-
property
license
¶ Get/set for license.
- Return type
str
-
property
modification_date
¶ Get/set for modification_date.
- Return type
str
-
property
publisher
¶ Get/set for publisher.
- Return type
Any
-
property
qualified_attributions
¶ Get/set for qualified_attributions.
- Return type
List
[dict
]
-
property
qualified_relation
¶ Get/set for qualified_relation.
- Return type
List[Relationship]
-
property
release_date
¶ Get/set for release_date.
- Return type
str
-
property
resource_relation
¶ Get/set for resource_relation.
- Return type
List
[str
]
-
property
rights
¶ Get/set for rights.
- Return type
str
-
property
spatial_resolution_in_meters
¶ Get/set for spatial_resolution_in_meters.
- Return type
List
[Decimal
]
-
property
temporal
¶ Get/set for temporal.
- Return type
List
[PeriodOfTime
]
-
property
temporal_resolution
¶ Get/set for temporal_resolution.
- Return type
List
[str
]
-
property
theme
¶ Get/set for theme.
- Return type
List
[str
]
-
property
title
¶ Title attribute.
- Return type
dict
-
to_rdf
(format='turtle', encoding='utf-8', include_distributions=True)¶ Maps the catalog to rdf.
- Available formats:
turtle (default)
xml
json-ld
- Parameters
format (str) – a valid format.
encoding (str) – the encoding to serialize into
include_distributions (bool) – includes the distributions in the graph
- Return type
Union
[bytes
,str
]- Returns
a rdf serialization as a bytes literal according to format.
-
property
type_genre
¶ Get/set for type_genre.
- Return type
str
-
property
was_generated_by
¶ Get/set for was_generated_by.
- Return type
str
-
datacatalogtordf.dataset_series¶
DatasetSeries module for mapping a dataset_series to rdf.
This module contains methods for mapping a dataset_series object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import Catalog, DatasetSeries, Dataset
>>>
>>> dataset_series = DatasetSeries("http://example.com/dataset_series/1")
>>> dataset_series.title = {"en": "Title of dataset_series"}
>>>
>>> catalog = Catalog("http://example.com/catalog/1")
>>> catalog.datasets.append(dataset_series)
>>>
>>> first_dataset = Dataset()
>>> first_dataset.identifier = "http://example.com/datasets/1"
>>> first_dataset.in_series = dataset_series
>>>
>>> second_dataset = Dataset()
>>> second_dataset.identifier = "http://example.com/datasets/2"
>>> second_dataset.in_series = dataset_series
>>> second_dataset.prev = first_dataset
>>>
>>> dataset_series.first = first_dataset
>>> dataset_series.last = second_dataset
>>>
>>> bool(catalog.to_rdf())
True
-
class
datacatalogtordf.dataset_series.
DatasetSeries
(identifier=None)¶ Bases:
datacatalogtordf.dataset.Dataset
A class representing a dcat:DatasetSeries.
Ref: dcat:DatasetSeries.
-
first
¶ The first resource in an ordered collection or series of resources, to which the current resource belongs.
- Type
-
last
¶ The last resource in an ordered collection or series of resources, to which the current resource belongs.
- Type
-
property
access_rights
¶ Get/set for access_rights.
- Return type
str
-
property
access_rights_comments
¶ Get/set for access_rights_comments.
- Return type
List
[str
]
-
property
conformsTo
¶ Get/set for conformsTo.
- Return type
List
[str
]
-
property
contactpoint
¶ Get/set for contactpoint.
- Return type
Contact
-
property
creator
¶ Get/set for creator.
- Return type
str
-
property
dct_identifier
¶ Get for dct_identifier.
- Return type
str
-
property
description
¶ Description attribute.
- Return type
dict
-
property
distributions
¶ Get/set for distributions.
- Return type
List
[Distribution
]
-
property
frequency
¶ Get/set for frequency.
- Return type
str
-
property
has_policy
¶ Get/set for has_policy.
- Return type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
property
in_series
¶ Get/set for in_series.
- Return type
-
property
keyword
¶ Title attribute.
- Return type
dict
-
property
landing_page
¶ Get/set for landing_page.
- Return type
List
[str
]
-
property
language
¶ Get/set for language.
- Return type
List
[str
]
-
property
license
¶ Get/set for license.
- Return type
str
-
property
modification_date
¶ Get/set for modification_date.
- Return type
str
-
property
publisher
¶ Get/set for publisher.
- Return type
Any
-
property
qualified_attributions
¶ Get/set for qualified_attributions.
- Return type
List
[dict
]
-
property
qualified_relation
¶ Get/set for qualified_relation.
- Return type
List[Relationship]
-
property
release_date
¶ Get/set for release_date.
- Return type
str
-
property
resource_relation
¶ Get/set for resource_relation.
- Return type
List
[str
]
-
property
rights
¶ Get/set for rights.
- Return type
str
-
property
spatial_resolution_in_meters
¶ Get/set for spatial_resolution_in_meters.
- Return type
List
[Decimal
]
-
property
temporal
¶ Get/set for temporal.
- Return type
List
[PeriodOfTime
]
-
property
temporal_resolution
¶ Get/set for temporal_resolution.
- Return type
List
[str
]
-
property
theme
¶ Get/set for theme.
- Return type
List
[str
]
-
property
title
¶ Title attribute.
- Return type
dict
-
to_rdf
(format='turtle', encoding='utf-8', include_datasets=True, include_services=True, include_models=True, include_contains_services=True)¶ Maps the catalog to rdf.
- Available formats:
turtle (default)
xml
json-ld
- Parameters
format (str) – a valid format.
encoding (str) – the encoding to serialize into
include_datasets (bool) – includes the dataset graphs in the catalog
include_services (bool) – includes the services in the catalog
include_models (bool) – includes the models in the catalog
include_contains_services (bool) – includes the services (cpsvno) in the catalog
- Return type
Union
[bytes
,str
]- Returns
a rdf serialization as a bytes literal according to format.
-
property
type_genre
¶ Get/set for type_genre.
- Return type
str
-
property
was_generated_by
¶ Get/set for was_generated_by.
- Return type
str
-
datacatalogtordf.distribution¶
Distribution module for mapping a distribution to rdf.
This module contains methods for mapping a distribution object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import Distribution
>>>
>>> distribution = Distribution()
>>> distribution.identifier = "http://example.com/dataservices/1"
>>> distribution.title = {"en": "Title of distribution"}
>>>
>>> bool(distribution.to_rdf())
True
-
class
datacatalogtordf.distribution.
Distribution
(identifier=None)¶ Bases:
object
A class representing a dcat:Distribution.
Ref: dcat:Distribution
-
title
¶ A dict with title in multiple languages
- Type
dict
-
description
¶ A free-text account of the distribution.
- Type
dict
-
modification_date
¶ Most recent date on which the distribution was changed, updated or modified.
- Type
-
has_policy
¶ A link to an ODRL conformant policy expressing the rights associated with the distribution.
- Type
-
access_URL
¶ A URL of the resource that gives access to a distribution of the dataset. E.g. landing page, feed, SPARQL endpoint.
- Type
-
access_service
¶ A data service that gives access to the distribution of the dataset
- Type
-
download_URL
¶ The URL of the downloadable file in a given format. E.g. CSV file or RDF file. The format is indicated by the distribution’s dct:format and/or dcat:mediaType
- Type
-
byte_size
¶ The size of a distribution in bytes.
- Type
Decimal
-
spatial_resolution_in_meters
¶ A list of minimum spatial separation resolvables in a dataset distribution, measured in meters.
- Type
List[Decimal]
-
temporal_resolution
¶ A list of minimum time period resolvables in the dataset distribution.
- Type
List[str]
-
conforms_to
¶ A list of links to established standards to which the distribution conforms.
- Type
List[URI]
-
compression_format
¶ The compression format of the distribution in which the data is contained in a compressed form, e.g. to reduce the size of the downloadable file.
- Type
-
package_format
¶ The package format of the distribution in which one or more data files are grouped together, e.g. to enable a set of related files to be downloaded together.
- Type
-
property
access_URL
¶ Get/set for access_URL.
- Return type
str
-
property
access_rights
¶ Get/set for access_rights.
- Return type
str
-
property
access_service
¶ Get/set for access_service.
- Return type
-
property
byte_size
¶ Get/set for byte_size.
- Return type
Decimal
-
property
compression_format
¶ Get/set for compression_format.
- Return type
str
-
property
conforms_to
¶ Get/set for conforms_to.
- Return type
List
[str
]
-
property
description
¶ Description attribute.
- Return type
dict
-
property
download_URL
¶ Get/set for download_URL.
- Return type
str
-
property
formats
¶ Get/set for formats.
- Return type
List
[str
]
-
property
has_policy
¶ Get/set for has_policy.
- Return type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
property
license
¶ Get/set for license.
- Return type
str
-
property
media_types
¶ Get/set for media_types.
- Return type
List
[str
]
-
property
modification_date
¶ Get/set for modification_date.
- Return type
str
-
property
package_format
¶ Get/set for package_format.
- Return type
str
-
property
release_date
¶ Get/set for release_date.
- Return type
str
-
property
rights
¶ Get/set for rights.
- Return type
str
-
property
spatial_resolution_in_meters
¶ Get/set for spatial_resolution_in_meters.
- Return type
List
[Decimal
]
-
property
temporal_resolution
¶ Get/set for temporal_resolution.
- Return type
List
[str
]
-
property
title
¶ Get/set for title.
- Return type
dict
-
to_rdf
(format='turtle', encoding='utf-8')¶ Maps the distribution to rdf.
- Return type
Union
[bytes
,str
]
-
datacatalogtordf.uri¶
URI helper module for very basic validation of a uri.
-
class
datacatalogtordf.uri.
URI
(link)¶ Bases:
str
A helper class to validate a URI.
If the string is serializable as an rdflib.URIRef, it is valid. Otherwise not.
Essentially it is serializable if none of the following chars occurs:
_invalid_uri_chars = '<>" {}|\\^`'
Ref: https://github.com/RDFLib/rdflib/blob/master/rdflib/term.py#L75
Example
>>> from datacatalogtordf import Dataset, URI >>> >>> dataset = Dataset() >>> dataset.identifier = URI("http://example.com/datasets/1") >>> dataset.identifier 'http://example.com/datasets/1'
datacatalogtordf.periodoftime¶
PeriodOfTime module for mapping a period_of_time to rdf.
This module contains methods for mapping a period_of_time object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import PeriodOfTime
>>>
>>> period_of_time = PeriodOfTime()
>>> period_of_time.start_date = "2019-12-31"
>>> period_of_time.end_date = "2020-12-31"
>>>
>>> bool(period_of_time.to_rdf())
True
-
class
datacatalogtordf.periodoftime.
Date
(link)¶ Bases:
str
A helper class to validate a Date.
If the string is a valid of the format “%Y-%m-%d”, it is valid. Otherwise not.
- Raises
InvalidDateError – If the str does not represent a valid date
-
class
datacatalogtordf.periodoftime.
PeriodOfTime
¶ Bases:
object
A class representing a dcat:PeriodOfTime.
Ref: dcat:PeriodOfTime
-
start_date
¶ date signfying the start of the period
-
end_date
¶ date signfying the end of the period
- Raises
InvalidDateIntervalError – If the interval is “negative”, i.e. start date is after the end date
-
property
end_date
¶ Get/set for end_date.
- Return type
str
-
property
start_date
¶ Get/set for start_date.
- Return type
str
-
to_rdf
(format='turtle', encoding='utf-8')¶ Maps the period_of_time to rdf.
- Return type
Union
[bytes
,str
]
-
datacatalogtordf.location¶
Location module for mapping a location to rdf.
This module contains methods for mapping a location object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import Location
>>>
>>> location = Location()
>>> location.identifier = "http://example.com/relations/1"
>>> location.centroid = "POINT(4.88412 52.37509)"
>>>
>>> bool(location.to_rdf())
True
-
class
datacatalogtordf.location.
Location
(identifier=None)¶ Bases:
object
A class representing a dcat:Location.
Ref: dcat:Location
-
geometry
¶ Associates any resource with the corresponding geometry.
- Type
str
-
bounding_box
¶ The geographic bounding box of a resource.
- Type
str
-
centroid
¶ The geographic center (centroid) of a resource.
- Type
str
-
property
bounding_box
¶ Get/set for bounding_box.
- Return type
str
-
property
centroid
¶ Get/set for centroid.
- Return type
str
-
property
geometry
¶ Get/set for geometry.
- Return type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
to_rdf
(format='turtle', encoding='utf-8')¶ Maps the location to rdf.
- Parameters
format (
str
) – a valid format. Default: turtleencoding (
Optional
[str
]) – the encoding to serialize into
- Return type
Union
[bytes
,str
]- Returns
a rdf serialization as a bytes literal according to format.
-
datacatalogtordf.agent¶
Agent module for mapping a agent to rdf.
This module contains methods for mapping a agent object to rdf according to the dcat-ap-no v.2 standard
Example
>>> from datacatalogtordf import Agent, Dataset
>>> dataset = Dataset()
>>> dataset.identifier = "http://example.com/datasets/1"
>>> # Create an agent:
>>> agent = Agent()
>>> agent.identifier = "http://example.com/agents/1"
>>> agent.name = {"en": "James Bond", "nb": "Djeims Bånd"}
>>> # Assigen the agent to the publisher property:
>>> dataset.publisher = agent
>>> bool(dataset.to_rdf())
True
-
class
datacatalogtordf.agent.
Agent
(identifier=None)¶ Bases:
object
A class representing a foaf:Agent.
-
name
¶ A name given to the agent. key is langauge code
- Type
dict
-
organization_id
¶ The organzation’s identifier
- Type
str
-
property
identifier
¶ Get/set for identifier.
- Return type
str
-
property
name
¶ Name attribute.
- Return type
dict
-
property
organization_id
¶ Organization attribute.
- Return type
str
-
property
organization_type
¶ Type attribute.
- Return type
str
-
property
same_as
¶ Get for same_as.
- Return type
str
-
to_rdf
(format='turtle', encoding='utf-8')¶ Maps the agent to rdf.
- Parameters
format (
str
) – a valid format. Default: turtleencoding (
Optional
[str
]) – the encoding to serialize into
- Return type
Union
[bytes
,str
]- Returns
a rdf serialization as a bytes literal according to format.
-
datacatalogtordf.exceptions¶
Exeptions module for datacatalogtordf.
-
exception
datacatalogtordf.exceptions.
Error
(msg=None)¶ Bases:
Exception
Base class for exceptions.
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
datacatalogtordf.exceptions.
InvalidDateError
(date, msg)¶ Bases:
datacatalogtordf.exceptions.Error
Exception raised for errors in the input.
-
str -- input str in which the error occurred
-
message -- explanation of the error
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
exception
datacatalogtordf.exceptions.
InvalidDateIntervalError
(start_date, end_date, msg)¶ Bases:
datacatalogtordf.exceptions.Error
Exception raised for errors in the input.
-
str -- input str in which the error occurred
-
message -- explanation of the error
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-