Skip to content

Commit

Permalink
WIP: core: exporters: graphol_iri: handle export of non graphical iris
Browse files Browse the repository at this point in the history
  • Loading branch information
mnamici committed Nov 18, 2024
1 parent 0ddd3e5 commit e27d563
Showing 1 changed file with 52 additions and 8 deletions.
60 changes: 52 additions & 8 deletions eddy/core/exporters/graphol_iri.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
# -*- coding: utf-8 -*-

##########################################################################
# #
# Eddy: a graphical editor for the specification of Graphol ontologies #
# Copyright (C) 2015 Daniele Pantaleone <[email protected]> #
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
# #
# ##################### ##################### #
# #
# Graphol is developed by members of the DASI-lab group of the #
# Dipartimento di Ingegneria Informatica, Automatica e Gestionale #
# A.Ruberti at Sapienza University of Rome: http://www.dis.uniroma1.it #
# #
# - Domenico Lembo <[email protected]> #
# - Valerio Santarelli <[email protected]> #
# - Domenico Fabio Savo <[email protected]> #
# - Daniele Pantaleone <[email protected]> #
# - Marco Console <[email protected]> #
# #
##########################################################################

import os

from PyQt5 import QtXml
Expand All @@ -13,6 +47,7 @@

LOGGER = getLogger()


class GrapholIRIProjectExporter(AbstractProjectExporter):
"""
Extends AbstractProjectExporter with facilities to export the structure of a Graphol project.
Expand Down Expand Up @@ -188,14 +223,23 @@ def getOntologyDomElement(self):
irisEl = self.getDomElement('iris')
ontologyEl.appendChild(irisEl)
if not self.selectedDiagrams:
for iri in sorted(self.project.iris,key=str):
if (self.project.existIriOccurrence(iri) or iri==self.project.ontologyIRI) and not (iri.isTopBottomEntity() or iri in self.project.getDatatypeIRIs() or iri in self.project.constrainingFacets or iri in self.project.getAnnotationPropertyIRIs()):
iriEl = self.getIriDomElement(iri)
irisEl.appendChild(iriEl)
for iri in sorted(self.project.iris, key=str):
if ((self.project.existIriOccurrence(iri)
or iri == self.project.ontologyIRI)
and not (iri.isTopBottomEntity()
or iri in self.project.getDatatypeIRIs()
or iri in self.project.constrainingFacets
or iri in self.project.getAnnotationPropertyIRIs())):
iriEl = self.getIriDomElement(iri)
irisEl.appendChild(iriEl)
else:
for iri in sorted(self.project.iris,key=str):
if (self.project.existIriOccurrence(iri) or iri == self.project.ontologyIRI) and not (
iri.isTopBottomEntity() or iri in self.project.getDatatypeIRIs() or iri in self.project.constrainingFacets or iri in self.project.getAnnotationPropertyIRIs()):
for iri in sorted(self.project.iris, key=str):
if ((self.project.existIriOccurrence(iri)
or iri == self.project.ontologyIRI)
and not (iri.isTopBottomEntity()
or iri in self.project.getDatatypeIRIs()
or iri in self.project.constrainingFacets
or iri in self.project.getAnnotationPropertyIRIs())):
if self.occursInAtLeastOneSelectedDiagrams(iri):
iriEl = self.getIriDomElement(iri)
irisEl.appendChild(iriEl)
Expand Down Expand Up @@ -742,10 +786,10 @@ def getNodeDomElement(self, node):
element.appendChild(geometry)
return element


#############################################
# INTERFACE
#################################

def createProjectFile(self):
"""
Serialize a previously created QDomDocument to disk.
Expand Down

0 comments on commit e27d563

Please sign in to comment.