Skip to content

Commit

Permalink
Remove 'format=' parameter from graph parse() and serialize() calls
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
ajnelson-nist committed Sep 28, 2021
1 parent ce43114 commit eeae6ac
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion case_utils/case_sparql_construct/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def main():

in_graph = rdflib.Graph()
for in_graph_filename in args.in_graph:
in_graph.parse(in_graph_filename, format=case_utils.guess_format(in_graph_filename))
in_graph.parse(in_graph_filename)
_logger.debug("len(in_graph) = %d.", len(in_graph))

out_graph = rdflib.Graph()
Expand Down
2 changes: 1 addition & 1 deletion case_utils/case_sparql_select/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def main():

graph = rdflib.Graph()
for in_graph_filename in args.in_graph:
graph.parse(in_graph_filename, format=case_utils.guess_format(in_graph_filename))
graph.parse(in_graph_filename)

# Inherit prefixes defined in input context dictionary.
nsdict = {k:v for (k,v) in graph.namespace_manager.namespaces()}
Expand Down
2 changes: 1 addition & 1 deletion tests/case_file/test_case_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

def load_graph(filename):
in_graph = rdflib.Graph()
in_graph.parse(filename, format=rdflib.util.guess_format(filename))
in_graph.parse(filename)
return in_graph

@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/case_sparql_construct/test_case_sparql_construct.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _test_templates_with_blank_nodes_result(filename):
ground_truth_negative = set()

graph = rdflib.Graph()
graph.parse(filename, format=case_utils.guess_format(filename))
graph.parse(filename)

computed = set()
query_string = """\
Expand Down
4 changes: 2 additions & 2 deletions tests/src/glom_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
def main():
g = rdflib.Graph()
for in_graph in args.in_graph:
g.parse(in_graph, format=case_utils.guess_format(in_graph))
g.serialize(args.out_graph, format=case_utils.guess_format(args.out_graph))
g.parse(in_graph)
g.serialize(args.out_graph)

if __name__ == "__main__":
import argparse
Expand Down
4 changes: 2 additions & 2 deletions tests/src/isomorphic_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def main():
g1 = rdflib.Graph()
g2 = rdflib.Graph()

g1.parse(args.in_graph_1, format=case_utils.guess_format(args.in_graph_1))
g2.parse(args.in_graph_2, format=case_utils.guess_format(args.in_graph_2))
g1.parse(args.in_graph_1)
g2.parse(args.in_graph_2)

#_logger.debug("type(g1) = %r.", type(g1))
#_logger.debug("type(g2) = %r.", type(g2))
Expand Down

0 comments on commit eeae6ac

Please sign in to comment.