pycorese: Python API for CORESE Semantic Web platform
Project description
pycorese
Python API for CORESE Semantic Web platform
Corese is a software platform implementing and extending the standards of the Semantic Web. It allows to create, manipulate, parse, serialize, query, reason, and validate RDF data. Corese is based on the W3C standards RDF, RDFS, OWL 2, SPARQL and SHACL. Corese is implemented as a set of open-source Java libraries.
pycorese is a Python package that provides a simple way to integrate the corese-core Java library into Python applications.
pycorese offers an intuitive API to interact with Corese's capabilities such as storage, SPARQL engine, RDFS and OWL reasoning, and SHACL validation.
pycorese unlocks the potential of Semantic Web stack for applications such as semantic data analysis, knowledge graph construction, and Machine Learning.
Installation
pycorese can be easily installed via pip:
pip install pycorese
This process installs both the Python wrappers and the Corese Java libraries. To run the Java libraries, ensure that Java is installed on your system. A Java Runtime Environment (JRE) version 11 or higher is required. If Java is not installed, visit the official website for installation instructions.
Development installation
To install pycorese from the current GitHub repository follow the instructions from INSTALL.md.
Usage
Here is a simple example of how to use pycorese to load and query RDF data:
from pycorese.api import CoreseAPI
corese = CoreseAPI()
corese.loadCorese()
# Load RDF data
data = """
@prefix ex: <http://example.org/> .
ex:John ex:hasFriend ex:Jane, ex:Jill.
ex:Jane ex:age 25 .
ex:Jill ex:age 40 .
"""
graph = corese.loadRDF(data)
# Query the data to find out who is John's younger friend
query = """
PREFIX ex: <http://example.org/>
SELECT ?friend ?age
WHERE {
?x ex:age ?ageX .
?x ex:hasFriend ?friend .
?friend ex:age ?age .
FILTER (?ageX > ?age)
}
"""
results = corese.sparqlSelect(graph, query=query, return_dataframe=True)
print(results)
Expected output:
friend age
0 http://example.org/Jane 25
See the GitHub repository for more examples.
Documentation
- pycorese GitHub pages: https://corese-stack.github.io/corese-python
- Corese GitHub pages: https://corese-stack.github.io/corese-core
Contributing
Contributions are welcome! If you have any ideas, suggestions, or bug reports, please open an issue or submit a pull request on the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pycorese-0.1.5.tar.gz.
File metadata
- Download URL: pycorese-0.1.5.tar.gz
- Upload date:
- Size: 95.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6e5fbd59ff87703488b4d300f69c0ad1d5a66d252305d3052a0dcde2e45b2d8
|
|
| MD5 |
e1448e747ac7d05d5a9b3ad4277d7cb5
|
|
| BLAKE2b-256 |
921512c1f8a2d5728e163eb18b71fed1652baf41d8dbaf0931fff10a800812fc
|
File details
Details for the file pycorese-0.1.5-py3-none-any.whl.
File metadata
- Download URL: pycorese-0.1.5-py3-none-any.whl
- Upload date:
- Size: 95.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5e78e4df5e9762de29beb5f4207242a5683722c2236f50af6bc00882ad41ea3
|
|
| MD5 |
5e80fe02da0d96db0568bc3019f3d6f4
|
|
| BLAKE2b-256 |
d57a660939dd3b7d7e6fd08d36f577ca7014662fd5775d2b409f0fc3c38a0fdc
|