update_vocabs
Implements an entailment + validation workflow.
update_vocabs
starts by loading one or more
DomainConfiguration's from
RDF files and/or SPARQL endpoints, and a series of profile definitions
(also from a list of RDF files and/or SPARQL endpoints).
From there, individual or batch processing of files can be done,
as well as uploading the results to a target triplestore.
This script can be used as a library, or run directly from the cli; please refer to the OGC NamingAuthority repository for usage details on the latter.
get_entailed_base_path(f, g, rootpattern=None, entailed_dir=DEFAULT_ENTAILED_DIR)
Tries to find the base output file path for an entailed version of a source Graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f |
Path
|
the original path of the source file |
required |
g |
Graph
|
the Graph loaded from the source file |
required |
rootpattern |
Union[str, None]
|
a root pattern to filter candidate URIs |
None
|
entailed_dir |
str
|
the name of the base entailed files directory |
DEFAULT_ENTAILED_DIR
|
Source code in ogc/na/update_vocabs.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
get_graph_uri_for_vocab(g=None)
Find a target graph URI in a vocabulary Graph.
In effect, this function merely looks for SKOS ConceptScheme's.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
g |
Graph
|
the Graph for which to find the target URI |
None
|
Returns:
Type | Description |
---|---|
Generator[str, None, None]
|
a Node generator |
Source code in ogc/na/update_vocabs.py
107 108 109 110 111 112 113 114 115 116 117 118 |
|
load_vocab(vocab, graph_uri, graph_store, auth_details=None)
Loads a vocabulary onto a triplestore using the SPARQL Graph Store protocol.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vocab |
Union[Graph, str, Path]
|
the file or Graph to load |
required |
graph_uri |
str
|
a target graph URI |
required |
graph_store |
str
|
the target SPARQL Graph Store protocol URL |
required |
auth_details |
tuple[str]
|
a |
None
|
Returns:
Type | Description |
---|---|
None
|
|
Source code in ogc/na/update_vocabs.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
make_rdf(filename, g, rootpath=None, entailment_directory=DEFAULT_ENTAILED_DIR, provenance_metadata=None)
Serializes entailed RDF graphs in several output formats for a given input graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename |
Union[str, Path]
|
the original source filename |
required |
g |
Graph
|
Graph loaded from the source file |
required |
rootpath |
Union[str, None]
|
a path to filter concept schemes inside the Graph and infer the main one |
None
|
provenance_metadata |
ProvenanceMetadata
|
provenance metadata (None to ignore) |
None
|
entailment_directory |
Union[str, Path]
|
name for the output subdirectory for entailed files |
DEFAULT_ENTAILED_DIR
|
Returns:
Type | Description |
---|---|
Path
|
the output path for the Turtle version of the entailed files |
Source code in ogc/na/update_vocabs.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
setup_logging(debug=False)
Sets up logging level and handlers (logs WARNING and ERROR to stderr).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
debug |
bool
|
whether to set DEBUG level |
False
|
Source code in ogc/na/update_vocabs.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|