Updates to jsonld context for the DCC schemas.
[htsworkflow.git] / htsworkflow / submission / encoded.py
index 1228d387f015a39a9da12c8ad5ca296d218c68de..04aff707166e20956d18e69add164b7e3c989f99 100644 (file)
@@ -10,9 +10,8 @@ import logging
 import json
 import jsonschema
 import requests
-from requests.utils import urlparse, urlunparse
 import types
-from urlparse import urljoin
+from urlparse import urljoin, urlparse, urlunparse
 
 LOGGER = logging.getLogger(__name__)
 
@@ -21,13 +20,17 @@ ENCODED_CONTEXT = {
     # provide common defaults.
     None: {
         # terms in multiple encoded objects
+        'award': { '@type': '@id' },
+        'dataset': {'@type': '@id'},
         'description': 'rdf:description',
+        'documents': { '@type': '@id' },
         'experiment': {'@type': '@id'},
         'href': { '@type': '@id' },
         'lab': { '@type': '@id' },
         'library': {'@type': '@id' },
         'pi': { '@type': '@id' },
         'platform': { '@type': '@id' },
+        'replicates': { '@type': '@id' },
         'submitted_by': { '@type': '@id' },
         'url': { '@type': '@id' },
     },
@@ -40,9 +43,8 @@ ENCODED_CONTEXT = {
     },
     'experiment': {
         "assay_term_id": { "@type": "@id" },
-    },
-    'file': {
-        'dataset': {'@type': '@id'},
+        "files": { "@type": "@id" },
+        "original_files": { "@type": "@id"},
     },
     # I tried to use the JSON-LD mapping capabilities to convert the lab
     # contact information into a vcard record, but the encoded model
@@ -54,11 +56,7 @@ ENCODED_CONTEXT = {
     #    "state": "vcard:region",
     #    "country": "vcard:country"
     #},
-    'human_donor': {
-        'award': { '@type': '@id' },
-    },
     'library': {
-        'award': { '@type': '@id' },
         'nucleic_acid_term_id': { '@type': '@id' }
     }
 }
@@ -82,6 +80,7 @@ ENCODED_NAMESPACES = {
     # OBI: available from http://svn.code.sf.net/p/obi/code/releases/2012-07-01/merged/merged-obi-comments.owl
     'SO': 'http://purl.obolibrary.org/obo/SO_', # Sequence ontology
     # SO: available from http://www.berkeleybop.org/ontologies/so.owl
+    # NTR: New Term Request space for DCC to implement new ontology terms
 
 }
 
@@ -271,7 +270,7 @@ class ENCODED:
         # clean up potentially messy urls
         url = urlparse(request_url)._asdict()
         if not url['scheme']:
-            url['scheme'] = 'http'
+            url['scheme'] = 'https'
         if not url['netloc']:
             url['netloc'] = self.server
         url = urlunparse(url.values())