Git Product home page Git Product logo

kg-analysis's Introduction

kg-analysis

Knowledge Graph and Linked Data uniformity analysis with affiliation networks

Bipartite graph


Setup

  • Install Python development headers
apt install python3.7-dev
pip install pybind11
  • Clone the repo
git clone https://github.com/davidweisscode/kg-analysis.git
  • Create and activate a virtual environment (optional, but recommended)
python3 -m venv venv
source venv/bin/activate
  • Install project dependencies
pip install -r requirements.txt
mkdir kg/ && cd kg/
wget -c http://fragments.dbpedia.org/hdt/dbpedia2016-04en.hdt
wget -c http://fragments.dbpedia.org/hdt/dbpedia2016-04en.hdt.index.v1-1
wget -c http://downloads.dbpedia.org/2016-04/dbpedia_2016-04.owl

Getting started

Configuration

Specify your runs with a custom configuration of classes, data size, and projection approach.

config = {
    "classes": ["Athlete", "Artist"],        # List of DBpedia class names to analyze
    "project_method": "intersect",           # Choose between 'dot', 'hop', 'intersect', or 'nx'
    "kg_source": "kg/dbpedia2016-04en.hdt",  # Relative path to .hdt serialized Knowledge Graph
    "kg_ontology": "kg/dbpedia.owl",         # Relative path to respective Knowledge Graph ontology
    "subject_limit": 0,                      # SPARQL subject limit for each subclass (0 for unlimited)
    "predicate_limit": 0,                    # SPARQL predicate limit for each subject (0 for unlimited)
}

DBpedia classes

Analyze classes and its subclasses from the DBpedia class mappings.

Main Steps

Run the following four scripts in sequence together with your run configuration

  1. Building

    • Query your dataset and build a bipartite Knowledge Graph for each Superclass specified in your config file
    • Run python3 build_graph.py run_config.py to output an edgelist in out/Superclass.g.csv
  2. Projecting

    • Project your bipartite graph into its two onemode representations
    • Run python3 project_graph.py run_config.py to output onemode edgelists in out/Superclass.t and out/Superclass.b
  3. Computing

    • Compute a KNC (k-neighborhood-connectivity) plot based on onemode graphs
    • Run python3 compute_knc.py run_config.py to output a KNC list in out/Superclass.k.csv
  4. Analyzing

    • Get properties of the KNC plots computed beforehand
    • Run python3 analyze_knc.py run_config.py to save properties in your run's result file out/_results_run_config.py
python3 build_graph.py run_config.py >> log.txt && python3 project_graph.py run_config.py >> log.txt && python3 compute_knc.py run_config.py >> log.txt && python3 analyze_knc.py run_config.py >> log.txt

Results

The results of your run_config.py runs are saved in out/_results_run_config.py

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.