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 provides 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.1.4.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.1.4-py3-none-any.whl (95.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycorese-0.1.4.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.1.4.tar.gz
Algorithm Hash digest
SHA256 27dfd594f59f8125fff91d6e7f63db2578a37b2cf832bc808a1f449aa77119a1
MD5 7d6c260185b0d6da6eb5ddc8f7ead933
BLAKE2b-256 5592379d715df3825aa63e649e18d893e9db5f137f7bbeb370924c80677f125d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycorese-0.1.4-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.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 6b5716377082f796de8e8049b2c240994f142616e05fab2da95bda08c333bb69
MD5 0fb20c35dde170b8ad3665393e5019b9
BLAKE2b-256 00cc01bf88657906350d7afd5e572a3400cfdb91bebf72b7301fbb7def37cd6e

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