Skip to content

Commit c399760

Browse files
committed
use object of sh:declare as substitute ontology
1 parent 6cbee51 commit c399760

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/src/ontology.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,15 @@ impl Ontology {
322322
require_ontology_names: bool,
323323
) -> Result<Self> {
324324
// get the rdf:type owl:Ontology declarations
325-
let decls: Vec<SubjectRef> = graph
325+
let mut decls: Vec<SubjectRef> = graph
326326
.subjects_for_predicate_object(TYPE, ONTOLOGY)
327327
.collect::<Vec<_>>();
328328

329+
// if decls is empty, then find all subjets of sh:declare
330+
if decls.is_empty() {
331+
decls.extend(graph.triples_for_predicate(DECLARE).map(|t| t.subject));
332+
}
333+
329334
// ontology_name is the subject of the first declaration
330335
let ontology_name: Subject = match decls.first() {
331336
Some(decl) => match decl {

0 commit comments

Comments
 (0)