aboutsummaryrefslogtreecommitdiff
path: root/bh20sequploader/qc_metadata.py
diff options
context:
space:
mode:
Diffstat (limited to 'bh20sequploader/qc_metadata.py')
-rw-r--r--bh20sequploader/qc_metadata.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/bh20sequploader/qc_metadata.py b/bh20sequploader/qc_metadata.py
index e477f21..fbfd286 100644
--- a/bh20sequploader/qc_metadata.py
+++ b/bh20sequploader/qc_metadata.py
@@ -1,9 +1,12 @@
import schema_salad.schema
import schema_salad.ref_resolver
+import schema_salad.jsonld_context
import logging
import pkg_resources
import logging
import traceback
+from rdflib import Graph, Namespace
+from pyshex.evaluate import evaluate
def qc_metadata(metadatafile):
schema_resource = pkg_resources.resource_stream(__name__, "bh20seq-schema.yml")
@@ -13,13 +16,21 @@ def qc_metadata(metadatafile):
schema_metadata,
metaschema_loader) = schema_salad.schema.load_schema("https://raw.githubusercontent.com/arvados/bh20-seq-resource/master/bh20sequploader/bh20seq-schema.yml", cache=cache)
+ shex = pkg_resources.resource_stream(__name__, "bh20seq-shex.rdf").read().decode("utf-8")
+
if not isinstance(avsc_names, schema_salad.avro.schema.Names):
print(avsc_names)
return False
try:
doc, metadata = schema_salad.schema.load_and_validate(document_loader, avsc_names, metadatafile, True)
- return True
+ g = schema_salad.jsonld_context.makerdf("workflow", doc, document_loader.ctx)
+ rslt, reason = evaluate(g, shex, doc["id"], "https://raw.githubusercontent.com/arvados/bh20-seq-resource/master/bh20sequploader/bh20seq-shex.rdf#submissionShape")
+
+ if not rslt:
+ print(reason)
+
+ return rslt
except Exception as e:
traceback.print_exc()
logging.warn(e)