-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: core: exporters: graphol_iri: handle export of non graphical iris
- Loading branch information
Showing
1 changed file
with
52 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -13,6 +47,7 @@ | |
|
||
LOGGER = getLogger() | ||
|
||
|
||
class GrapholIRIProjectExporter(AbstractProjectExporter): | ||
""" | ||
Extends AbstractProjectExporter with facilities to export the structure of a Graphol project. | ||
|
@@ -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) | ||
|
@@ -742,10 +786,10 @@ def getNodeDomElement(self, node): | |
element.appendChild(geometry) | ||
return element | ||
|
||
|
||
############################################# | ||
# INTERFACE | ||
################################# | ||
|
||
def createProjectFile(self): | ||
""" | ||
Serialize a previously created QDomDocument to disk. | ||
|