From 64075888db1aa2ef14964d756e5802215d2e99b2 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Thu, 16 Apr 2020 13:18:27 +1000 Subject: fixes Issue 1003, with tests --- rdflib/plugins/serializers/turtle.py | 3 +++ test/test_issue1003.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 test/test_issue1003.py diff --git a/rdflib/plugins/serializers/turtle.py b/rdflib/plugins/serializers/turtle.py index 1c58ba1b..6d31c579 100644 --- a/rdflib/plugins/serializers/turtle.py +++ b/rdflib/plugins/serializers/turtle.py @@ -291,6 +291,9 @@ class TurtleSerializer(RecursiveSerializer): def startDocument(self): self._started = True ns_list = sorted(self.namespaces.items()) + + if self.base: + self.write(self.indent() + '@base <%s> .\n' % self.base) for prefix, uri in ns_list: self.write(self.indent() + '@prefix %s: <%s> .\n' % (prefix, uri)) if ns_list and self._spacious: diff --git a/test/test_issue1003.py b/test/test_issue1003.py new file mode 100644 index 00000000..34a194a6 --- /dev/null +++ b/test/test_issue1003.py @@ -0,0 +1,28 @@ +from rdflib import Graph, Literal, Namespace, RDF, URIRef +from rdflib.namespace import SKOS, DCTERMS + +g = Graph() + +base = Namespace("http://example.org/") + +title = Literal("Title", lang="en") +description = Literal("Test Description", lang="en") +creator = URIRef("https://creator.com") +cs = URIRef("") + +g.add((cs, RDF.type, SKOS.ConceptScheme)) +g.add((cs, DCTERMS.creator, creator)) +g.add((cs, DCTERMS.source, URIRef("nick"))) + +# Bind a few prefix, namespace pairs for more readable output +g.bind("dct", DCTERMS) +g.bind("skos", SKOS) + +# this one should not have @base in the output +assert "@base" not in g.serialize(format='turtle').decode("utf-8") +# this one should have @base in the output +assert "@base" in g.serialize(format='turtle', base=base).decode("utf-8") + +# and same for N3 (same serializer used) +assert "@base" not in g.serialize(format='n3').decode("utf-8") +assert "@base" in g.serialize(format='n3', base=base).decode("utf-8") -- cgit v1.2.1 From 4aa55f0a4343a966bef1876704409415746a31f1 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Thu, 16 Apr 2020 13:38:47 +1000 Subject: remove style improvements from PR 1004 --- docs/_themes/armstrong/static/rtd.css_t | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/_themes/armstrong/static/rtd.css_t b/docs/_themes/armstrong/static/rtd.css_t index fe102205..f5f08642 100644 --- a/docs/_themes/armstrong/static/rtd.css_t +++ b/docs/_themes/armstrong/static/rtd.css_t @@ -779,8 +779,3 @@ p { } } - - -p.logo { - padding-top: 30px; -} \ No newline at end of file -- cgit v1.2.1 From a8a0d712d9d24be048fece3247bca32e394a5358 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Thu, 16 Apr 2020 13:40:14 +1000 Subject: Removing style changes in RP 1004 --- docs/index.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index b3f2b2d5..3f604729 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,8 +4,8 @@ rdflib |release| ================ -RDFLib is a pure Python package for working with `RDF `_. RDFLib contains useful APIs, -including: +RDFLib is a pure Python package for working with `RDF `_. RDFLib contains useful APIs for +working with RDF, including: * **Parsers & Serializers** @@ -29,7 +29,7 @@ including: Getting started --------------- -If you have never used RDFLib before, the following might help get you started: +If you have never used RDFLib, the following will help get you started: .. toctree:: :maxdepth: 1 @@ -45,7 +45,7 @@ If you have never used RDFLib before, the following might help get you started: In depth -------- -If you are already familiar with RDF and are looking for details about RDFLib handles RDF, these are for you. +If you are familiar with RDF and are looking for details on how RDFLib handles RDF, these are for you. .. toctree:: :maxdepth: 1 @@ -87,7 +87,7 @@ For developers univrdfstore persisting_n3_terms -Developers might also like to join rdflib's 'dev' mailing list: ``__ +Developers might also like to join rdflib's dev mailing list: ``__ The Code -- cgit v1.2.1 From 528a75febfed19e23731a306d57aa97dce0fc3a8 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Thu, 16 Apr 2020 14:57:47 +1000 Subject: improved handling of base, including at Graph() init --- rdflib/graph.py | 14 ++++++--- rdflib/plugins/serializers/turtle.py | 7 ++++- test/test_issue1003.py | 58 ++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 test/test_issue1003.py diff --git a/rdflib/graph.py b/rdflib/graph.py index efd58eba..a00730ce 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -293,8 +293,9 @@ class Graph(Node): For more on named graphs, see: http://www.w3.org/2004/03/trix/ """ - def __init__(self, store="default", identifier=None, namespace_manager=None): + def __init__(self, store="default", identifier=None, namespace_manager=None, base=None): super(Graph, self).__init__() + self.base = base self.__identifier = identifier or BNode() if not isinstance(self.__identifier, Node): @@ -952,14 +953,19 @@ class Graph(Node): Format support can be extended with plugins, but "xml", "n3", "turtle", "nt", "pretty-xml", "trix", "trig" and "nquads" are built in. """ + + # if a base is set here, use it, else if it was set at graph creation time, use that (self.base) + if base is not None: + self.base = base + serializer = plugin.get(format, Serializer)(self) if destination is None: stream = BytesIO() - serializer.serialize(stream, base=base, encoding=encoding, **args) + serializer.serialize(stream, base=self.base, encoding=encoding, **args) return stream.getvalue() if hasattr(destination, "write"): stream = destination - serializer.serialize(stream, base=base, encoding=encoding, **args) + serializer.serialize(stream, base=self.base, encoding=encoding, **args) else: location = destination scheme, netloc, path, params, _query, fragment = urlparse(location) @@ -970,7 +976,7 @@ class Graph(Node): return fd, name = tempfile.mkstemp() stream = os.fdopen(fd, "wb") - serializer.serialize(stream, base=base, encoding=encoding, **args) + serializer.serialize(stream, base=self.base, encoding=encoding, **args) stream.close() if hasattr(shutil, "move"): shutil.move(name, path) diff --git a/rdflib/plugins/serializers/turtle.py b/rdflib/plugins/serializers/turtle.py index 1c58ba1b..63f9da06 100644 --- a/rdflib/plugins/serializers/turtle.py +++ b/rdflib/plugins/serializers/turtle.py @@ -224,7 +224,9 @@ class TurtleSerializer(RecursiveSerializer): spacious=None, **args): self.reset() self.stream = stream - self.base = base + # if base is set here, override previously set base if set at graph init + if base is not None: + self.base = base if spacious is not None: self._spacious = spacious @@ -291,6 +293,9 @@ class TurtleSerializer(RecursiveSerializer): def startDocument(self): self._started = True ns_list = sorted(self.namespaces.items()) + + if self.base: + self.write(self.indent() + '@base <%s> .\n' % self.base) for prefix, uri in ns_list: self.write(self.indent() + '@prefix %s: <%s> .\n' % (prefix, uri)) if ns_list and self._spacious: diff --git a/test/test_issue1003.py b/test/test_issue1003.py new file mode 100644 index 00000000..99953ba9 --- /dev/null +++ b/test/test_issue1003.py @@ -0,0 +1,58 @@ +from rdflib import Graph, Literal, Namespace, RDF, URIRef +from rdflib.namespace import SKOS, DCTERMS + +""" +Testing scenarios: + 1. no base set + 2. base set at graph creation + 3. base set at serialization + 4. base set at both graph creation & serialization, serialization overrides +""" + +# variables +base = Namespace("http://example.org/") +title = Literal("Title", lang="en") +description = Literal("Test Description", lang="en") +creator = URIRef("https://creator.com") +cs = URIRef("") + +# starting graph +g = Graph() +g.add((cs, RDF.type, SKOS.ConceptScheme)) +g.add((cs, DCTERMS.creator, creator)) +g.add((cs, DCTERMS.source, URIRef("nick"))) +g.bind("dct", DCTERMS) +g.bind("skos", SKOS) + + +# 1. no base set +g1 = Graph() +g1 += g +# @base should not be in output +assert "@base" not in g.serialize(format='turtle').decode("utf-8") + + +# 2. base set at graph creation +g2 = Graph(base=base) +g2 += g +# @base should be in output +assert "@base" in g2.serialize(format='turtle').decode("utf-8") + + +# 3. base set at serialization +g3 = Graph() +g3 += g +# @base should be in output +assert "@base" in g3.serialize(format='turtle', base=base).decode("utf-8") + + +# 4. base set at both graph creation & serialization, serialization overrides +g4 = Graph(base=Namespace("http://nothing.com/")) +g4 += g + +# @base should be in output and it should be http://example.org/ (graph init copy) +assert "@base " in g4.serialize(format='turtle').decode("utf-8") +# @base should be in output and it should be http://example.org/, not http://nothing.com/ (serialization overwritten) +assert "@base " in g4.serialize(format='turtle', base=base).decode("utf-8") +# just checking that the graph init base isn't sneakily in output +assert "@base " not in g4.serialize(format='turtle', base=base).decode("utf-8") -- cgit v1.2.1 From 56d0d74c6becdfa22a193c98293314bd6ee9dde1 Mon Sep 17 00:00:00 2001 From: Nicholas Car Date: Thu, 16 Apr 2020 23:19:22 +1000 Subject: inverted precedence of base: graph wins over adding base to serialize(). Added RDF/XML, TriX & 1/2 TriG (incomplete) --- rdflib/graph.py | 21 ++++---- rdflib/plugins/serializers/rdfxml.py | 10 ++-- rdflib/plugins/serializers/trig.py | 8 ++- rdflib/plugins/serializers/trix.py | 6 +++ rdflib/plugins/serializers/turtle.py | 8 ++- test/test_issue1003.py | 95 +++++++++++++++++++++++++++++------- 6 files changed, 114 insertions(+), 34 deletions(-) diff --git a/rdflib/graph.py b/rdflib/graph.py index a00730ce..9868b097 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -954,18 +954,20 @@ class Graph(Node): but "xml", "n3", "turtle", "nt", "pretty-xml", "trix", "trig" and "nquads" are built in. """ - # if a base is set here, use it, else if it was set at graph creation time, use that (self.base) - if base is not None: - self.base = base + # if base is set for the graph use that, if not and a base is given here, use that + if self.base is not None: + base = self.base + else: + pass # i.e. base is set in this method serializer = plugin.get(format, Serializer)(self) if destination is None: stream = BytesIO() - serializer.serialize(stream, base=self.base, encoding=encoding, **args) + serializer.serialize(stream, base=base, encoding=encoding, **args) return stream.getvalue() if hasattr(destination, "write"): stream = destination - serializer.serialize(stream, base=self.base, encoding=encoding, **args) + serializer.serialize(stream, base=base, encoding=encoding, **args) else: location = destination scheme, netloc, path, params, _query, fragment = urlparse(location) @@ -976,7 +978,7 @@ class Graph(Node): return fd, name = tempfile.mkstemp() stream = os.fdopen(fd, "wb") - serializer.serialize(stream, base=self.base, encoding=encoding, **args) + serializer.serialize(stream, base=base, encoding=encoding, **args) stream.close() if hasattr(shutil, "move"): shutil.move(name, path) @@ -1657,13 +1659,13 @@ class Dataset(ConjunctiveGraph): .. versionadded:: 4.0 """ - def __init__(self, store="default", default_union=False): + def __init__(self, store="default", default_union=False, default_graph_base=None): super(Dataset, self).__init__(store=store, identifier=None) if not self.store.graph_aware: raise Exception("DataSet must be backed by a graph-aware store!") self.default_context = Graph( - store=self.store, identifier=DATASET_DEFAULT_GRAPH_ID + store=self.store, identifier=DATASET_DEFAULT_GRAPH_ID, base=default_graph_base ) self.default_union = default_union @@ -1674,7 +1676,7 @@ class Dataset(ConjunctiveGraph): ) return pattern % self.store.__class__.__name__ - def graph(self, identifier=None): + def graph(self, identifier=None, base=None): if identifier is None: from rdflib.term import rdflib_skolem_genid @@ -1684,6 +1686,7 @@ class Dataset(ConjunctiveGraph): identifier = BNode().skolemize() g = self._graph(identifier) + g.base = base self.store.add_graph(g) return g diff --git a/rdflib/plugins/serializers/rdfxml.py b/rdflib/plugins/serializers/rdfxml.py index 631c8fe0..0da1cccd 100644 --- a/rdflib/plugins/serializers/rdfxml.py +++ b/rdflib/plugins/serializers/rdfxml.py @@ -46,7 +46,11 @@ class XMLSerializer(Serializer): yield prefix, namespace def serialize(self, stream, base=None, encoding=None, **args): - self.base = base + # if base is set for the graph use that, if not and a base is given here, use that + if self.store.base is not None: + self.base = self.store.base + else: + self.base = base self.__stream = stream self.__serialized = {} encoding = self.encoding @@ -60,8 +64,8 @@ class XMLSerializer(Serializer): write(' ." in g2.serialize(format='turtle').decode("utf-8") -# 3. base set at serialization +# 3. no base set for graph, base two set for serialization g3 = Graph() g3 += g -# @base should be in output -assert "@base" in g3.serialize(format='turtle', base=base).decode("utf-8") +# @base should be in output, from serialization (two) +assert "@base ." in g3.serialize(format='turtle', base=base_two).decode("utf-8") -# 4. base set at both graph creation & serialization, serialization overrides -g4 = Graph(base=Namespace("http://nothing.com/")) +# 4. base one set for graph, base two set for serialization, Graph one overrides +g4 = Graph(base=base_one) g4 += g +# @base should be in output, from graph (one) +assert "@base ." in g4.serialize(format='turtle', base=base_two).decode("utf-8") +# just checking that the serialization setting (two) hasn't snuck through +assert "@base ." not in g4.serialize(format='turtle', base=base_two).decode("utf-8") -# @base should be in output and it should be http://example.org/ (graph init copy) -assert "@base " in g4.serialize(format='turtle').decode("utf-8") -# @base should be in output and it should be http://example.org/, not http://nothing.com/ (serialization overwritten) -assert "@base " in g4.serialize(format='turtle', base=base).decode("utf-8") -# just checking that the graph init base isn't sneakily in output -assert "@base " not in g4.serialize(format='turtle', base=base).decode("utf-8") + +# 5. multiple serialization side effect checking +g5 = Graph() +g5 += g +# @base should be in output, from serialization (two) +assert "@base ." in g5.serialize(format='turtle', base=base_two).decode("utf-8") + +# checking for side affects - no base now set for this serialization +# @base should not be in output +assert "@base" not in g5.serialize(format='turtle').decode("utf-8") + + +# 6. checking results for RDF/XML +g6 = Graph() +g6 += g +g6.bind("dct", DCTERMS) +g6.bind("skos", SKOS) +assert "@xml:base" not in g6.serialize(format='xml').decode("utf-8") +assert 'xml:base="http://one.org/"' in g6.serialize(format='xml', base=base_one).decode("utf-8") +g6.base = base_two +assert 'xml:base="http://two.org/"' in g6.serialize(format='xml').decode("utf-8") +assert 'xml:base="http://two.org/"' in g6.serialize(format='xml', base=base_one).decode("utf-8") + +# 7. checking results for N3 +g7 = Graph() +g7 += g +g7.bind("dct", DCTERMS) +g7.bind("skos", SKOS) +assert "@xml:base" not in g7.serialize(format='xml').decode("utf-8") +assert "@base ." in g7.serialize(format='n3', base=base_one).decode("utf-8") +g7.base = base_two +assert "@base ." in g7.serialize(format='n3').decode("utf-8") +assert "@base ." in g7.serialize(format='n3', base=base_one).decode("utf-8") + +# 8. checking results for TriX & TriG +# TriX can specify a base per graph but setting a base for the whole +base_three = Namespace("http://three.org/") +ds1 = Dataset() +ds1.bind("dct", DCTERMS) +ds1.bind("skos", SKOS) +g8 = ds1.graph(URIRef('http://g8.com/'), base=base_one) +g9 = ds1.graph(URIRef('http://g9.com/')) +g8 += g +g9 += g +g9.base = base_two +ds1.base = base_three + +trix = ds1.serialize(format='trix', base=Namespace("http://two.org/")).decode("utf-8") +assert '' in trix +assert '' in trix +assert ' .' not in trig +assert '@base .' not in trig +assert '@base .' in trig -- cgit v1.2.1 From 308abf72f7fb6e8b198c8be8d2683806f5f7a6cd Mon Sep 17 00:00:00 2001 From: Natanael Arndt Date: Fri, 17 Apr 2020 13:38:38 +0200 Subject: Let argument of serialize method overwrite graph settings --- rdflib/graph.py | 16 ++++++++-------- rdflib/plugins/serializers/rdfxml.py | 20 ++++++++++++++------ rdflib/plugins/serializers/trig.py | 8 ++++---- rdflib/plugins/serializers/trix.py | 3 ++- rdflib/plugins/serializers/turtle.py | 8 ++++---- test/test_issue1003.py | 14 +++++++------- 6 files changed, 39 insertions(+), 30 deletions(-) diff --git a/rdflib/graph.py b/rdflib/graph.py index 9868b097..80dc02f8 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -954,11 +954,9 @@ class Graph(Node): but "xml", "n3", "turtle", "nt", "pretty-xml", "trix", "trig" and "nquads" are built in. """ - # if base is set for the graph use that, if not and a base is given here, use that - if self.base is not None: + # if base is not given as attribute use the base set for the graph + if base is None: base = self.base - else: - pass # i.e. base is set in this method serializer = plugin.get(format, Serializer)(self) if destination is None: @@ -1344,14 +1342,16 @@ class ConjunctiveGraph(Graph): All queries are carried out against the union of all graphs. """ - def __init__(self, store="default", identifier=None): + def __init__(self, store="default", identifier=None, default_graph_base=None): super(ConjunctiveGraph, self).__init__(store, identifier=identifier) assert self.store.context_aware, ( "ConjunctiveGraph must be backed by" " a context aware store." ) self.context_aware = True self.default_union = True # Conjunctive! - self.default_context = Graph(store=self.store, identifier=identifier or BNode()) + self.default_context = Graph( + store=self.store, identifier=identifier or BNode(), base=default_graph_base + ) def __str__(self): pattern = ( @@ -1491,12 +1491,12 @@ class ConjunctiveGraph(Graph): else: yield self.get_context(context) - def get_context(self, identifier, quoted=False): + def get_context(self, identifier, quoted=False, base=None): """Return a context graph for the given identifier identifier must be a URIRef or BNode. """ - return Graph(store=self.store, identifier=identifier, namespace_manager=self) + return Graph(store=self.store, identifier=identifier, namespace_manager=self, base=base) def remove_context(self, context): """Removes the given context from the graph""" diff --git a/rdflib/plugins/serializers/rdfxml.py b/rdflib/plugins/serializers/rdfxml.py index 0da1cccd..4242fc05 100644 --- a/rdflib/plugins/serializers/rdfxml.py +++ b/rdflib/plugins/serializers/rdfxml.py @@ -46,11 +46,11 @@ class XMLSerializer(Serializer): yield prefix, namespace def serialize(self, stream, base=None, encoding=None, **args): - # if base is set for the graph use that, if not and a base is given here, use that - if self.store.base is not None: - self.base = self.store.base - else: + # if base is given here, use that, if not and a base is set for the graph use that + if base is not None: self.base = base + elif self.store.base is not None: + self.base = self.store.base self.__stream = stream self.__serialized = {} encoding = self.encoding @@ -64,7 +64,9 @@ class XMLSerializer(Serializer): write(' 0, "max_depth must be greater than 0" @@ -188,6 +194,8 @@ class PrettyXMLSerializer(Serializer): if "xml_base" in args: writer.attribute(XMLBASE, args["xml_base"]) + elif self.base: + writer.attribute(XMLBASE, self.base) writer.namespaces(namespaces.items()) diff --git a/rdflib/plugins/serializers/trig.py b/rdflib/plugins/serializers/trig.py index 2cfc2145..250e1c09 100644 --- a/rdflib/plugins/serializers/trig.py +++ b/rdflib/plugins/serializers/trig.py @@ -49,11 +49,11 @@ class TrigSerializer(TurtleSerializer): spacious=None, **args): self.reset() self.stream = stream - # if base is set for the graph use that, if not and a base is given here, use that - if self.store.base is not None: - self.base = self.store.base - else: + # if base is given here, use that, if not and a base is set for the graph use that + if base is not None: self.base = base + elif self.store.base is not None: + self.base = self.store.base if spacious is not None: self._spacious = spacious diff --git a/rdflib/plugins/serializers/trix.py b/rdflib/plugins/serializers/trix.py index f3477eab..0a574493 100644 --- a/rdflib/plugins/serializers/trix.py +++ b/rdflib/plugins/serializers/trix.py @@ -29,7 +29,8 @@ class TriXSerializer(Serializer): self.writer = XMLWriter(stream, nm, encoding, extra_ns={"": TRIXNS}) self.writer.push(TRIXNS[u"TriX"]) - if self.store.base: + # if base is given here, use that, if not and a base is set for the graph use that + if base is None and self.store.base is not None: base = self.store.base if base is not None: self.writer.attribute("http://www.w3.org/XML/1998/namespacebase", base) diff --git a/rdflib/plugins/serializers/turtle.py b/rdflib/plugins/serializers/turtle.py index b7f50087..8a41587c 100644 --- a/rdflib/plugins/serializers/turtle.py +++ b/rdflib/plugins/serializers/turtle.py @@ -224,11 +224,11 @@ class TurtleSerializer(RecursiveSerializer): spacious=None, **args): self.reset() self.stream = stream - # if base is set for the graph use that, if not and a base is given here, use that - if self.store.base is not None: - self.base = self.store.base - else: + # if base is given here, use that, if not and a base is set for the graph use that + if base is not None: self.base = base + elif self.store.base is not None: + self.base = self.store.base if spacious is not None: self._spacious = spacious diff --git a/test/test_issue1003.py b/test/test_issue1003.py index 883022a7..fdc56c82 100644 --- a/test/test_issue1003.py +++ b/test/test_issue1003.py @@ -55,9 +55,9 @@ assert "@base ." in g3.serialize(format='turtle', base=base_tw g4 = Graph(base=base_one) g4 += g # @base should be in output, from graph (one) -assert "@base ." in g4.serialize(format='turtle', base=base_two).decode("utf-8") +assert "@base ." in g4.serialize(format='turtle', base=base_two).decode("utf-8") # just checking that the serialization setting (two) hasn't snuck through -assert "@base ." not in g4.serialize(format='turtle', base=base_two).decode("utf-8") +assert "@base ." not in g4.serialize(format='turtle', base=base_two).decode("utf-8") # 5. multiple serialization side effect checking @@ -80,7 +80,7 @@ assert "@xml:base" not in g6.serialize(format='xml').decode("utf-8") assert 'xml:base="http://one.org/"' in g6.serialize(format='xml', base=base_one).decode("utf-8") g6.base = base_two assert 'xml:base="http://two.org/"' in g6.serialize(format='xml').decode("utf-8") -assert 'xml:base="http://two.org/"' in g6.serialize(format='xml', base=base_one).decode("utf-8") +assert 'xml:base="http://one.org/"' in g6.serialize(format='xml', base=base_one).decode("utf-8") # 7. checking results for N3 g7 = Graph() @@ -91,7 +91,7 @@ assert "@xml:base" not in g7.serialize(format='xml').decode("utf-8") assert "@base ." in g7.serialize(format='n3', base=base_one).decode("utf-8") g7.base = base_two assert "@base ." in g7.serialize(format='n3').decode("utf-8") -assert "@base ." in g7.serialize(format='n3', base=base_one).decode("utf-8") +assert "@base ." in g7.serialize(format='n3', base=base_one).decode("utf-8") # 8. checking results for TriX & TriG # TriX can specify a base per graph but setting a base for the whole @@ -109,9 +109,9 @@ ds1.base = base_three trix = ds1.serialize(format='trix', base=Namespace("http://two.org/")).decode("utf-8") assert '' in trix assert '' in trix -assert ' .' not in trig -assert '@base .' not in trig -assert '@base .' in trig +assert '@base .' not in trig +assert '@base .' in trig -- cgit v1.2.1