Label commands¶
Find duplicate names or descriptions¶
Use kurra labels duplicates with an RDF file or directory to print a table of nodes with multiple distinct annotation
literals. Names are checked by default:
kurra labels duplicates vocabulary.ttl
kurra labels duplicates vocabulary.ttl --names-or-descriptions names
To check descriptions instead, use --names-or-descriptions (short form -n):
kurra labels duplicates vocabulary.ttl --names-or-descriptions descriptions
kurra labels duplicates vocabulary.ttl -n descriptions
The only accepted annotation types are names and descriptions. Names use schema:name, rdfs:label, dcterms:title,
and skos:prefLabel; descriptions use schema:description, rdfs:comment, dcterms:description, and skos:definition.
The schema: predicates use the https://schema.org/ namespace.
Supply full predicate IRIs with --additional-annotation-predicates (short form -a) to extend the default predicates.
Repeat the option for each additional IRI:
kurra labels duplicates vocabulary.ttl \
--additional-annotation-predicates https://example.com/displayName \
--additional-annotation-predicates https://example.com/shortName
kurra labels duplicates vocabulary.ttl -n descriptions \
-a https://example.com/description
The table contains a Node column and a Names or Descriptions column. Literal values retain their RDF notation,
including language tags and datatypes. Identical literals under different predicates count once; differences in
spelling, datatype, or language count separately, including language versus no language. Comparisons use values as
stored by RDFLib, which may normalize typed literals when reading the source.
If no duplicates are found, the command prints No nodes with duplicate names or No nodes with duplicate descriptions.
The input file or directory must exist. For all options, run:
Command reference¶
kurra.cli.commands.labels ¶
CLI commands for managing RDF labels.
find_duplicate_labels_command ¶
find_duplicate_labels_command(p: Path, names_or_descriptions: Literal['names', 'descriptions'] = 'names', additional_annotation_predicates: list[str] | None = None) -> None
Print nodes with multiple distinct annotation literals as a table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p
|
Path
|
The RDF file or directory to scan. |
required |
names_or_descriptions
|
Literal['names', 'descriptions']
|
Check names (default) or descriptions. |
'names'
|
additional_annotation_predicates
|
list[str] | None
|
Additional predicate IRIs, supplied by repeating the option. |
None
|
Source code in kurra/cli/commands/labels.py
find_command ¶
find_command(f: str = typer.Argument(..., help='The RDF file to fine IRIs missing labels within'), local_context: str = typer.Option(None, '--local-context', '-l', help='An RDF file or directory of RDF files containing labels')) -> None
Print every IRI in an RDF file or directory that is missing an rdfs:label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
str
|
The RDF file or directory of RDF files to scan for IRIs missing labels. |
Argument(..., help='The RDF file to fine IRIs missing labels within')
|
local_context
|
str
|
An RDF file or directory of files containing labels to check against, in addition to |
Option(None, '--local-context', '-l', help='An RDF file or directory of RDF files containing labels')
|
Source code in kurra/cli/commands/labels.py
get_command ¶
get_command(f: str = typer.Argument(..., help='The RDF file to fine IRIs missing labels within'), local_context: str = typer.Option(None, '--local-context', '-l', help='An RDF file or directory of RDF files containing labels'), additional_context: str = typer.Option('https://fuseki.dev.kurrawong.ai/semback/sparql', '--additional-context', '-c', help='An additional source of labels'), return_type: str = typer.Option('graph', '--return-type', '-r', help="Return RDF in the longturtle format or a printed table of IRIs and labels. Either 'graph' or 'table'")) -> None
Fetch and print labels for IRIs that are missing them from a given context (local_context) or additional context (additional_context), by default the KurrawongAI Semantic Background.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
str
|
The RDF file or directory of RDF files to scan for IRIs missing labels. |
Argument(..., help='The RDF file to fine IRIs missing labels within')
|
local_context
|
str
|
An RDF file or directory of files containing labels to check against, in addition to |
Option(None, '--local-context', '-l', help='An RDF file or directory of RDF files containing labels')
|
additional_context
|
str
|
A further RDF source (file, directory, or SPARQL endpoint) to fetch missing labels from. |
Option('https://fuseki.dev.kurrawong.ai/semback/sparql', '--additional-context', '-c', help='An additional source of labels')
|
return_type
|
str
|
|
Option('graph', '--return-type', '-r', help="Return RDF in the longturtle format or a printed table of IRIs and labels. Either 'graph' or 'table'")
|
Source code in kurra/cli/commands/labels.py
context_command ¶
Generate a JSON-LD context from the labels in a given RDF file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rdf
|
Path
|
The RDF file to generate a JSON-LD context from. |
required |
local_context
|
Path | None
|
An RDF file or directory of files containing labels to source from, in addition to |
None
|