From 6ff0b0a9b56f1dbe3cdce3a34259f8ff0d7abd72 Mon Sep 17 00:00:00 2001 From: Gianluca Pepe <37369540+gianluca-pepe@users.noreply.github.com> Date: Sat, 19 Oct 2024 14:35:37 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20ontology=20-=20optional=20?= =?UTF-8?q?entity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/ontology.ts | 2 +- src/parsing/parser-v3.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/model/ontology.ts b/src/model/ontology.ts index 8c591b44..e5f72c30 100644 --- a/src/model/ontology.ts +++ b/src/model/ontology.ts @@ -25,7 +25,7 @@ class Ontology extends AnnotatedElement implements RDFGraphMetadata { namespaces: Namespace[] = [] annProperties: AnnotationProperty[] = [] private _diagrams: Map = new Map() - ontologyEntity: GrapholEntity + ontologyEntity?: GrapholEntity languages: string[] = [] defaultLanguage?: string iri?: string diff --git a/src/parsing/parser-v3.ts b/src/parsing/parser-v3.ts index 42d91a86..993c6e6d 100644 --- a/src/parsing/parser-v3.ts +++ b/src/parsing/parser-v3.ts @@ -7,14 +7,13 @@ export function getOntologyInfo(xmlDocument: XMLDocument) { let ontology_languages = getTag(xmlDocument, 'languages')?.children let iri = getTag(xmlDocument, 'ontology')?.getAttribute('iri') - const ontology = new Ontology(project?.getAttribute('name') || '', project?.getAttribute('version') || '') + const ontology = new Ontology(project?.getAttribute('name') || '', project?.getAttribute('version') || '', iri || undefined) if (ontology_languages) ontology.languages = [...ontology_languages].map(lang => lang.textContent).filter(l => l !== null) as string[] || [] ontology.defaultLanguage = getTag(xmlDocument, 'ontology')?.getAttribute('lang') || ontology.languages[0] if (iri) { - ontology.iri = iri ontology.annotations = getIriAnnotations(iri, xmlDocument, getNamespaces(xmlDocument)) } return ontology