[Python-modules-commits] [python-pyld] 160/276: Exclude blank node predicates unless producing generalized RDF.
Wolfgang Borgert
debacle at moszumanska.debian.org
Wed Oct 8 23:48:05 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 03ae48c1974f2c7382549088109c5fbac7bfc6f6
Author: Dave Longley <dlongley at digitalbazaar.com>
Date: Tue Aug 6 14:02:03 2013 -0400
Exclude blank node predicates unless producing generalized RDF.
---
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 5177591..5752143 100644
--- a/lib/pyld/jsonld.py
+++ b/lib/pyld/jsonld.py
@@ -771,7 +771,7 @@ class JsonLdProcessor:
# expand input
expanded = self.expand(input_, options)
except JsonLdError as cause:
- raise JsonLdError('Could not expand input before conversion to '
+ raise JsonLdError('Could not expand input before serialization to '
'RDF.', 'jsonld.RdfError', None, cause)
# create node map for default graph (and any named graphs)
@@ -782,7 +782,7 @@ class JsonLdProcessor:
# output RDF dataset
dataset = {}
for graph_name, graph in sorted(node_map.items()):
- dataset[graph_name] = self._graph_to_rdf(graph, namer)
+ dataset[graph_name] = self._graph_to_rdf(graph, namer, options)
# convert to output format
if 'format' in options:
@@ -1998,7 +1998,7 @@ class JsonLdProcessor:
Converts an RDF dataset to JSON-LD.
:param dataset: the RDF dataset.
- :param options: the RDF conversion options.
+ :param options: the RDF serialization options.
:return: the JSON-LD output.
"""
@@ -2312,6 +2312,7 @@ class JsonLdProcessor:
:param graph: the graph to create RDF triples for.
:param namer: the UniqueNamer for assigning blank node names.
+ :param options: the RDF serialization options.
:return: the array of RDF triples for the given graph.
"""
@@ -2335,6 +2336,9 @@ class JsonLdProcessor:
# RDF predicate
predicate = {}
if property.startswith('_:'):
+ # skip bnode predicates unless producing generalized RDF
+ if not options['produceGeneralizedRdf']:
+ continue
predicate['type'] = 'blank node'
else:
predicate['type'] = 'IRI'
--
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