Skip to content

Commit

Permalink
🐛 fix ontology - optional entity
Browse files Browse the repository at this point in the history
  • Loading branch information
gianluca-pepe committed Oct 19, 2024
1 parent 73cbb4a commit 6ff0b0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/model/ontology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Ontology extends AnnotatedElement implements RDFGraphMetadata {
namespaces: Namespace[] = []
annProperties: AnnotationProperty[] = []
private _diagrams: Map<string, Diagram> = new Map()
ontologyEntity: GrapholEntity
ontologyEntity?: GrapholEntity
languages: string[] = []
defaultLanguage?: string
iri?: string
Expand Down
3 changes: 1 addition & 2 deletions src/parsing/parser-v3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6ff0b0a

Please sign in to comment.