Skip to main content

pycorese: Python API for CORESE Semantic Web platform

Project description

pycorese

Python API for CORESE Semantic Web platform

Python Versions PyPI version Documentation codecov License: LGPL

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

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycorese-0.2.0.tar.gz (95.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycorese-0.2.0-py3-none-any.whl (95.3 MB view details)

Uploaded Python 3

File details

Details for the file pycorese-0.2.0.tar.gz.

File metadata

  • Download URL: pycorese-0.2.0.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

Hashes for pycorese-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5c6567d0af57b29ce61c8e26380a9bb1b238c788ab621e5b4e2fe06cb458f3aa
MD5 56402133fe3461d4bf4a7f3d433db560
BLAKE2b-256 111a48a561ee7ead1add84fb0cc962aa7ff95319225c8d7bcd2c317fc28aac9b

See more details on using hashes here.

File details

Details for the file pycorese-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pycorese-0.2.0-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

Hashes for pycorese-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59ffafc3a3b4cfe39c3bed0b2b008279d2df5f029280101968a767d89ce4ba36
MD5 4e0df546fc968a01302910b28352f798
BLAKE2b-256 6552b766f43f808dfdb067387aa8065d5dcddf12915a750027d37555bd670873

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page