oc_ocdm.abstract_entity module
- class oc_ocdm.abstract_entity.AbstractEntity[source]
Bases:
abc.ABC
Abstract class which represents a generic entity from the OCDM. It sits at the top of the entity class hierarchy.
Constructor of the
AbstractEntity
class.- Return type
None
- short_name_to_type_iri: ClassVar[Dict[str, URIRef]] = {}
- remove_every_triple()[source]
Remover method that removes every triple from the current entity.
WARNING: the OCDM specification requires that every entity has at least one triple that defines its type (through the
rdf:type
RDF predicate). If such triple is not subsequently restored by the user, the entity will be considered as to be deleted since it wouldn’t be valid anymore.- Returns
None
- Return type
None
- get_label()[source]
Getter method corresponding to the
rdfs:label
RDF predicate.- Returns
The requested value if found, None otherwise
- Return type
Optional[str]
- create_label(string)[source]
Setter method corresponding to the
rdfs:label
RDF predicate.WARNING: this is a functional property, hence any existing value will be overwritten!
- Parameters
string (str) – The value that will be set as the object of the property related to this method
- Returns
None
- Return type
None
- remove_label()[source]
Remover method corresponding to the
rdfs:label
RDF predicate.- Returns
None
- Return type
None
- get_types()[source]
Getter method corresponding to the
rdf:type
RDF predicate.- Returns
A list containing the requested values if found, None otherwise
- Return type
List[URIRef]
- remove_type()[source]
Remover method corresponding to the
rdf:type
RDF predicate.WARNING: the OCDM specification requires at least one type for an entity. This method removes any existing secondary type, without removing the main type.
- Returns
None
- Return type
None
- add_triples(iterable_of_triples)[source]
A utility method that allows to add a batch of triples into the graph of the entity.
WARNING: Only triples that have this entity as their subject will be imported!
- Parameters
iterable_of_triples (Iterable[Tuple[term]]) – A collection of triples to be added to the entity
- Returns
None
- Return type
None