pepper.brain.utils.rdf_builder module¶
-
class
pepper.brain.utils.rdf_builder.
RdfBuilder
[source]¶ Bases:
object
-
ONTOLOGY_ROOT
= 'C:\\Users\\Pepper\\Documents\\Pepper\\pepper\\ontologies'¶
-
create_resource_uri
(namespace, resource_name)[source]¶ Create an URI for the given resource (entity, predicate, named graph, etc) in the given namespace :param namespace: Namespace where entity belongs to :type namespace: str :param resource_name: Label of resource :type resource_name: str
Returns: uri – Representing the URI of the resource Return type: str
-
empty_entity
()[source]¶ Create an empty RDF entity
Returns: Return type: Entity object with no label and no type information
-
fill_entity
(label, types, namespace='LW')[source]¶ Create an RDF entity given its label, types and its namespace :param label: Label of entity :type label: str :param types: List of types for this entity :type types: List[str] :param namespace: Namespace where entity belongs to :type namespace: str
Returns: Return type: Entity object with given label
-
fill_entity_from_label
(label, namespace='LW')[source]¶ Create an RDF entity given its label and its namespace :param label: Label of entity :type label: str :param namespace: Namespace where entity belongs to :type namespace: str
Returns: Return type: Entity object with given label and no type information
-
fill_literal
(value, datatype=None)[source]¶ Create an RDF literal given its value and datatype :param value: Value of the literal resource :type value: str :param datatype: Datatype of the literal :type datatype: str
Returns: Return type: Literal with value and datatype given
-
fill_predicate
(label, namespace='N2MU')[source]¶ Create an RDF predicate given its label and its namespace :param label: Label of predicate :type label: str :param namespace: Namespace where predicate belongs to
Returns: Return type: Predicate object with given label
-
fill_provenance
(author, date)[source]¶ Structure provenance to pair authors and dates when mentions are created :param author: Actor that generated the knowledge :type author: str :param date: Date when knowledge was generated :type date: date
Returns: Return type: Provenance object containing author and date
-
fill_triple
(subject_dict, predicate_dict, object_dict, namespace='LW')[source]¶ Create an RDF entity given its label and its namespace :param subject_dict: Information about label and type of subject :type subject_dict: dict :param predicate_dict: Information about type of predicate :type predicate_dict: dict :param object_dict: Information about label and type of object :type object_dict: dict :param namespace: Information about which namespace the entities belongs to :type namespace: str
Returns: Return type: Entity object with given label
-
fill_triple_from_label
(subject_label, predicate, object_label, namespace='LW')[source]¶ Create an RDF entity given its label and its namespace :param subject_label: Information about label of subject :type subject_label: str :param predicate: Information about predicate :type predicate: str :param object_label: Information about label of object :type object_label: str :param namespace: Information about which namespace the entities belongs to :type namespace: str
Returns: Return type: Entity object with given label
-