Metadata-Version: 2.1
Name: autordf2gml
Version: 0.0.1
Summary: AutoRDF2GML: A Framework for Transforming RDF Data into Graph Representations for Graph Machine Learning.
Author-email: Michael Faerber <michael.faerber@tu-dresden.de>, David Lamprecht <lamprecht.david@web.de>, Yuni Susanti <yuni.susanti@mailbox.tu-dresden.de>
License: MIT License
Project-URL: Homepage, https://github.com/davidlamprecht/AutoRDF2GML
Project-URL: Issues, https://github.com/davidlamprecht/AutoRDF2GML/issues
Keywords: rdf,graph dataset,knowledge graph,autordf2gml,gml,gnn
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python :: 3.8
Classifier: License :: OSI Approved :: MIT License
Requires-Python: <=3.9.9,>=3.8
Description-Content-Type: text/markdown
Requires-Dist: rdflib~=6.3.2
Requires-Dist: pandas~=1.3.5
Requires-Dist: numpy~=1.22.4
Requires-Dist: configparser~=6.0.0
Requires-Dist: scikit-learn~=1.1.1
Requires-Dist: torch~=1.12.0
Requires-Dist: transformers~=4.30.2
Requires-Dist: tqdm~=4.65.0
Requires-Dist: torch-geometric~=2.3.0
Requires-Dist: urllib3~=1.26.6

# AutoRDF2GML

## Overview

AutoRDF2GML is a framework designed to transform RDF data into graph representations suitable for graph-based machine learning methods, e.g., Graph Neural Networks (GNNs). It uniquely generates content-based features from RDF datatype properties and topology-based features from RDF object properties, enabling the effective integration of Semantic Web technologies with Graph Machine Learning.

## Installation

To install the current PyPI version, run:

```sh
pip install autordf2gml
```

We recommend users to use **isolated environment, such as venv or conda**, to use the library. Please note that the current version has only been tested with **Python versions 3.8 to 3.9.9**. 

## Usage

To start using AutoRDF2GML, you need: **(1) RDF file** and **(2) Configuration file** describing the configuration for the transformation. In the configuration file, define the RDF classes and properties as needed for your project. See the following for quick example. 

## Quick Example

This example uses the [semopenalex-C1793878-sample.nt](https://github.com/davidlamprecht/AutoRDF2GML/blob/main/example/semopenalex-C1793878-sample.nt) RDF file, a curated subset from [SemOpenAlex](https://semopenalex.org).

#### 1. Preparing the configuration file

Fill all the required fields in the config file: see [config-soa-cb.ini](https://github.com/davidlamprecht/AutoRDF2GML/blob/main/example/config-soa-cb.ini) and [config-soa-tb.ini](https://github.com/davidlamprecht/AutoRDF2GML/blob/main/example/example-topologyfeatures/config-soa-tb.ini) as examples for the content-based and topology-based transformation, respectively. The following shows an example of the config file format:

    ```ini
    [InputPath] ;required
    input_path = semopenalex-C1793878-sample.nt

    [SavePath] ;required
    save_path_numeric_graph = semopenalex/numeric-graph/
    save_path_mapping = semopenalex/mapping/

    [NLD] ;required
    nld_class = work

    [EMBEDDING] ;required
    embedding_model = allenai/scibert_scivocab_uncased

    [Nodes] ;required
    classes = work, author, institution, source, concept, publisher
    work = https://semopenalex.org/class/Work
    author = https://semopenalex.org/class/Author
    institution = https://semopenalex.org/class/Institution
    
    [SimpleEdges] ;required
    edge_names = author_institution
    author_institution_start_node = author
    author_institution_properties = http://www.w3.org/ns/org#memberOf
    author_institution_end_node = institution
    ```

#### 2. Using the library

```python
import autordf2gml

#to run content-based transformation
autordf2gml.content_feature("config-soa-cb.ini") 

#to run topology-based transformation
autordf2gml.topology_feature("config-soa-tb.ini") 

#to run content-based transformation only using simple-edges
autordf2gml.simpleedges_feature("config-aifb-cb-simple.ini")
```

## Our Github

The most recent updates, documentation, and examples can be accessed through the following repository:

- <https://github.com/davidlamprecht/AutoRDF2GML>
