Skip to content

Commit

Permalink
minor update to workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
srmnitc committed Apr 11, 2024
1 parent bb14da3 commit 470a7e0
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
3 changes: 3 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ dependencies:
- owlready2
- plotly
- ipywidgets
- sqlalchemy
- pip:
- "git+https://github.com/RDFLib/rdflib-sqlalchemy.git@develop"
2 changes: 1 addition & 1 deletion pyscal_rdf/workflow/pyiron.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _check_if_job_is_valid(job):
raise TypeError('These type of pyiron Job is not currently supported')


def _add_structures(kg, job):
def _add_structures(job):
initial_pyiron_structure = job.structure
final_pyiron_structure = job.get_structure(frame=-1)
initial_pyscal_structure = System.read.ase(initial_pyiron_structure)
Expand Down
30 changes: 27 additions & 3 deletions pyscal_rdf/workflow/workflow.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,52 @@
"""
Workflows aspects for non-automated annotation of structures.
This consists of a workflow class which implements the necessary methods to serialise triples as needed.
Custom workflow solutions can be implemented. An example available here is pyiron.
The custom workflow env should implement the following functions:
_check_if_job_is_valid
_add_structure
_identify_method
extract_calculated_properties
inform_graph
See pyscal_rdf.workflow.pyiron for more details
"""

from pyscal_rdf.structure import System
from rdflib import Graph, Literal, Namespace, XSD, RDF, RDFS, BNode, URIRef, FOAF, SKOS, DCTERMS

import pyscal_rdf.workflow.pyiron as pi

import warnings
import numpy as np
import os
import copy
import ast
import uuid

#Move imports to another file
PROV = Namespace("http://www.w3.org/ns/prov#")
CMSO = Namespace("http://purls.helmholtz-metadaten.de/cmso/")
PODO = Namespace("http://purls.helmholtz-metadaten.de/podo/")
ASO = Namespace("http://purls.helmholtz-metadaten.de/aso/")

#custom imports as needed
import pyscal_rdf.workflow.pyiron as pi


class Workflow:
def __init__(self, kg,
environment='pyiron'):
"""
Initialize the workflow environment
Parameters
----------
kg: pyscal-rdf KnowledgeGraph
environment: string
the workflow environment. This is used to import the necessary functions.
"""
self.kg = kg
if environment == 'pyiron':
self.wenv = pi
Expand All @@ -31,7 +55,7 @@ def __init__(self, kg,

def _prepare_job(self, workflow_object):
self.wenv._check_if_job_is_valid(workflow_object)
parent_structure, parent_sample, structure, sample = self.wenv._add_structures(self.kg, workflow_object)
parent_structure, parent_sample, structure, sample = self.wenv._add_structures(workflow_object)
method_dict = self.wenv._identify_method(workflow_object)

if (structure is None) and (sample is None):
Expand Down

0 comments on commit 470a7e0

Please sign in to comment.