Reference¶
concepttordf.collection¶
Concept module for mapping a concept to rdf.
This module contains methods for mapping a concept object to rdf according to the skos-ap-no standard
Example
>>> from concepttordf import Collection, Concept, Definition
>>>
>>> # Create collection object
>>> collection = Collection()
>>> collection.identifier = "http://example.com/collections/1"
>>> collection.name = {"en": "A concept collection"}
>>> collection.name = {"nb": "En begrepssamling"}
>>> collection.publisher = "https://example.com/publishers/1"
>>>
>>> # Create a concept:
>>> c = Concept()
>>> c.identifier = "http://example.com/concepts/1"
>>> c.term = {"name": {"nb": "inntekt", "en": "income"}}
>>> definition = Definition()
>>> definition.text = {"nb": "ting man skulle hatt mer av",
>>> "en": "something you want more of"}
>>> c.definition = definition
>>>
>>> # Add concept to collection:
>>> collection.members.append(c)
>>>
>>> # get rdf representation in turtle (default)
>>> bool(collection.to_rdf())
True
- class concepttordf.collection.Collection¶
Bases:
objectA class representing a concept collection.
- property dct_identifier: str¶
Get for dct_identifier.
- Return type
str
- property description: dict¶
Description attribute.
- Return type
dict
- property identifier: str¶
Identifier attribute.
- Return type
str- Returns
a string holding a valid uri
- property name: dict¶
Name attribute.
- Return type
dict
- property publisher: str¶
Publisher attribute.
- Return type
str
- to_rdf(format='text/turtle', includeconcepts=True)¶
Maps the collection to rdf.
- Parameters
format (
str) – the format of the serializationincludeconcepts (
bool) – if true details of concepts are included
- Return type
str- Returns
serialization as a string according to format
concepttordf.concept¶
Concept module for mapping a concept to rdf.
This module contains methods for mapping a concept object to rdf according to the skos-ap-no standard
Example
>>> from concepttordf import Concept, Definition
>>>
>>> concept = Concept()
>>> concept.identifier = "http://example.com/concepts/1"
>>> concept.term = {"name": {"en": "concept"}}
>>>
>>> definition = Definition()
>>> definition.text = {"text": {"en": "abstract or generic idea"}}
>>> concept.definition = definition
>>>
>>> bool(concept.to_rdf())
True
- class concepttordf.concept.Concept¶
Bases:
objectA class representing a concept.
- identifier¶
the uri identifying the concept
- term¶
a dictionary describing the prefLabel
- alternativeterm¶
a dictionary describing altLabel
a dictionary describing the hiddenLabel
- property alternativeterm: dict¶
Alternativeterm attribute.
- Return type
dict
- property alternativformulering: AlternativFormulering¶
Alternativformulering attribute.
- Return type
- property bruksomrade: dict¶
Bruksomrade attribute.
- Return type
dict
- property datastrukturterm: dict¶
Datastrukturterm attribute.
- Return type
dict
- property dct_identifier: str¶
Get for dct_identifier.
- Return type
str
- property definition: Definition¶
Definition attribute.
- Return type
- property generalizes: GenericRelation¶
Generalizes attribute.
- Return type
- property has_part: PartitiveRelation¶
Has part attribute.
- Return type
- property hiddenterm: dict¶
Hiddenterm attribute.
- Return type
dict
- property identifier: str¶
Identifier attribute.
- Return type
str- Returns
a string holding a valid uri
- property is_part_of: PartitiveRelation¶
Is part of attribute.
- Return type
- property modified: date¶
Modified attribute.
- Return type
date
- property publisher: str¶
Publisher attribute.
- Return type
str
Related attribute.
- Return type
- property specializes: GenericRelation¶
Specializes attribute.
- Return type
- property subject: dict¶
Subject attribute.
- Return type
dict
- property term: dict¶
Term attribute.
- Return type
dict
- to_rdf(format='text/turtle')¶
Maps the concept to rdf.
- Parameters
format (
str) – a valid serialization format.- Return type
str- Returns
a serialization of the RDF graph
- property validinperiod: dict¶
Validinperiod attribute.
- Return type
dict
concepttordf.contact¶
Contact module for mapping a dataService to rdf.
This module contains methods for mapping a contact object to rdf according to the vcard ontology
Example
>>> from concepttordf import Contact
>>>
>>> contact = Contact()
>>> contact.identifier = "http://example.com/contacts/1"
>>> contact.name = {'nb': 'Digitaliseringsdirektoratet'}
>>> bool(contact.to_rdf())
True
- class concepttordf.contact.Contact¶
Bases:
objectA class representing a vcard:Contact.
- identifier¶
unique uri for contact
- name¶
name of contact in various languages
- email¶
email as a mailto link
- telephone¶
telephone number
- url¶
url to website
- property email: str¶
Get/set for email.
- Return type
str
- property identifier: str¶
Identifier attribute.
- Return type
str- Returns
a string holding a valid uri
- property name: dict¶
Get/set for name.
- Return type
dict
- property telephone: str¶
Get/set for telephone.
- Return type
str
- to_rdf(format='text/turtle')¶
Maps the contact to rdf.
- Available formats:
turtle (default)
xml
json-ld
- Parameters
format (
str) – a valid format.- Return type
str- Returns
a rdf serialization as a string according to format.
- property url: str¶
Get/set for url.
- Return type
str
concepttordf.betydningsbeskrivelse¶
Concept module for mapping abstract class Betydningsbeskrivelse to rdf.
- class concepttordf.betydningsbeskrivelse.Betydningsbeskrivelse¶
Bases:
ABCA class representing a concept.
- text¶
- remark¶
- scope¶
- relationtosource¶
- source¶
- modified¶
- example¶
- property example: dict¶
Example attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value example (str)
- property modified: date¶
Source attribute.
- Return type
date- Returns
the date on which the item was last updated
- property relationtosource: str¶
Relationtosource attribute.
- Return type
str- Returns
a relationtype to source (str)
- property remark: dict¶
Remark attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value remark (str)
- property scope: dict¶
Scope attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value scope (str)
- property source: dict¶
Source attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value remark (str)
- property text: dict¶
Text attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value text (str)
- class concepttordf.betydningsbeskrivelse.RelationToSource(value)¶
Bases:
EnumAn enum representing relations to source.
concepttordf.alternativformulering¶
Module for helper class Definition.
- class concepttordf.alternativformulering.AlternativFormulering¶
Bases:
BetydningsbeskrivelseA class representing a AlternativFormulering.
- property example: dict¶
Example attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value example (str)
- property modified: date¶
Source attribute.
- Return type
date- Returns
the date on which the item was last updated
- property relationtosource: str¶
Relationtosource attribute.
- Return type
str- Returns
a relationtype to source (str)
- property remark: dict¶
Remark attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value remark (str)
- property scope: dict¶
Scope attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value scope (str)
- property source: dict¶
Source attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value remark (str)
- property text: dict¶
Text attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value text (str)
concepttordf.definition¶
Module for helper class Definition.
- class concepttordf.definition.Definition¶
Bases:
BetydningsbeskrivelseA class representing a definition.
- property example: dict¶
Example attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value example (str)
- property modified: date¶
Source attribute.
- Return type
date- Returns
the date on which the item was last updated
- property relationtosource: str¶
Relationtosource attribute.
- Return type
str- Returns
a relationtype to source (str)
- property remark: dict¶
Remark attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value remark (str)
- property scope: dict¶
Scope attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value scope (str)
- property source: dict¶
Source attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value remark (str)
- property text: dict¶
Text attribute.
- Return type
dict- Returns
a dict with key as language code (str) and value text (str)
concepttordf.conceptrelation¶
Concept module for mapping abstract class ConceptRelation to rdf.
concepttordf.associativerelation¶
Concept module for mapping class associative relation to rdf.
- class concepttordf.associativerelation.AssociativeRelation¶
Bases:
ConceptRelationA class representing a associative concept relation.
- description¶
dictionary where key is language and value describing relation
- associatedconcepts¶
list of related concepts
- property associatedconcepts: List[Concept]¶
Associatedconcepts attributes.
- Return type
List[Concept]- Returns
a list of related concepts
- property description: dict¶
Description attribute.
- Return type
dict
- property modified: date¶
Modified attribute.
- Return type
date
concepttordf.genericrelation¶
Concept module for mapping class GenericRelation to rdf.
- class concepttordf.genericrelation.GenericRelation¶
Bases:
ConceptRelationA class representing a generic concept relation.
- criterium¶
dictionary where key is language an value describing relation
- genericconcepts¶
list of related concepts
- property criterium: dict¶
Criterium attribute.
- Return type
dict
- property genericconcepts: List[Concept]¶
Generic concepts attributes.
- Return type
List[Concept]- Returns
a list of generic concepts
- property modified: date¶
Modified attribute.
- Return type
date
concepttordf.partitiverelation¶
Concept module for mapping class partitive relation to rdf.
- class concepttordf.partitiverelation.PartitiveRelation¶
Bases:
ConceptRelationA class representing a partitive concept relation.
- criterium¶
dictionary where key is language an value describing relation
- partconcepts¶
list of related concepts
- property criterium: dict¶
Criterium attribute.
- Return type
dict
- property is_part_of_concepts: List[Concept]¶
Is_part_of_concepts attributes.
- Return type
List[Concept]- Returns
a list of concepts that this concept is part of
- property modified: date¶
Modified attribute.
- Return type
date