Skip to content

Commit f1bbd3d

Browse files
committed
first pass, with @Turboman and @wdduncan
0 parents  commit f1bbd3d

File tree

13 files changed

+897
-0
lines changed

13 files changed

+897
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior.
15+
16+
**Expected behavior**
17+
A clear and concise description of what you expected to happen.
18+
19+
**Code snippets**
20+
If applicable, code snippets to reproduce this behavior.
21+
22+
**Additional context**
23+
Add any other context about the problem here.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context about the feature request here.

.github/workflows/run_tests.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Run tests
4+
5+
# Controls when the action will run.
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the master branch
8+
push:
9+
branches: [ master ]
10+
pull_request:
11+
types: [opened, synchronize, reopened]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
types: trigger-run-tests
16+
17+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
18+
jobs:
19+
# This workflow contains a single job called "build"
20+
build:
21+
# The type of runner that the job will run on
22+
runs-on: ubuntu-latest
23+
24+
# Steps represent a sequence of tasks that will be executed as part of the job
25+
steps:
26+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
27+
- uses: actions/checkout@v2
28+
29+
- uses: actions/setup-python@v2
30+
name: setup python environment
31+
with:
32+
python-version: 3.7
33+
34+
35+
- name: Install dependencies
36+
run: |
37+
pip install -r requirements.txt
38+
pip install pytest pytest-cov
39+
40+
- name: Setup Neo4j Docker
41+
run: |
42+
docker run --detach --name kgx-neo4j-unit-test -p 8484:7474 -p 8888:7687 --env NEO4J_AUTH=neo4j/test neo4j:3.5.19
43+
docker run --detach --name kgx-neo4j-integration-test -p 7474:7474 -p 7687:7687 --env NEO4J_AUTH=neo4j/test neo4j:3.5.19
44+
docker ps -a
45+
46+
- name: Wait
47+
uses: jakejarvis/wait-action@master
48+
with:
49+
time: '45s'
50+
51+
- name: Run tests
52+
run: |
53+
coverage erase
54+
pytest --cov=kgx --cov-report xml:coverage.xml tests/*
55+
coverage combine --append || true
56+
coverage report
57+
coverage xml
58+
59+
- name: SonarCloud Scan
60+
uses: SonarSource/sonarcloud-github-action@master
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
63+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

CHANGELOG.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Changelog
2+
3+
## 1.0.0b0 - (2021-03-11)
4+
5+
- Fixed caching bug in RdfSource
6+
- Fixed bug when setting 'provided_by' for a source
7+
8+
9+
## 1.0.0a0 - (2021-03-04)
10+
11+
- Added Source implementation for reading from various data stores
12+
- Added Sink implementation for writing to various data stores
13+
- Added a simplified Transformer that is agnostic
14+
- Refactor KGX to make use of Sources and Sinks
15+
- Added ability to stream graphs (Thanks to @gregr for the inspiration)
16+
17+
18+
## 0.5.0 - (2021-02-23)
19+
20+
- This is the final release on the 0.x.x
21+
- Added ability to assign a default category in SssomTransformer when the incoming category is invalid
22+
- Added the ability to generate different types of graph summary reports
23+
24+
25+
## 0.4.0 - (2021-02-08)
26+
27+
- Fixed a bug in NtTransformer when parsing malformed triples
28+
- Added a transformer for parsing SSSOM
29+
- Added ability to fold predicates to node properties
30+
- Added ability to unfold node properties to predicates
31+
- Added ability to remove singleton nodes from a graph
32+
- Fixed bug in KGX CLI transform operation that prevented stack trace from showing up
33+
- Unified the way predicates are parsed across different transformers
34+
- Added ability to annotate edges with OWLStar vocabulary in RdfOwlTransformer
35+
36+
37+
## 0.3.1 - (2021-01-20)
38+
39+
- Fixed a bug that led to import errors
40+
- Fixed column ordering when exporting CSV/TSV
41+
- Added ability to generate a TRAPI knowledge map for a graph
42+
- Fixed bug in ObographJsonTransformer when inferring node category
43+
44+
45+
## 0.3.0 - (2020-12-21)
46+
47+
- Added Graph API to KGX
48+
- Added compatibility to Biolink Model 1.4.0
49+
- Added the ability to facet on node and edge properties for graph-summary CLI operation
50+
- Fixed a bug where source name defined in YAML was not being used for graph name
51+
52+
53+
## 0.2.4 - (2020-11-25)
54+
55+
- Fixed bug when handling empty elements returned from bmt
56+
- Fixed bug in CLI when setting property types in RdfTransformer
57+
- Fixed bug when reifying edges on export in RdfTransformer
58+
59+
## 0.2.3 - (2020-11-04)
60+
61+
- Updated requirements.txt
62+
- Added a Dockerfile
63+
64+
## 0.2.2 - (2020-11-04)
65+
66+
- Made get_toolkit method configurable
67+
- Use proper input format when parsing OWL via CLI
68+
- Switched default parsing format from CSV to TSV
69+
- Fixed bug with spawning processes when transforming source
70+
- Fixed parsing of xrefs from from OBOGraph JSON
71+
72+
## 0.2.1 - (2020-11-04)
73+
74+
## 0.2.0 - (2020-10-20)
75+
76+
- Improved clique merge operation and addded support for strict and relaxed mode
77+
- Fixed a major bug while merging lists during graph merge operation
78+
- Fixed a bug in neo4j-download CLI
79+
- Updated the merge and transform YAML format
80+
- Added support for parsing and exporting jsonlines
81+
- KGX now assigns UUID for edges that don't have and id
82+
- Updated documentation
83+
84+
## 0.1.0 - (2020-09-10)
85+
86+
- Initial release

CODE_OF_CONDUCT.md

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Contributing Guidelines
2+
3+
Welcome contributors! KGX is a open-source project built for addressing the challenges of working knowledge graphs and
4+
its various serializations. We welcome your suggestions, discussions and contributions to this project.
5+
6+
7+
## Getting started
8+
9+
Before you get started please be sure to review the [Contributing Guidelines](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).
10+
11+
### Developing
12+
13+
Take a look at the project's [README.md](README.md) for instructions on setting up a dev environment. We recommend using
14+
Python `venv` for setting up your virtual environment.
15+
16+
In addition, you can find the technical documentation at [kgx.readthedocs.io](https://kgx.readthedocs.io/)
17+
18+
#### Coding Styles
19+
20+
We try to conform to [PEP-8](https://www.python.org/dev/peps/pep-0008/) style guidelines, but we do not enforce
21+
them yet. This might changes in the future.
22+
23+
But we do recommend [NumPy-style docstrings](https://python-sprints.github.io/pandas/guide/pandas_docstring.html)
24+
for any method you write. This facilitates automated generation of documentation.
25+
26+
### Testing
27+
28+
All tests are located in [tests](tests/) folder.
29+
For running tests, we use `pytest`.
30+
31+
32+
## Discussion
33+
34+
If you run into any issues or find certain functionality not documented/explained properly then feel free to
35+
raise a ticket in the project's [issue tracker](https://github.com/NCATS-Tangerine/kgx/issues).
36+
There are issue templates to capture certain types of issues.
37+
38+
## First Time Contributors
39+
40+
We appreciate your enthusiasm and welcome contributions to this project.
41+
42+
## How to Submit Changes
43+
44+
We recommend using GitHub Fork and Pull workflow which involves the following principles,
45+
46+
### Principle 1: Work from a personal fork
47+
48+
Prior to adopting the workflow, a developer will perform a one-time setup to create a personal Fork of the repository
49+
and will subsequently perform their development and testing on a task-specific branch within their forked repository.
50+
This forked repository will be associated with that developer's GitHub account, and is distinct from the main (upstream)
51+
repository.
52+
53+
### Principle 2: Commit to personal branches of that fork
54+
55+
Changes will never be committed directly to the master branch on the main repository. Rather, they will be composed
56+
as branches within the developer's forked repository, where the developer can iterate and refine their code prior to
57+
submitting it for review.
58+
59+
### Principle 3: Propose changes via pull request of personal branches
60+
61+
Each set of changes will be developed as a task-specific branch in the developer's forked repository, and then a pull
62+
request will be created to develop and propose changes to the shared repository. This mechanism provides a way for
63+
developers to discuss, revise and ultimately merge changes from the forked repository into the main repository.
64+
65+
### Principle 4: Delete or ignore stale branches, but don't recycle merged ones
66+
67+
Once a pull request has been merged, the task-specific branch is no longer needed and may be deleted or ignored.
68+
It is bad practice to reuse an existing branch once it has been merged. Instead, a subsequent branch and pull-request
69+
cycle should begin when a developer switches to a different coding task.
70+
71+
You may create a pull request in order to get feedback, but if you wish to continue working on the branch,
72+
so state with "DO NOT MERGE YET" in the PR title OR mark the pull request as a Draft OR label the pull request
73+
with a 'Do Not Merge' label.
74+
75+
76+
## How to Report a Bug
77+
78+
We recommend making a new ticket for each bug that you encounter while working with KGX. Please be sure to provide
79+
sufficient context for a bug you are reporting. There are [Issue Templates](https://github.com/NCATS-Tangerine/kgx/issues/new/choose)
80+
that you can use as a starting point.
81+
82+
## How to Request an Enhancement
83+
84+
We welcome request for enhancements and you can make these requestes via the issue tracker. Please be sure to provide
85+
sufficient context to what the enhancement is trying to address, its utility, and how it's likely to be useful to you
86+
and the broader community.
87+
88+
89+
## Core Developer Guidelines
90+
91+
Core developers should follow these rules when processing pull requests:
92+
- All PRs should originate from a fork
93+
- Always wait for tests to pass before merging PRs
94+
- Use "Squash and merge" to merge PRs
95+

LICENSE

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright (c) 2019, Biomedical Data Translator Consortium
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without modification,
5+
are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
* Neither the name of the copyright holder nor the names of
13+
its contributors may be used to endorse or promote products
14+
derived from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)