Skip to content

Commit 63c72fe

Browse files
committed
Change start of NamedIndividuals' suffices to use last path-segment of class's IRI
While drafting hand-written example data, it had proved beneficial to some drafters (myself included) to disambiguate `owl:NamedIndividual`s from `owl:Class`es by spelling the class differently in the IRI. Taking `uco-observable:FileFacet` as an example, it was originally frequently written as `FileFacet` when referring to the class, and `file-facet-...` when referring to an individual. Unfortunately, trying to carry this pattern forward is likely to create a technological burden. Camel casing can't always be assumed to apply straightforwardly, and would cause special-case logic to be needed. See e.g.: * `uco-observable:WifiAddressFacet` that would split on capital letters to `kb:wifi-address-facet`, which doesn't seem to be a problem; * `uco-location:GPSCoordinatesFacet` would induce `kb:g-p-s-coordinates-facet`, which seems far less obviously acceptable; * `uco-observable:HTTPConnectionFacet` splitting to `kb:h-t-t-p-connection-facet` may be the last convincing we need. Rather than invest in preserving the lowercased, hyphenated suffix scheme, this patch removes the question and now has individuals use the last path-segment of the class's IRI. A follow-on patch will regenerate Make-managed files. Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent fe56b72 commit 63c72fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

case_utils/case_file/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def create_file_node(
7070
:param filepath: The path to the file to characterize. Can be relative or absolute.
7171
:type filepath: str
7272
73-
:param node_iri: The desired full IRI for the node. If absent, will make an IRI of the pattern ``ns_base + 'file-' + uuid4``
73+
:param node_iri: The desired full IRI for the node. If absent, will make an IRI of the pattern ``ns_base + 'File-' + uuid4``
7474
:type node_iri: str
7575
7676
:param node_prefix: The base prefix to use if node_iri is not supplied.
@@ -88,7 +88,7 @@ def create_file_node(
8888
node_namespace = rdflib.Namespace(node_prefix)
8989

9090
if node_iri is None:
91-
node_slug = "file-" + case_utils.local_uuid.local_uuid()
91+
node_slug = "File-" + case_utils.local_uuid.local_uuid()
9292
node_iri = node_namespace[node_slug]
9393
n_file = rdflib.URIRef(node_iri)
9494
graph.add((n_file, NS_RDF.type, NS_UCO_OBSERVABLE.File))
@@ -97,7 +97,7 @@ def create_file_node(
9797
literal_basename = rdflib.Literal(basename)
9898

9999
file_stat = os.stat(filepath)
100-
n_file_facet = node_namespace["file-facet-" + case_utils.local_uuid.local_uuid()]
100+
n_file_facet = node_namespace["FileFacet-" + case_utils.local_uuid.local_uuid()]
101101
graph.add(
102102
(
103103
n_file_facet,
@@ -273,7 +273,7 @@ def main() -> None:
273273
context_dictionary = {k: v for (k, v) in graph.namespace_manager.namespaces()}
274274
serialize_kwargs["context"] = context_dictionary
275275

276-
node_iri = NS_BASE["file-" + case_utils.local_uuid.local_uuid()]
276+
node_iri = NS_BASE["File-" + case_utils.local_uuid.local_uuid()]
277277
create_file_node(
278278
graph,
279279
args.in_file,

0 commit comments

Comments
 (0)