cemento.rdf package#
Submodules#
cemento.rdf.constants module#
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, log_substitution_path: str | Path = None, expand_puns: bool = False) None#
- cemento.rdf.drawio_to_rdf.convert_graph_to_rdf_graph(elements: dict[str, dict[str, any]], all_terms: Iterable[str], triples: list[tuple[str, str, str]], containers: list[tuple[str, str, list[str]]], onto_ref_folder: str | Path = None, defaults_folder: str | Path = None, prefixes_path: str | Path = None, log_substitution_path: str | Path = None, expand_puns: bool = False, enforce_camel_case: bool = True) Graph#
cemento.rdf.io module#
- cemento.rdf.io.aggregate_graphs(folder_path: str | Path | list[str | Path])#
- cemento.rdf.io.save_substitution_log(input_terms: dict[str, str], term_search_keys: dict[str, list[str]], term_substitution: dict[str, URIRef], substituted_terms: Container[str], log_substitution_path: str | Path) None#
cemento.rdf.preprocessing module#
- cemento.rdf.preprocessing.clean_literal_string(literal_term: str) str#
- cemento.rdf.preprocessing.extract_aliases(term: str)#
- cemento.rdf.preprocessing.format_literal(literal: Literal, prefix: 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.transforms module#
- 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.construct_literal(term: str, lang='en', datatype=None) Literal#
- cemento.rdf.transforms.get_child_type(classes: set[URIRef], instances: set[URIRef], datatypes: set[URIRef], child: Node) URIRef | None#
- cemento.rdf.transforms.get_classes_instances(rdf_graph: Graph) tuple[set[URIRef], set[URIRef]]#
- cemento.rdf.transforms.get_datatypes(rdf_graph: Graph) 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_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_search_pool(ref_graph: Graph, inv_prefixes: dict[str, str]) dict[Node, str]#
- cemento.rdf.transforms.get_uuid()#
- cemento.rdf.transforms.rename_edges(graph: DiGraph, rename_mapping: dict[URIRef, str]) DiGraph#
- cemento.rdf.transforms.replace_term_in_triples(rdf_graph: Graph, old_term: Node, new_term: Node) Graph#