[Python-modules-commits] [python-pyld] 10/276: Fixes to pass property CURIE conflict during compact.

Wolfgang Borgert debacle at moszumanska.debian.org
Wed Oct 8 23:47:48 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 3d1f424ab6f6c902da3800c8dbe409ec50e39528
Author: Dave Longley <dlongley at digitalbazaar.com>
Date:   Fri Jul 29 16:02:45 2011 -0400

    Fixes to pass property CURIE conflict during compact.
---
 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 52ca4a8..21cbc59 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -237,7 +237,9 @@ def _compact(ctx, property, value, usedCtx):
     rval = None
 
     if value is None:
+        # return None, but check coerce type to add to usedCtx
         rval = None
+        _getCoerceType(ctx, property, usedCtx)
     elif isinstance(value, list):
         # recursively add compacted values to array
         rval = []
@@ -255,9 +257,11 @@ def _compact(ctx, property, value, usedCtx):
         rval = {}
         for key in value:
             if value[key] != '@context':
-                # set object to compacted property
-                _setProperty(rval, _compactIri(ctx, key, usedCtx),
-                    _compact(ctx, key, value[key], usedCtx))
+                # set object to compacted property, only overwrite existing
+                # properties if the property actually compacted
+                p = _compactIri(ctx, key, usedCtx)
+                if p != key or p not in rval:
+                   rval[p] = _compact(ctx, key, value[key], usedCtx)
     else:
         # get coerce type
         coerce = _getCoerceType(ctx, property, usedCtx)

-- 
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