Skip to content

Commit

Permalink
Improve bblocks semantic uplift
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Jan 17, 2024
1 parent 6693cb8 commit 5089013
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 15 deletions.
16 changes: 11 additions & 5 deletions ogc/bblocks/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,14 @@
print(f" - {register_jsonld_fn}", file=sys.stderr)
print(f" - {register_ttl_fn}", file=sys.stderr)
# TODO: Entailments
uplift_args = register_additional_metadata.copy()
uplift_args.setdefault('baseUrl', base_url or 'https://www.opengis.net/def/bblocks/')
ingest_json.process_file(register_file,
context_fn=uplift_context_file,
jsonld_fn=register_jsonld_fn,
ttl_fn=register_ttl_fn,
provenance_base_uri=args.base_url)
provenance_base_uri=args.base_url,
transform_args=uplift_args)

# 3. Copy Slate assets
# Run rsync -rlt /src/ogc/bblocks/slate-assets/ "${GENERATED_DOCS_PATH}/slate/"
Expand All @@ -258,9 +261,12 @@
auth = None
print(f"Pushing {register_ttl_fn} to SPARQL GSP at {sparql_gsp}", file=sys.stderr)
sparql_graph = sparql_conf.get('graph') or base_url
update_vocabs.load_vocab(register_ttl_fn,
graph_store=sparql_gsp,
graph_uri=sparql_graph,
auth_details=auth)
try:
update_vocabs.load_vocab(register_ttl_fn,
graph_store=sparql_gsp,
graph_uri=sparql_graph,
auth_details=auth)
except Exception as e:
print(f" !! Error uploading to SPARQL GSP: {e}", file=sys.stderr)

print(f"Finished Building Blocks postprocessing", file=sys.stderr)
45 changes: 35 additions & 10 deletions ogc/bblocks/register-context.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
transform:
# Extract bblocks
- if type != "array" then .bblocks else . end
# Add @type from itemClass with initial capital letter
- '[ .[] | ."@type" = [("bblocks:" + (.itemClass[:1]|ascii_upcase) + .itemClass[1:]), "skos:Concept"] ]'
- '.bblocks |= [ .[] | ."@type" = [("bblocks:" + (.itemClass[:1]|ascii_upcase) + .itemClass[1:]), "skos:Concept", "dcat:Dataset"] ]'
# Add ConceptScheme
- |
{
"@id": "https://www.opengis.net/def/bblocks",
"@type": "skos:ConceptScheme",
"skos:prefLabel": "OGC Building Blocks Register",
"hasConcepts": .
}
if type == "array" then {
"@id": "https://www.opengis.net/def/bblocks",
"@type": ["skos:ConceptScheme", "dcat:Catalog"],
"skos:prefLabel": "OGC Building Blocks Register",
"hasConcepts": .
} else . + {
"@type": ["skos:ConceptScheme", "dcat:Catalog"],
"skos:prefLabel": .name,
"hasConcepts": .bblocks
} | del(.bblocks) end
- '{ "@context": { "@base": ($baseUrl // "https://www.opengis.net/def/bblocks/") } } + .'

# TODO: add dateTimeSupersession, dateTimeRetirement, dateTimeInvalidation, predecessor, successor
context:
'$':
bblocks: https://www.opengis.net/def/bblocks/
'@base': https://www.opengis.net/def/bblocks/
rdfs: http://www.w3.org/2000/01/rdf-schema#
skos: http://www.w3.org/2004/02/skos/core#
dct: http://purl.org/dc/terms/
xsd: http://www.w3.org/2001/XMLSchema#
prof: http://www.w3.org/ns/dx/prof/
dcat: http://www.w3.org/ns/dcat#

itemIdentifier: '@id'
baseURL: '@id'
name: rdfs:label
abstract: dct:abstract
description: dct:description
# register:
# '@id': bblocks:inRegister
# '@type': '@id'
Expand Down Expand Up @@ -59,6 +66,9 @@ context:
ldContext:
'@id': bblocks:hasJsonLdContext
'@type': '@id'
sourceLdContext:
'@id': bblocks:hasSourceJsonLdContext
'@type': '@id'
documentation:
'@id': dct:description
'@type': '@id'
Expand All @@ -72,3 +82,18 @@ context:
dependsOn:
'@id': bblocks:dependsOn
'@type': '@id'
profileOf:
'@id': prof:isProfileOf
'@type': '@id'
tags: dcat:keyword
shaclRules:
'@id': bblocks:hasShaclRule
'@type': '@id'
'@container': '@index'
'@index': rdfs:seeAlso
validationReport:
'@id': bblocks:hasValidationReport
'@type': '@id'
imports:
'@id': bblocks:imports
'@type': '@id'

0 comments on commit 5089013

Please sign in to comment.