Skip to content

Commit eeae6ac

Browse files
committed
Remove 'format=' parameter from graph parse() and serialize() calls
rdflib 6.0.0 improved filename-based format recognition. (Tests for recognition were upgraded to support JSON-LD in PR 1408.) This patch removes explicit-but-redundant functionality. References: * RDFLib/rdflib#1408 Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
1 parent ce43114 commit eeae6ac

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

case_utils/case_sparql_construct/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def main():
4141

4242
in_graph = rdflib.Graph()
4343
for in_graph_filename in args.in_graph:
44-
in_graph.parse(in_graph_filename, format=case_utils.guess_format(in_graph_filename))
44+
in_graph.parse(in_graph_filename)
4545
_logger.debug("len(in_graph) = %d.", len(in_graph))
4646

4747
out_graph = rdflib.Graph()

case_utils/case_sparql_select/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def main():
5555

5656
graph = rdflib.Graph()
5757
for in_graph_filename in args.in_graph:
58-
graph.parse(in_graph_filename, format=case_utils.guess_format(in_graph_filename))
58+
graph.parse(in_graph_filename)
5959

6060
# Inherit prefixes defined in input context dictionary.
6161
nsdict = {k:v for (k,v) in graph.namespace_manager.namespaces()}

tests/case_file/test_case_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
def load_graph(filename):
4141
in_graph = rdflib.Graph()
42-
in_graph.parse(filename, format=rdflib.util.guess_format(filename))
42+
in_graph.parse(filename)
4343
return in_graph
4444

4545
@pytest.fixture

tests/case_sparql_construct/test_case_sparql_construct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _test_templates_with_blank_nodes_result(filename):
2323
ground_truth_negative = set()
2424

2525
graph = rdflib.Graph()
26-
graph.parse(filename, format=case_utils.guess_format(filename))
26+
graph.parse(filename)
2727

2828
computed = set()
2929
query_string = """\

tests/src/glom_graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
def main():
2525
g = rdflib.Graph()
2626
for in_graph in args.in_graph:
27-
g.parse(in_graph, format=case_utils.guess_format(in_graph))
28-
g.serialize(args.out_graph, format=case_utils.guess_format(args.out_graph))
27+
g.parse(in_graph)
28+
g.serialize(args.out_graph)
2929

3030
if __name__ == "__main__":
3131
import argparse

tests/src/isomorphic_diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def main():
5252
g1 = rdflib.Graph()
5353
g2 = rdflib.Graph()
5454

55-
g1.parse(args.in_graph_1, format=case_utils.guess_format(args.in_graph_1))
56-
g2.parse(args.in_graph_2, format=case_utils.guess_format(args.in_graph_2))
55+
g1.parse(args.in_graph_1)
56+
g2.parse(args.in_graph_2)
5757

5858
#_logger.debug("type(g1) = %r.", type(g1))
5959
#_logger.debug("type(g2) = %r.", type(g2))

0 commit comments

Comments
 (0)