From 39164d62eb9b550c3305ce9f6eabe4f2c4ace3f5 Mon Sep 17 00:00:00 2001 From: Paco Nathan Date: Wed, 20 Apr 2022 09:11:14 -0700 Subject: [PATCH] minor fixes to resolve warnings; prep release --- README.md | 22 ++++++++++++---------- changelog.txt | 3 ++- kglab/graph.py | 8 ++++---- kglab/kglab.py | 7 ++++--- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1b08dac..8c6ae5c 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,17 @@ For detailed instructions please see: +
+ License and Copyright + +Source code for **kglab** plus its logo, documentation, and examples +have an [MIT license](https://spdx.org/licenses/MIT.html) which is +succinct and simplifies use in commercial applications. + +All materials herein are Copyright © 2020-2022 Derwen, Inc. +
+ +
Attribution Please use the following BibTeX entry for citing **kglab** if you use @@ -177,6 +188,7 @@ this library. ```
+ illustration of a knowledge graph, plus laboratory glassware -## License and Copyright - -Source code for **kglab** plus its logo, documentation, and examples -have an [MIT license](https://spdx.org/licenses/MIT.html) which is -succinct and simplifies use in commercial applications. - -All materials herein are Copyright © 2020-2022 Derwen, Inc. - - ## Kudos Many thanks to our open source [sponsors](https://github.com/sponsors/ceteri); @@ -228,4 +231,3 @@ and alt="kglab contributors" src="https://contributors-img.web.app/image?repo=derwenai/kglab" /> - diff --git a/changelog.txt b/changelog.txt index 55a3f96..cf437c4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,10 +2,11 @@ ## 0.6.1 -2022-04-?? +2022-04-20 * automated RDF tests, coordinated with `Oxigraph`; kudos @Mec-iS, @Tpt * begin refactoring `KnowledgeGraph` as abstract classes, per #237 + * update to Morph-KGC 2.0.0 and update links to the new documentation; kudos @ArenasGuerreroJulian ## 0.6.0 diff --git a/kglab/graph.py b/kglab/graph.py index a2a30a3..6a46e26 100644 --- a/kglab/graph.py +++ b/kglab/graph.py @@ -55,8 +55,8 @@ def __init__ ( self.__prefix: dict = {} self._tuples: list = [] - self._node_names: np.array = np.empty(shape=[0, 1], dtype=object) - self._rel_names: np.array = np.empty(shape=[0, 1], dtype=object) + self._node_names: np.array = np.empty(shape=[0, 1], dtype=object) # type: ignore + self._rel_names: np.array = np.empty(shape=[0, 1], dtype=object) # type: ignore ###################################################################### @@ -101,7 +101,7 @@ def get_node_name ( An accessor method to map from the `node_id` index of a node to its unique name. """ - return self._node_names[node_id] + return self._node_names[node_id] # type: ignore def get_rel_id ( @@ -131,7 +131,7 @@ def get_rel_name ( An accessor method to map from the `rel_id` index of a relation to its unique name. """ - return self._rel_names[rel_id] + return self._rel_names[rel_id] # type: ignore def build_tuple ( diff --git a/kglab/kglab.py b/kglab/kglab.py index 33c35c2..d7dd11d 100644 --- a/kglab/kglab.py +++ b/kglab/kglab.py @@ -835,7 +835,7 @@ def load_parquet ( df.apply( lambda row: self._g.parse( - data="{} {} {} .".format(row[0], row[1], row[2]), + data=f"{ row[0] } { row[1] } { row[2] } .", format="ttl", ), axis=1, @@ -1211,11 +1211,12 @@ def unbind_sparql ( sparql_meta, sparql_body = re.split(r"\s*WHERE\s*\{", sparql, maxsplit=1) for var in sorted(bindings.keys(), key=lambda x: len(x), reverse=True): # pylint: disable=W0108 - pattern = re.compile("(\?" + var + ")(\W)") # pylint: disable=W1401 + pattern = re.compile(r"(\?" + var + r")(\W)") # pylint: disable=W1401 bind_val = "<" + str(bindings[var]) + ">\\2" sparql_body = re.sub(pattern, bind_val, sparql_body) - return "".join([preamble, sparql_meta, " WHERE {", sparql_body]).strip() + result = "".join([preamble, sparql_meta, " WHERE {", sparql_body]).strip() + return result ######################################################################