[Python-modules-commits] [python-pyld] 52/276: Use keyword alias in compact output.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:47:52 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 c4742e316e6fbb3e1820e7429e6f5237f346d880
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Thu Jan 12 13:40:42 2012 -0500

    Use keyword alias in compact output.
---
 lib/pyld/jsonld.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib/pyld/jsonld.py b/lib/pyld/jsonld.py
index d5bc717..76d750c 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -119,9 +119,13 @@ def _compactIri(ctx, iri, usedCtx):
                     usedCtx[key] = copy.copy(ctx[key])
                 break
 
-    # term not found, if term is @type, use keyword
-    if rval is None and iri == '@type':
-        rval = _getKeywords(ctx)['@type']
+    # term not found, if term is keyword, use alias
+    if rval is None:
+        keywords = _getKeywords(ctx)
+        if iri in keywords:
+            rval = keywords[iri]
+            if rval != iri and usedCtx is not None:
+                usedCtx[key] = iri
 
     # term not found, check the context for a term prefix
     if rval is 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