def add_literal(self, g, time_component, time_property, value, literal_type): """ Creates and adds a Literal to the model if a value exists :param LDCTimeComponent self: contains the time component information when LDCTimeComponent is instantiated :param rdflib.graph.Graph g: The underlying RDF model for the operation :param rdflib.term.BNode time_component: The resource created to contain time information :param time_property: AIDA_ANNOTATION.year, AIDA_ANNOTATION.month, or AIDA_ANNOTATION.day :param str value: the string value of month, day, or year :param literal_type: the datatype that corresponds to the given value """ if value is not None: temp_literal = Literal(value) temp_literal._datatype = URIRef(literal_type) g.add((time_component, time_property, temp_literal))
def add_literal(self, g, claim_component, property, value, literal_type): """ Creates and adds a Literal to the model if a value exists :param ClaimComponent self :param rdflib.graph.Graph g: The underlying RDF model for the operation :param rdflib.term.BNode claim_component: The resource created to contain claim component information :param time_property: AIDA_ANNOTATION.year, AIDA_ANNOTATION.month, or AIDA_ANNOTATION.day :param str value: the string value :param literal_type: the datatype that corresponds to the given value """ if value is not None: claim_literal = Literal(value) claim_literal._datatype = URIRef(literal_type) g.add((claim_component, property, claim_literal))