[Python-modules-commits] [python-pyld] 114/276: Mark term as defined once IRI mapping is set.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:47:59 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository python-pyld.

commit 25675919f4788c3d8fe11117e9553bd48ccaf2fc
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Tue Apr 16 11:11:13 2013 -0400

    Mark term as defined once IRI mapping is set.
---
 lib/pyld/jsonld.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index d8a2bd1..a5e574c 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -3391,7 +3391,7 @@ class JsonLdProcessor:
                 'jsonld.SyntaxError', {'context': local_ctx})
 
         # create new mapping
-        mapping = {'reverse': False}
+        mapping = active_ctx['mappings'][term] = {'reverse': False}
 
         if '@reverse' in value:
             if '@id' in value or '@type' in value or '@language' in value:
@@ -3451,6 +3451,9 @@ class JsonLdProcessor:
                 # prepend vocab to term
                 mapping['@id'] = active_ctx['@vocab'] + term
 
+        # IRI mapping now defined
+        defined[term] = True
+
         if '@type' in value:
             type_ = value['@type']
             if not _is_string(type_):
@@ -3502,10 +3505,6 @@ class JsonLdProcessor:
                 'cannot be aliased.', 'jsonld.SyntaxError',
                 {'context': local_ctx})
 
-        # define term mapping
-        active_ctx['mappings'][term] = mapping
-        defined[term] = True
-
     def _expand_iri(
         self, active_ctx, value, base=False, vocab=False,
         local_ctx=None, defined=None):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pyld.git



More information about the Python-modules-commits mailing list