-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpipeWorkFlowInputs.py
More file actions
52 lines (41 loc) · 2.87 KB
/
Copy pathpipeWorkFlowInputs.py
File metadata and controls
52 lines (41 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#-------------------------------------------------------------------------------
# Name: pipeWorkFlowInput.py
# Purpose: generates input data for workflow generator (APE) from a given OWL
# data ontology and a tool annotation, in two versions:
# one with the full ontology, the other one with a thinned out version.
#
# Author: Schei008
#
# Created: 26-04-2019
# Copyright: (c) Schei008 2019
# Licence: <your licence>
#-------------------------------------------------------------------------------
import shallowOntology, typeCombinations, cleanWfTaxonomy, toolannotator
import rdflib
def pipe(tooldescfile = 'ToolDescription.ttl', ontologyfile = 'CoreConceptData.ttl'):
#First generates a version of both the ontology and the tool description (_ct) that combines all input/output types to intersection classes (to deal only with single types)
typeCombinations.combineTypes(tooldescfile, ontologyfile)
#Then generates a taxonomy (_tax) version of the ontology as well as of the given tool hierarchy (=subClassOf), by applying reasoning and removing all other statements
cleanWfTaxonomy.main(ontologyfile = 'CoreConceptData_ct.ttl', tooldesc='ToolDescription_ct.ttl')
final = rdflib.Graph()
final.parse('CoreConceptData_tax.ttl', format='turtle')
final.parse('ToolDescription_tax.ttl', format='turtle')
final.serialize(destination='GISTaxonomy.rdf', format = "application/rdf+xml")
#Then generates a JSON version of the tooldescription for the full taxonomy (to be used with GISTaxonomy.rdf)
toolannotator.main(toolsinrdf= 'ToolDescription_ct.ttl')
#Generates a flattened (_fl) ontology by removing classes that inherit classlist, then generates a corresponding flattened tooldescription, by substituting classes with the LUC in the flattened ontology
# shallowOntology.main(tooldescfile = "ToolDescription_ct.ttl", ontologyfile = 'CoreConceptData_tax.ttl', classlist = ["FieldQ", "NetworkDS", "NetworkQ", "CoreConceptDataSet", "NominalA", "EventQ", "ObjectQ", "BoundedPhen", "FieldDS", "EventDS", "ObjectDS", "AmountDS"] )
cleanWfTaxonomy.main(ontologyfile = 'CoreConceptData_ct.ttl', tooldesc='ToolDescription_ct_fl_manual.ttl', tool_tax_output='ToolDescription_tax_fl.ttl')
finalfl = rdflib.Graph()
finalfl.parse('CoreConceptData_tax_fl.ttl', format='turtle')
finalfl.parse('ToolDescription_tax_fl.ttl', format='turtle')
finalfl.serialize(destination='GISTaxonomy_fl.rdf', format = "application/rdf+xml")
#JSON version of the flattened tool description (to be used with GISTaxonomy_fl.rdf
# toolannotator.main(toolsinrdf= 'ToolDescription_ct_fl.ttl')
# JSON version of the manual flattened tool description (to be used with
# GISTaxonomy_fl.rdf)
toolannotator.main(toolsinrdf= 'ToolDescription_ct_fl_manual.ttl')
def main():
pipe()
if __name__ == '__main__':
main()