Skip to content

eliminate duplicate PrefixDeclarations; have single owl:Ontology per SHACL #81

Description

@VladimirAlexiev

Run this query at https://cim.ontotext.com/graphdb/sparql?repositoryId=cim-shacl:

PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX cim1: <http://iec.ch/TC57/CIM100#>
PREFIX cim:  <https://cim.ucaiug.io/ns#>
select ?p (count(*) as ?c) {
  cim: sh:declare [sh:prefix ?p; sh:namespace ?n]
} group by ?p order by ?p
Image

The reason is that each SHACL file that needs to use SPARQL, defines (a subset of these prefixes) against cim:.
The problem is that when you put all of them together (by loading to a semantic repo), now you have duplicate prefix definitions.

Declaring the same prefix many times in SPARQL is invalid.
(I haven't tested whether doing that in SHACL is invalid, but I bet it is)

So instead, you should declare the prefixes in a single file (or two, for cim and cim1), and use it from each SHACL file like this:

io:Ontology owl:imports cim: .

This will fix another potential problem. Currently each SHACL has 2 owl:Ontology records. One has metadata, the other has prefix declarations:

io:Ontology  rdf:type         owl:Ontology ;
  # ontology metadata

cim:    
    a           owl:Ontology ;
    owl:imports sh: ;
    sh:declare ...

I don't know whether that's prohibited but certainly it's very unusual and shouldn't be done.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions