oc_ocdm.graph.entities.bibliographic.discourse_element module

class oc_ocdm.graph.entities.bibliographic.discourse_element.DiscourseElement(g, g_set, res=None, res_type=None, resp_agent=None, source=None, count=None, label=None, short_name='', preexisting_graph=None)[source]

Bases: oc_ocdm.graph.entities.bibliographic_entity.BibliographicEntity

Discourse element (short: de): a document component, either structural (e.g. paragraph, section, chapter, table, caption, footnote, title) or rhetorical (e.g. introduction, discussion, acknowledgements, reference list, figure, appendix), in which the content of a bibliographic resource can be organized.

Constructor of the AbstractEntity class.

Parameters
  • g (Graph) –

  • g_set (GraphSet) –

  • res (URIRef) –

  • res_type (URIRef) –

  • resp_agent (str) –

  • source (str) –

  • count (str) –

  • label (str) –

  • short_name (str) –

  • preexisting_graph (Graph) –

Return type

None

merge(other)[source]

The merge operation allows combining two DiscourseElement entities into a single one, by marking the second entity as to be deleted while also copying its data into the current DiscourseElement. Moreover, every triple from the containing GraphSet referring to the second entity gets “redirected” to the current entity: every other reference contained inside a different source (e.g. a triplestore) must be manually handled by the user!

In case of functional properties, values from the current entity get overwritten by those coming from the second entity while, in all other cases, values from the second entity are simply appended to those of the current entity. In this context, rdfs:label is considered as a functional property, while rdf:type is not.

Parameters

other (DiscourseElement) – The entity which will be marked as to be deleted and whose properties will be merged into the current entity.

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

get_title()[source]

Getter method corresponding to the dcterms:title RDF predicate.

Returns

The requested value if found, None otherwise

Return type

Optional[str]

has_title(string)[source]

Setter method corresponding to the dcterms:title RDF predicate.

WARNING: this is a functional property, hence any existing value will be overwritten!

The title of the discourse element, such as the title of a figure or a section in an article.

Parameters

string (str) – The value that will be set as the object of the property related to this method

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

remove_title()[source]

Remover method corresponding to the dcterms:title RDF predicate.

Returns

None

Return type

None

get_contained_discourse_elements()[source]

Getter method corresponding to the frbr:part RDF predicate.

Returns

A list containing the requested values if found, None otherwise

Return type

List[DiscourseElement]

contains_discourse_element(de_res)[source]

Setter method corresponding to the frbr:part RDF predicate.

The discourse element hierarchically nested within the parent element, such as a sentence within a paragraph, or a paragraph within a section.

Parameters

de_res (DiscourseElement) – The value that will be set as the object of the property related to this method

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

remove_contained_discourse_element(de_res=None)[source]

Remover method corresponding to the frbr:part RDF predicate.

WARNING: this is a non-functional property, hence, if the parameter is None, any existing value will be removed!

Parameters

de_res (DiscourseElement) – If not None, the specific object value that will be removed from the property related to this method (defaults to None)

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

get_next_de()[source]

Getter method corresponding to the oco:hasNext RDF predicate.

Returns

The requested value if found, None otherwise

Return type

Optional[DiscourseElement]

has_next_de(de_res)[source]

Setter method corresponding to the oco:hasNext RDF predicate.

WARNING: this is a functional property, hence any existing value will be overwritten!

The following discourse element that includes at least one in-text reference pointer.

Parameters

de_res (DiscourseElement) – The value that will be set as the object of the property related to this method

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

remove_next_de()[source]

Remover method corresponding to the oco:hasNext RDF predicate.

Returns

None

Return type

None

get_is_context_of_rp()[source]

Getter method corresponding to the c4o:isContextOf RDF predicate.

Returns

A list containing the requested values if found, None otherwise

Return type

List[ReferencePointer]

is_context_of_rp(rp_res)[source]

Setter method corresponding to the c4o:isContextOf RDF predicate.

Provides the textual and semantic context of the in-text reference pointer that appears within the discourse element.

Parameters

rp_res (ReferencePointer) – The value that will be set as the object of the property related to this method

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

remove_is_context_of_rp(rp_res=None)[source]

Remover method corresponding to the c4o:isContextOf RDF predicate.

WARNING: this is a non-functional property, hence, if the parameter is None, any existing value will be removed!

Parameters

rp_res (ReferencePointer) – If not None, the specific object value that will be removed from the property related to this method (defaults to None)

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

get_is_context_of_pl()[source]

Getter method corresponding to the c4o:isContextOf RDF predicate.

Returns

A list containing the requested values if found, None otherwise

Return type

List[PointerList]

is_context_of_pl(pl_res)[source]

Setter method corresponding to the c4o:isContextOf RDF predicate.

Provides the textual and semantic context of the list of in-text reference pointers that appears within the discourse element.

Parameters

pl_res (PointerList) – The value that will be set as the object of the property related to this method

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

remove_is_context_of_pl(pl_res=None)[source]

Remover method corresponding to the c4o:isContextOf RDF predicate.

WARNING: this is a non-functional property, hence, if the parameter is None, any existing value will be removed!

Parameters

pl_res (PointerList) – If not None, the specific object value that will be removed from the property related to this method (defaults to None)

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

get_content()[source]

Getter method corresponding to the c4o:hasContent RDF predicate.

Returns

The requested value if found, None otherwise

Return type

Optional[str]

has_content(string)[source]

Setter method corresponding to the c4o:hasContent RDF predicate.

WARNING: this is a functional property, hence any existing value will be overwritten!

The literal document text contained by the discourse element.

Parameters

string (str) – The value that will be set as the object of the property related to this method

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

remove_content()[source]

Remover method corresponding to the c4o:hasContent RDF predicate.

Returns

None

Return type

None

get_number()[source]

Getter method corresponding to the fabio:hasSequenceIdentifier RDF predicate.

Returns

The requested value if found, None otherwise

Return type

Optional[str]

has_number(string)[source]

Setter method corresponding to the fabio:hasSequenceIdentifier 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

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

remove_number()[source]

Remover method corresponding to the fabio:hasSequenceIdentifier RDF predicate.

Returns

None

Return type

None

create_discourse_element(de_class=None)[source]

Setter method corresponding to the rdf:type RDF predicate. If parameter is None, it implicitly sets the object value deo:DiscourseElement.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Parameters

de_class (URIRef) – The value that will be set as the object of the property related to this method

Raises

TypeError – if the parameter is of the wrong type

Returns

None

Return type

None

create_section()[source]

Setter method corresponding to the rdf:type RDF predicate. It implicitly sets the object value doco:Section.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Returns

None

Return type

None

create_section_title()[source]

Setter method corresponding to the rdf:type RDF predicate. It implicitly sets the object value doco:SectionTitle.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Returns

None

Return type

None

create_paragraph()[source]

Setter method corresponding to the rdf:type RDF predicate. It implicitly sets the object value doco:Paragraph.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Returns

None

Return type

None

create_sentence()[source]

Setter method corresponding to the rdf:type RDF predicate. It implicitly sets the object value doco:Sentence.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Returns

None

Return type

None

create_text_chunk()[source]

Setter method corresponding to the rdf:type RDF predicate. It implicitly sets the object value doco:TextChunk.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Returns

None

Return type

None

create_table()[source]

Setter method corresponding to the rdf:type RDF predicate. It implicitly sets the object value doco:Table.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Returns

None

Return type

None

create_footnote()[source]

Setter method corresponding to the rdf:type RDF predicate. It implicitly sets the object value doco:Footnote.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Returns

None

Return type

None

create_caption()[source]

Setter method corresponding to the rdf:type RDF predicate. It implicitly sets the object value deo:Caption.

WARNING: the OCDM specification admits at most two types for an entity. The main type cannot be edited or removed. Any existing secondary type will be overwritten!

The type of discourse element – such as “paragraph”, “section”, “sentence”, “acknowledgements”, “reference list” or “figure”.

Returns

None

Return type

None