From 63f300c2153ed283c45422f78eb7be274898f6bd Mon Sep 17 00:00:00 2001 From: "Lorenzo (Mec-iS)" Date: Sat, 29 Oct 2022 11:25:39 +0100 Subject: [PATCH] Fix error with LIMIT clause in gpviz --- kglab/gpviz.py | 2 ++ tests/test_gpviz.py | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/test_gpviz.py diff --git a/kglab/gpviz.py b/kglab/gpviz.py index 5f380d1..7e948c3 100644 --- a/kglab/gpviz.py +++ b/kglab/gpviz.py @@ -34,6 +34,8 @@ class GPViz: "lazy", "service_string", "term", + "start", # used by LIMIT + "length" # used by LIMIT ] # colorcet glasbey_category10 first 16 colors diff --git a/tests/test_gpviz.py b/tests/test_gpviz.py new file mode 100644 index 0000000..7046dbb --- /dev/null +++ b/tests/test_gpviz.py @@ -0,0 +1,26 @@ +from .test_querying import kg_test_data + +import kglab + +from .__init__ import DAT_FILES_DIR + +QUERY1 = """ +SELECT ?recipe ?definition + WHERE { + ?recipe rdf:type wtm:Recipe . + ?recipe skos:definition ?definition . + ?recipe wtm:hasIngredient ind:ChickenEgg . + ?recipe wtm:hasIngredient ind:AllPurposeFlour . + ?recipe wtm:hasIngredient ind:Salt . + ?recipe wtm:hasIngredient ind:VanillaExtract + } + LIMIT 2 +""" + +def test_gpviz(kg_test_data): + try: + kg_test_data.visualize_query(QUERY1) + except: + assert False + + assert True \ No newline at end of file