dipper.utils.GraphUtils module¶
-
class
dipper.utils.GraphUtils.
GraphUtils
(curie_map)¶ Bases:
object
-
static
add_property_axioms
(graph, properties)¶
-
static
add_property_to_graph
(results, graph, property_type, property_list)¶
-
static
compare_graph_predicates
(graph1, graph2)¶ From rdf graphs, count predicates in each and return a list of : param graph1 graph, hopefully RDFlib-like : param graph2 graph, ditto : return dict with count of predicates in each graph: : e.g.: : { : “has_a_property”: { : “graph1”: 1234, : “graph2”: 1023}, : “has_another_property”: { : “graph1”: 94, : “graph2”: 51} : }
-
static
count_predicates
(graph)¶ From rdf graphs, count predicates in each and return a list of : param graph : return dict with count of predicates in each graph: : e.g.: : { : “has_a_property”: 1234, : “has_another_property”: 482 : }
-
static
digest_id
(wordage)¶ Form a deterministic digest of input Leading ‘b’ is an experiment forcing the first char to be non numeric but valid hex Not required for RDF but some other contexts do not want the leading char to be a digit
: param str wordage arbitrary string : return str
-
static
get_properties_from_graph
(graph)¶ Wrapper for RDFLib.graph.predicates() that returns a unique set :param graph: RDFLib.graph :return: set, set of properties
-
static
write
(graph, fileformat=None, filename=None)¶ A basic graph writer (to stdout) for any of the sources. this will write raw triples in rdfxml, unless specified. to write turtle, specify format=’turtle’ an optional file can be supplied instead of stdout :return: None
-
static