-
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.
Merge pull request #288 from mnamici/nongraphical-iris
Non-graphical IRIs in the project
- Loading branch information
Showing
3 changed files
with
538 additions
and
525 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. | ||
|
@@ -187,26 +222,11 @@ 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) | ||
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()): | ||
if self.occursInAtLeastOneSelectedDiagrams(iri): | ||
iriEl = self.getIriDomElement(iri) | ||
irisEl.appendChild(iriEl) | ||
for iri in sorted(self.project.iris, key=str): | ||
iriEl = self.getIriDomElement(iri) | ||
irisEl.appendChild(iriEl) | ||
return ontologyEl | ||
|
||
def occursInAtLeastOneSelectedDiagrams(self,iri): | ||
for diagram in self.selectedDiagrams: | ||
if self.project.iriOccurrences(iri=iri,diagram=diagram): | ||
return True | ||
return False | ||
|
||
def getOntologyImportDomElement(self, impOnt): | ||
impEl = self.getDomElement('import') | ||
impEl.setAttribute('iri', impOnt.ontologyIRI) | ||
|
@@ -742,10 +762,10 @@ def getNodeDomElement(self, node): | |
element.appendChild(geometry) | ||
return element | ||
|
||
|
||
############################################# | ||
# INTERFACE | ||
################################# | ||
|
||
def createProjectFile(self): | ||
""" | ||
Serialize a previously created QDomDocument to disk. | ||
|
Oops, something went wrong.