Functions:
-
add_literal_list_pred–Add an RDF list of literal values as a predicate value on a subject.
-
add_node_list_pred–Add an RDF list of nodes as a predicate value on a subject.
-
load_list_re–Recursively iterate over RDF list containers for extracting lists of lists.
add_literal_list_pred
add_literal_list_pred(graph, subject_uri, pred_uri, values)
Add an RDF list of literal values as a predicate value on a subject.
Parameters:
-
graph(Graph) –Graph object to add the list to
-
subject_uri(URIRef) –Subject node to attach the list to
-
pred_uri(URIRef) –Predicate connecting the subject to the list
-
values(tuple[Any, ...] | list[Any]) –Values to convert to literals and store in the RDF list
Returns:
-
Collection–Created RDF collection
Source code in src/rdf_utils/collection.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
add_node_list_pred
add_node_list_pred(graph, subject_uri, pred_uri, nodes)
Add an RDF list of nodes as a predicate value on a subject.
Parameters:
-
graph(Graph) –Graph object to add the list to
-
subject_uri(URIRef) –Subject node to attach the list to
-
pred_uri(URIRef) –Predicate connecting the subject to the list
-
nodes(list[Node]) –Nodes to store in the RDF list
Returns:
-
Collection–Created RDF collection
Source code in src/rdf_utils/collection.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
load_list_re
load_list_re(graph, first_node, parse_uri=True, quiet=True)
Recursively iterate over RDF list containers for extracting lists of lists.
Parameters:
-
graph(Graph) –Graph object to extract the list(s) from
-
first_node(BNode) –First element in the list
-
parse_uri(bool, default:True) –if True will try converting literals into URIRef
-
quiet(bool, default:True) –if True will not throw exceptions other than loop detection
Raises:
-
RuntimeError–When a loop is detected
-
ValueError–When
quietisFalseand short URI cannot be expanded
Source code in src/rdf_utils/collection.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |