pyrdfrules


Namepyrdfrules JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryPython wrapper for RDFRules.
upload_time2024-10-09 07:33:07
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords rdf rdfrules rules
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![PyPI - Version](https://img.shields.io/pypi/v/pyrdfrules.svg)](https://pypi.org/project/pyrdfrules)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyrdfrules.svg)](https://pypi.org/project/pyrdfrules)

<p align="center">
  <img src="https://s3.dualstack.us-east-2.amazonaws.com/pythondotorg-assets/media/files/python-logo-only.svg">
</p>

<h1 align="center">
PyRDFRules
</h1>

<p align="center">
  <a href="https://github.com/propi/rdfrules">
    RDFRules
  </a>
  •
  <a href="">
    Documentation
  </a>
  •
  <a href="https://www.vse.cz/">
   VŠE
  </a>
</p>

-----

**Table of Contents**

- [PyRDFRules](#pyrdfrules)
  - [RDFRules](#rdfrules)
- [Getting started](#getting-started)
  - [Prerequisites](#prerequisites)
  - [Installation](#installation)
  - [Usage](#usage)
    - [Local instance](#local-instance)
- [Developing](#developing)
- [Roadmap](#roadmap)
- [Contributing](#contributing)
- [License](#license)
- [Acknowledgments](#acknowledgments)

## PyRDFRules

PyRDFRules is a Python wrapper for the graph rule mining tool RDFRules.

### RDFRules

> RDFRules is a powerful analytical tool for rule mining from RDF knowledge graphs. It offers a complex rule mining solution including RDF data pre-processing, rules post-processing and prediction abilities from rules. The core of RDFRules is written in the Scala language. Besides the Scala API, RDFRules also provides REST web service with graphical user interface via a web browser.

Repository for RDFRules can be found at [propi/rdfrules](https://github.com/propi/rdfrules). A live demo can be accessed at https://br-dev.lmcloud.vse.cz/rdfrules/.

## Getting started

PyRDFRules is distributed as a Python library through PyPi.

### Prerequisites

A minimum Python version of `3.12.2` is required. You can check your Python version using `python --version`.

### Installation

```console
pip install pyrdfrules
```

### Usage

Full documentation is available at [a dedicated documentation site](#documentation). Code samples can be found in the sample directory, including a Python notebook.

Currently, using a remote HTTP instance of RDFRules and a local instance of RDFRules is supported. Automatic installation of JVM if not present and of RDFRules is supported.

#### Local instance

First, start by opening a workspace and loading a workspace graph.

```python
# Open a new workspace.
workspace = Workspace(
    path.abspath("./workspace")
)

# load local workspace graph

dbpedia_graph = WorkspaceGraph(
  "<dbpedia>",
  workspace.open('mappingbased_objects_sample.ttl')
)
```

Create a pipeline, a sequence of operations applied on the dataset. All pipeline objects can be found at DOCUMENTATION LINK.

```python
# Create a pipeline
pipeline = Pipeline(
    items=[
        LoadGraph(
            graph=dbpedia_graph
        ),
        # ...
    ]
)
```

Next, create an instance of RDFRules. This is a wrapper for the HTTP interface of RDFRules and spawns the actual process when it is needed. During this step, JVM is installed. You can install it ahead of time by running a separate function on the `rdfrules` instance (todo).

```python
rdfrules = RDFRules(
    workspace=workspace
)
```

As a last step, launch the pipeline, wait for all results and print the head, body and measures of each mined rule.

```python

ruleset = await rdfrules.launch(pipeline)

for rule in ruleset:
    print(rule.head)
    print(rule.body)
    
    for measure in rule.measures:
        print(measure)
```

Full pipeline sample matching the DBpedia & YAGO example from the RDFRules web instance can be found in `sample/dbpedia.py` or DOCUMENTATION LINK (todo).

## Developing

To initialize your environment:

```console
./init.sh
```

To run a build and run jupyter lab:

```console
./run.sh
```

## Roadmap

- [x] Sample interface
- [ ] Implement JSON serialization of pipeline
- [ ] Implement communication with RDFRules

## Contributing

If you have a suggestion to improve this project, please fork the repo and create a pull request. If you encounter any issues, please do raise an [issue](https://github.com/KIZI/pyrdfrules/issues) with an appropriate tag. Feature requests, enhancements and bug reports are welcome.

To contribute to this project, first:

- Fork the Project
- Create your Feature Branch (git checkout -b feature/AmazingFeature)
- Commit your Changes (git commit -m 'Add some AmazingFeature')
- Push to the Branch (git push origin feature/AmazingFeature)
- Open a Pull Request

## License

`pyrdfrules` is distributed under the terms of the Apache License. See `LICENSE` for more information.

## Acknowledgments
* [RDFRules@propi/rdfrules](https://github.com/propi/rdfrules)
* [VŠE](https://www.vse.cz/)
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyrdfrules",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "rdf, rdfrules, rules",
    "author": null,
    "author_email": "Karel Douda <kareldouda1@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/19/9d/6a46311cc5a237f14ae043254ed3119457f4093eea558069005a0ffe52cc/pyrdfrules-0.0.1.tar.gz",
    "platform": null,
    "description": "\n[![PyPI - Version](https://img.shields.io/pypi/v/pyrdfrules.svg)](https://pypi.org/project/pyrdfrules)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyrdfrules.svg)](https://pypi.org/project/pyrdfrules)\n\n<p align=\"center\">\n  <img src=\"https://s3.dualstack.us-east-2.amazonaws.com/pythondotorg-assets/media/files/python-logo-only.svg\">\n</p>\n\n<h1 align=\"center\">\nPyRDFRules\n</h1>\n\n<p align=\"center\">\n  <a href=\"https://github.com/propi/rdfrules\">\n    RDFRules\n  </a>\n  \u2022\n  <a href=\"\">\n    Documentation\n  </a>\n  \u2022\n  <a href=\"https://www.vse.cz/\">\n   V\u0160E\n  </a>\n</p>\n\n-----\n\n**Table of Contents**\n\n- [PyRDFRules](#pyrdfrules)\n  - [RDFRules](#rdfrules)\n- [Getting started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Usage](#usage)\n    - [Local instance](#local-instance)\n- [Developing](#developing)\n- [Roadmap](#roadmap)\n- [Contributing](#contributing)\n- [License](#license)\n- [Acknowledgments](#acknowledgments)\n\n## PyRDFRules\n\nPyRDFRules is a Python wrapper for the graph rule mining tool RDFRules.\n\n### RDFRules\n\n> RDFRules is a powerful analytical tool for rule mining from RDF knowledge graphs. It offers a complex rule mining solution including RDF data pre-processing, rules post-processing and prediction abilities from rules. The core of RDFRules is written in the Scala language. Besides the Scala API, RDFRules also provides REST web service with graphical user interface via a web browser.\n\nRepository for RDFRules can be found at [propi/rdfrules](https://github.com/propi/rdfrules). A live demo can be accessed at https://br-dev.lmcloud.vse.cz/rdfrules/.\n\n## Getting started\n\nPyRDFRules is distributed as a Python library through PyPi.\n\n### Prerequisites\n\nA minimum Python version of `3.12.2` is required. You can check your Python version using `python --version`.\n\n### Installation\n\n```console\npip install pyrdfrules\n```\n\n### Usage\n\nFull documentation is available at [a dedicated documentation site](#documentation). Code samples can be found in the sample directory, including a Python notebook.\n\nCurrently, using a remote HTTP instance of RDFRules and a local instance of RDFRules is supported. Automatic installation of JVM if not present and of RDFRules is supported.\n\n#### Local instance\n\nFirst, start by opening a workspace and loading a workspace graph.\n\n```python\n# Open a new workspace.\nworkspace = Workspace(\n    path.abspath(\"./workspace\")\n)\n\n# load local workspace graph\n\ndbpedia_graph = WorkspaceGraph(\n  \"<dbpedia>\",\n  workspace.open('mappingbased_objects_sample.ttl')\n)\n```\n\nCreate a pipeline, a sequence of operations applied on the dataset. All pipeline objects can be found at DOCUMENTATION LINK.\n\n```python\n# Create a pipeline\npipeline = Pipeline(\n    items=[\n        LoadGraph(\n            graph=dbpedia_graph\n        ),\n        # ...\n    ]\n)\n```\n\nNext, create an instance of RDFRules. This is a wrapper for the HTTP interface of RDFRules and spawns the actual process when it is needed. During this step, JVM is installed. You can install it ahead of time by running a separate function on the `rdfrules` instance (todo).\n\n```python\nrdfrules = RDFRules(\n    workspace=workspace\n)\n```\n\nAs a last step, launch the pipeline, wait for all results and print the head, body and measures of each mined rule.\n\n```python\n\nruleset = await rdfrules.launch(pipeline)\n\nfor rule in ruleset:\n    print(rule.head)\n    print(rule.body)\n    \n    for measure in rule.measures:\n        print(measure)\n```\n\nFull pipeline sample matching the DBpedia & YAGO example from the RDFRules web instance can be found in `sample/dbpedia.py` or DOCUMENTATION LINK (todo).\n\n## Developing\n\nTo initialize your environment:\n\n```console\n./init.sh\n```\n\nTo run a build and run jupyter lab:\n\n```console\n./run.sh\n```\n\n## Roadmap\n\n- [x] Sample interface\n- [ ] Implement JSON serialization of pipeline\n- [ ] Implement communication with RDFRules\n\n## Contributing\n\nIf you have a suggestion to improve this project, please fork the repo and create a pull request. If you encounter any issues, please do raise an [issue](https://github.com/KIZI/pyrdfrules/issues) with an appropriate tag. Feature requests, enhancements and bug reports are welcome.\n\nTo contribute to this project, first:\n\n- Fork the Project\n- Create your Feature Branch (git checkout -b feature/AmazingFeature)\n- Commit your Changes (git commit -m 'Add some AmazingFeature')\n- Push to the Branch (git push origin feature/AmazingFeature)\n- Open a Pull Request\n\n## License\n\n`pyrdfrules` is distributed under the terms of the Apache License. See `LICENSE` for more information.\n\n## Acknowledgments\n* [RDFRules@propi/rdfrules](https://github.com/propi/rdfrules)\n* [V\u0160E](https://www.vse.cz/)",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python wrapper for RDFRules.",
    "version": "0.0.1",
    "project_urls": {
        "Documentation": "https://github.com/KIZI/pyrdfrules",
        "Issues": "https://github.com/KIZI/pyrdfrules/issues",
        "Source": "https://github.com/KIZI/pyrdfrules"
    },
    "split_keywords": [
        "rdf",
        " rdfrules",
        " rules"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8c874b45a83ceaacd0bf4545b4335c1caf99cbfc1cfd26187da94c0a9dca4a4b",
                "md5": "c48a1adf968cfc85390fd6e0f16fe874",
                "sha256": "98517d4be78b114bd559a3302fc4aa844d6d8cece7a8a6c17c97fa114032f791"
            },
            "downloads": -1,
            "filename": "pyrdfrules-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c48a1adf968cfc85390fd6e0f16fe874",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 39812,
            "upload_time": "2024-10-09T07:33:05",
            "upload_time_iso_8601": "2024-10-09T07:33:05.661398Z",
            "url": "https://files.pythonhosted.org/packages/8c/87/4b45a83ceaacd0bf4545b4335c1caf99cbfc1cfd26187da94c0a9dca4a4b/pyrdfrules-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "199d6a46311cc5a237f14ae043254ed3119457f4093eea558069005a0ffe52cc",
                "md5": "b1953aaebdf81d3528eb1cb468a7618e",
                "sha256": "d40b5d03d566a11d1ef7cdd7f33ca756ed475435234cd2fd690dabbe5cdc4fa2"
            },
            "downloads": -1,
            "filename": "pyrdfrules-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "b1953aaebdf81d3528eb1cb468a7618e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 23196,
            "upload_time": "2024-10-09T07:33:07",
            "upload_time_iso_8601": "2024-10-09T07:33:07.403421Z",
            "url": "https://files.pythonhosted.org/packages/19/9d/6a46311cc5a237f14ae043254ed3119457f4093eea558069005a0ffe52cc/pyrdfrules-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-09 07:33:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KIZI",
    "github_project": "pyrdfrules",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pyrdfrules"
}
        
Elapsed time: 0.82168s