cemento.rdf package#

Submodules#

cemento.rdf.drawio_to_rdf module#

cemento.rdf.drawio_to_rdf.convert_drawio_to_rdf(input_path: str | Path, output_path: str | Path, file_format: str | RDFFormat = None, onto_ref_folder: str | Path = None, defaults_folder: str | Path = None, prefixes_path: str | Path = None, check_errors: bool = False, collect_domains_ranges: bool = False, log_substitution_path: str | Path = None) None#

cemento.rdf.filters module#

cemento.rdf.filters.term_in_search_results(term: URIRef, inv_prefixes: dict[URIRef | Namespace, str], search_terms: dict[str, URIRef]) URIRef#
cemento.rdf.filters.term_not_in_default_namespace(term: URIRef, inv_prefixes: dict[URIRef | Namespace, str], default_namespace_prefixes: dict[str, Namespace]) bool#

cemento.rdf.graph_to_rdf module#

cemento.rdf.graph_to_rdf.convert_graph_to_rdf_file(graph: DiGraph, output_path: str | Path, file_format: str | RDFFormat = None, collect_domains_ranges: bool = False, onto_ref_folder: str | Path = None, defaults_folder: str | Path = None, prefixes_path: str | Path = None, log_substitution_path: str | Path = None)#
cemento.rdf.graph_to_rdf.convert_graph_to_rdf_graph(graph: DiGraph, collect_domains_ranges: bool = False, onto_ref_folder: str | Path = None, defaults_folder: str | Path = None, prefixes_path: str | Path = None, log_substitution_path: str | Path = None) Graph#

cemento.rdf.io module#

cemento.rdf.io.get_diagram_terms_iter(graph: DiGraph) Iterable[str]#
cemento.rdf.io.get_diagram_terms_iter_with_pred(graph: DiGraph, property_terms: set[str]) Iterable[str, bool]#
cemento.rdf.io.get_properties_in_file(search_keys: dict[str, list[str]], terms: Iterable[str], graph: DiGraph, defaults_folder: str | Path, inv_prefixes: dict[URIRef | Namespace, str]) set[str]#
cemento.rdf.io.save_substitute_log(substitution_results: dict[str, tuple[URIRef, Iterable[str], Iterable[str]]], log_substitution_path: str | Path) None#

cemento.rdf.preprocessing module#

cemento.rdf.preprocessing.clean_literal_string(literal_term: str) str#
cemento.rdf.preprocessing.format_literal(literal: Literal, prefix: str) str#
cemento.rdf.preprocessing.get_term_aliases(term: str) list[str]#
cemento.rdf.preprocessing.remove_suppression_key(term: str) str#

cemento.rdf.rdf_to_drawio module#

cemento.rdf.rdf_to_drawio.convert_rdf_to_drawio(input_path: str | Path, output_path: str | Path, file_format: str | RDFFormat = None, horizontal_tree: bool = False, classes_only: bool = False, demarcate_boxes: bool = False, onto_ref_folder: str | Path = None, defaults_folder: str | Path = None, prefixes_path: str | Path = None, set_unique_literals: bool = False) None#

cemento.rdf.rdf_to_graph module#

cemento.rdf.rdf_to_graph.convert_rdf_to_graph(input_path: str | Path, file_format: str | RDFFormat = None, classes_only: bool = False, onto_ref_folder: str | Path = None, defaults_folder: str | Path = None, prefixes_path: str | Path = None, set_unique_literals=True) DiGraph#

cemento.rdf.transforms module#

cemento.rdf.transforms.add_domains_ranges(term_domains_ranges: [<class 'rdflib.term.URIRef'>, collections.abc.Iterable[rdflib.term.URIRef], collections.abc.Iterable[rdflib.term.URIRef]], rdf_graph: ~networkx.classes.digraph.DiGraph) Graph#
cemento.rdf.transforms.add_labels(rdf_graph: Graph, term: URIRef, labels: list[str]) Graph#
cemento.rdf.transforms.add_rdf_triples(rdf_graph: Graph, triples: Iterable[tuple[URIRef | Literal, URIRef, URIRef | Literal]]) Graph#
cemento.rdf.transforms.add_triples_to_digraph(subj: URIRef | Literal, pred: URIRef, obj: URIRef | Literal, graph: DiGraph) DiGraph#
cemento.rdf.transforms.assign_edge_attr(graph: DiGraph, edges: tuple[any, any], new_attrs: dict[str, any]) DiGraph#
cemento.rdf.transforms.assign_edge_binary_attr(graph: Graph, filter_func: Callable[[dict[str, any]], bool], attr: str)#
cemento.rdf.transforms.assign_literal_ids(rdf_graph: Graph, literal_replacements: Iterable[tuple[Literal, Literal]]) Graph#
cemento.rdf.transforms.assign_literal_status(graph: DiGraph, all_literals: set[Literal]) DiGraph#
cemento.rdf.transforms.assign_pred_status(graph: DiGraph) DiGraph#
cemento.rdf.transforms.assign_rank_status(graph: DiGraph, rank_terms: set[URIRef] = {rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#subClassOf')})#
cemento.rdf.transforms.assign_strat_status(graph: DiGraph, strat_terms: set[URIRef] = {rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), rdflib.term.URIRef('http://www.w3.org/2000/01/rdf-schema#subClassOf')}) DiGraph#
cemento.rdf.transforms.bind_prefixes(rdf_graph: Graph, prefixes: dict[str, URIRef | Namespace]) Graph#
cemento.rdf.transforms.construct_literal(term: str, lang='en', datatype=None) Literal#
cemento.rdf.transforms.construct_term_uri(prefix: str, abbrev_term: str, prefixes: dict[str, URIRef | Namespace]) URIRef#
cemento.rdf.transforms.enforce_camel_case_in_rdf_graph(rdf_graph: Graph, terms_to_replace: Iterable[URIRef])#
cemento.rdf.transforms.get_class_terms(graph: DiGraph) set[URIRef]#
cemento.rdf.transforms.get_collection_in_edges(collection_nodes: set[str], graph: DiGraph) list[tuple[str, str, dict[str, str | bool]]]#
cemento.rdf.transforms.get_collection_members(collection_subgraph: DiGraph, collection_id: str, term_mapping: dict[str, URIRef | Literal]) Iterable[str]#
cemento.rdf.transforms.get_collection_nodes(graph: DiGraph) dict[str, str]#
cemento.rdf.transforms.get_collection_nodes_iter(collection_subgraph: DiGraph, collection_nodes: set[str]) Iterable[str]#
cemento.rdf.transforms.get_collection_subgraph(collection_nodes: set[str], graph: DiGraph)#
cemento.rdf.transforms.get_collection_triples_and_targets(collection_nodes: dict[str, str], collection_subgraph: DiGraph, rdf_graph: Graph, term_mapping: dict[str, URIRef | Literal])#
cemento.rdf.transforms.get_domains_ranges(predicate: Iterable[URIRef], graph: DiGraph) tuple[URIRef, set[URIRef], set[URIRef]]#
cemento.rdf.transforms.get_graph_relabel_mapping(terms: URIRef, all_classes: set[URIRef], all_instances: set[URIRef], aliases: dict[URIRef, Literal], inv_prefix: dict[str, str]) dict[URIRef, str]#
cemento.rdf.transforms.get_literal_data_type(literal_term: str, search_terms: dict[str, URIRef], score_cutoff=90) URIRef | None#
cemento.rdf.transforms.get_literal_format_mapping(graph: DiGraph, inv_prefixes: dict[URIRef | Namespace, str]) dict[Literal, str]#
cemento.rdf.transforms.get_literal_lang_annotation(literal_term: str, default=None) str#
cemento.rdf.transforms.get_literal_prefix(literal: Literal, inv_prefixes: dict[URIRef | Namespace, str]) str#
cemento.rdf.transforms.get_literal_values_with_id(literal_terms: list[Literal]) Iterable[tuple[Literal, Literal]]#
cemento.rdf.transforms.get_term_collection_triples(rdf_graph: Graph, head_term: URIRef, member_terms: Iterable[URIRef], member_rel: URIRef, term_collection_rel: URIRef) list[tuple[URIRef, URIRef, URIRef]]#
cemento.rdf.transforms.get_term_domain(term: URIRef, graph: DiGraph) Iterable[URIRef]#
cemento.rdf.transforms.get_term_range(term: URIRef, graph: DiGraph) Iterable[URIRef]#
cemento.rdf.transforms.get_term_value(subj: URIRef, pred: URIRef, ref_rdf_graph: Graph)#
cemento.rdf.transforms.get_uuid()#
cemento.rdf.transforms.get_xsd_terms() dict[str, URIRef]#
cemento.rdf.transforms.remove_generic_property(rdf_graph: Graph, default_property: URIRef = rdflib.term.URIRef('http://www.w3.org/1999/02/22-rdf-syntax-ns#Property')) Graph#
cemento.rdf.transforms.rename_edges(graph: DiGraph, rename_mapping: dict[URIRef, str]) DiGraph#

Module contents#