Skip to content

Commit

Permalink
minor fixes to resolve warnings; prep release
Browse files Browse the repository at this point in the history
  • Loading branch information
ceteri committed Apr 20, 2022
1 parent ba68a0f commit 39164d6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,17 @@ For detailed instructions please see:
</details>


<details>
<summary>License and Copyright</summary>

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 &copy; 2020-2022 Derwen, Inc.
</details>


<details>
<summary>Attribution</summary>
Please use the following BibTeX entry for citing **kglab** if you use
Expand All @@ -177,22 +188,14 @@ this library.
```
</details>


<img
alt="illustration of a knowledge graph, plus laboratory glassware"
src="https://raw.githubusercontent.com/DerwenAI/kglab/main/docs/assets/logo.png"
width="231"
/>


## 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 &copy; 2020-2022 Derwen, Inc.


## Kudos

Many thanks to our open source [sponsors](https://github.com/sponsors/ceteri);
Expand Down Expand Up @@ -228,4 +231,3 @@ and
alt="kglab contributors"
src="https://contributors-img.web.app/image?repo=derwenai/kglab"
/>

3 changes: 2 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions kglab/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


######################################################################
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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 (
Expand Down
7 changes: 4 additions & 3 deletions kglab/kglab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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


######################################################################
Expand Down

0 comments on commit 39164d6

Please sign in to comment.