Giter Site home page Giter Site logo

abhinav-kumar-thakur / t2wml Goto Github PK

View Code? Open in Web Editor NEW

This project forked from usc-isi-i2/t2wml

0.0 0.0 0.0 64.04 MB

Table to Wikidata Mapping Language

License: MIT License

Python 24.70% HTML 3.93% JavaScript 0.36% CSS 23.57% TypeScript 47.30% Shell 0.08% Dockerfile 0.05%

t2wml's Introduction

T2WML: A Cell-Based Language To Map Tables Into Wikidata Records

Coverage Status

Operating system:macOS / OS X, Linux, Windows
Python version:Python 3.6+

This is the repository for the T2WMl server-based GUI. You may be looking for the T2WML API

Running T2WML for Development

Setting up the sources

For developing t2wml you need both the t2wml-api repository and the t2wml (this) repository. Create a directory called t2wml-root and clone both repositories under it:

cd t2wml-root
git clone https://github.com/usc-isi-i2/t2wml-api
cd t2wml-api
git checkout development
cd t2wml-root
git clone https://github.com/usc-isi-i2/t2wml
cd t2wml
git checkout development

Setting up the Electron Frontend

First you have to make sure you have Node version 12 or higher installed. Then you can run:

cd t2wml-root/t2wml/electron
yarn install

Note for developers adding package dependencies: The electron builder takes all the prod dependencies from package.json and adds them to the installation, even though webpack already takes care of everything. It is very important not to add prod dependencies, use yarn add --dev to add more packages.

Creating the Python virtual environment

cd t2wml-root/t2wml/backend
python3.6 -m venv env
source env/bin/activate     # on Windows just run env/bin/activate.ps1
pip install --upgrade pip
pip install -e ../../t2wml-api   # Install t2wml-api from the cloned repository at t2wml-root/t2wml-api
pip install -r requirements.txt

Note: Python 3.6 and higher are supported.

Running outside of an IDE

Running the backend

cd t2wml-root/t2wml/backend
python t2wml-server.py

Running backend tests

cd t2wml-root/t2wml/backend
pytest tests

Generating a self-contained tests report

cd t2wml-root/t2wml/backend
pytest --cov=. --cov-report html:htmlcov tests
open htmlcov/index.html

Running the frontend GUI

Since we're using Electron, you need to run two scripts to run the GUI on development:

cd t2wml-root/t2wml/electron
yarn dev

This script compiles all the frontend files, making them ready for electron. Wait until the compilation reaches 100% (you may see some warnings, that's fine). The script will keep running, recompiling as the frontend files are updated.

Open another shell window and run

cd t2wml-root/t2wml/electron
yarn start

This script starts Electron, and you should see the GUI.

Note that in development, the GUI will wait for the backend to start on port 13000, so you will need to run it.

Using Visual Studio Code

The project has preconfigured settings file for Visual Studio Code. Before starting you need to copy the settings template appropriate for your OS.

On Macs and Linux machines, copy .vscode/settings.linux.json to .vscode/settings.json . On Windows, copy .vscode/settings.windows.json to .vscode/settings.json Start Visual Studio Code and open it in the t2wml-root/t2wml directory.

GUI Development

To develop the GUI you need to run three tasks:

  1. Backend - runs the Python backend.
  2. Build Dev GUI Continiously - this task runs the npm dev script which builds the GUI and contiously watches for changes.
  3. Report GUI Coding Errors - this tasks continuously scans the sources for errors and updates the Problems pane.
  4. Start GUI - opens the Electron based GUI.

The GUI will not work unless the backend is up and running.

When updating the GUI code, it will be automatically rebuilt by the Build and Watch GUI task. You will need to reload the GUI - you can use Reload from the Debug menu.

You can also open the Chrome Developers Tools from the GUI's Debug menu.

Backend Development

To develop the backend, you need to launch the Backend from the debug menu. You will be able to set breakpoints and debug properly. If you want to run the GUI, start the Build and Watch GUI and t2wml GUI tasks, as well.

Usage with GUI

  1. Open the GUI
  2. In Table Viewer,
    1. click Upload to open a table file (.csv/.tsv/.xls/.xlsx)
  3. In Wikifier,
    1. define and wikify the regions you need [demo], and/or
    2. click Upload to open a wikifier file (.csv)
    3. correct mismatched qnode if necessary [demo]
  4. In YAML Editor,
    1. type/paste in T2WML code, or
    2. click Upload to open a YAML file (.yaml)
    3. click Apply to highlight some regions in Table Viewer
  5. In Output,
    1. preview result by clicking cell in Table Viewer [demo], or
    2. click Download to get all results

Writing T2WML

Check out the grammar guide

Features

Note: All screenshots below are captured in GUI v1.3. Minor inconsistencies may appear.

⬇️ t2wml-gui-demo

FAQs

  • Installation failed due to etk?

    Run the following commands in terminal/cmd:

    pip uninstall etk
    pip install https://github.com/usc-isi-i2/etk/archive/development.zip
    
  • Login failed or encountered an authentication error like 400 (OAuth2 Error)?

    Access T2WML at http://localhost:13000/ instead of http://127.0.0.1:13000.

  • Error saying can't find static/index.html?

    Make sure you install t2wml-standalone in a folder that does not contain the T2WML repo or there will be a configurations clash.

  • Encountered any other error not mentioned in the FAQs?

    Post the issue in the T2WML repository along with a detailed description.

t2wml's People

Contributors

devowit avatar g1eb avatar bhatiadivij avatar zmbq avatar jiashengwu avatar talyashra avatar saggu avatar kyao avatar chanachelem avatar dgarijo avatar ckxz105 avatar xkgoodbest avatar greatyyx avatar szeke avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.