From bb2b70adffa0452937edb0c4988303472c3e8aed Mon Sep 17 00:00:00 2001 From: bindeali <56399637+bindeali@users.noreply.github.com> Date: Tue, 31 Dec 2024 15:59:09 +0100 Subject: [PATCH] feat(archi): rpp for archi --- src/archiToOFN.py | 25 ++++++++++++++++++++++++- src/archiToOFNBase.py | 0 src/tableToOFN.py | 9 +++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) delete mode 100644 src/archiToOFNBase.py diff --git a/src/archiToOFN.py b/src/archiToOFN.py index f88b3f6..bf07a46 100644 --- a/src/archiToOFN.py +++ b/src/archiToOFN.py @@ -1,6 +1,6 @@ import sys from lxml import etree # type: ignore -from ofnClasses import ClassType, Relationship, Trope, Vocabulary, Term, VocabularyType, getClass, getTrope +from ofnClasses import * from outputToRDF import convertToRDF from ofnBindings import * from outputUtil import testInputString @@ -115,6 +115,29 @@ [1]] = termProperties[OFN_DESCRIPTION.lower()][0] if OFN_DATATYPE.lower() in termProperties and isinstance(term, Trope): term.datatype = termProperties[OFN_DATATYPE.lower()][0] + + # RPP + if OFN_RPP_AIS.lower() in termProperties and isinstance(term, TermClass): + term.source = termProperties[OFN_RPP_AIS.lower()][0] + if OFN_RPP_AGENDA.lower() in termProperties and isinstance(term, TermClass): + term.source = termProperties[OFN_RPP_AGENDA.lower()][0] + if OFN_RPP_TYPE.lower() in termProperties and (isinstance(term, Trope) or isinstance(term, Relationship)): + if termProperties[OFN_RPP_TYPE.lower()][0].strip().lower() == YES.lower(): + term.rppType = RPPType.PUBLIC + elif termProperties[OFN_RPP_TYPE.lower()][0].strip().lower() == NO.lower(): + term.rppType = RPPType.PRIVATE + else: + warnings.warn("warn") + if OFN_RPP_SHARED.lower() in termProperties and (isinstance(term, Trope) or isinstance(term, Relationship)): + if termProperties[OFN_RPP_SHARED.lower()][0].strip().lower() == YES.lower(): + term.sharedInPPDF = True + elif termProperties[OFN_RPP_SHARED.lower()][0].strip().lower() == NO.lower(): + term.sharedInPPDF = False + else: + warnings.warn("warn") + if OFN_RPP_PRIVATE_SOURCE.lower() in termProperties and (isinstance(term, Trope) or isinstance(term, Relationship)): + term.source = termProperties[OFN_RPP_PRIVATE_SOURCE.lower()][0] + vocabulary.terms.append(term) for relationship in relationships: diff --git a/src/archiToOFNBase.py b/src/archiToOFNBase.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/tableToOFN.py b/src/tableToOFN.py index 52cf98f..8398631 100644 --- a/src/tableToOFN.py +++ b/src/tableToOFN.py @@ -1,7 +1,7 @@ from typing import List import openpyxl # type: ignore import sys -from ofnClasses import Relationship, Term, TermClass, Trope, Vocabulary, VocabularyType, getClass, getTrope, ClassType +from ofnClasses import * from outputToRDF import convertToRDF from ofnBindings import * import csv @@ -244,7 +244,12 @@ def rlSheetToOFN(sheet) -> List[Relationship]: else: warnings.warn("warn") if row[rppTypeIndex]: - term.rppType = row[rppTypeIndex] + if row[rppTypeIndex].strip().lower() == YES.lower(): + term.rppType = RPPType.PUBLIC + elif row[rppTypeIndex].strip().lower() == NO.lower(): + term.rppType = RPPType.PRIVATE + else: + warnings.warn("warn") if row[rppPrivateTypeSourceIndex]: term.rppPrivateTypeSource = row[rppPrivateTypeSourceIndex] if row[relatedSourceIndex]: