sac2kg

A Python package for generating RDF knowledge graphs based on the Volcano Event Ontology VEO.

https://github.com/d1egoprog/sac2kg

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.9%) to scientific vocabulary

Keywords

command-line-tool graph-generation knowledge-graph neurosymbolic-ai sac
Last synced: 6 months ago · JSON representation ·

Repository

A Python package for generating RDF knowledge graphs based on the Volcano Event Ontology VEO.

Basic Info
  • Host: GitHub
  • Owner: d1egoprog
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 79.1 KB
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 2
Topics
command-line-tool graph-generation knowledge-graph neurosymbolic-ai sac
Created about 1 year ago · Last pushed 9 months ago
Metadata Files
Readme License Citation

README.md

SAC2KG a Neuro-Symbolic library for Volcano Event Detection

Version License DOI Build Status Python

The SAC2KG Python Library provides tools to load, manipulate, and generate RDF knowledge graphs based on the Volcano Event Ontology (VEO). Designed with simplicity and extensibility in mind, this library streamlines ontology-based data modeling for seismic sensor networks and related domains.


Table of Contents


Introduction

This library is the Python implementation of the Volcano Event Ontology (VEO), enabling users to:

  • Generate RDF graphs compliant with VEO.
  • Validate and extend ontology-based models.
  • Interface with SOSA, TIME, and GEO vocabularies.
  • Simplify integration with machine learning workflows and early warning systems.

Features

  • Ontology Management: Load and extend the VEO ontology.
  • Graph Generation: Build RDF triples programmatically.
  • Data Validation: Ensure compliance with the ontology structure.
  • Custom Mapping: Map seismic data to the ontology classes and properties.

Installation

Install the library from TestPyPI:

bash pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ sac2kg

Alternatively, install the latest version from source:

bash git clone https://github.com/d1egoprog/sac2kg.git cd sac2kg pip install .

Usage

As a Python Library

  1. Download the SAC (Seismic Analysis Code) or create a JSON file example_trace.json in some place of your file system. A copy is uploaded in the demo folder.

JSON { "seismic_network": "US", "station": "ANMO", "instrument": "Broadband Seismometer", "delta": 2.5, "axis": 0.75, "signal_type": "itime", "unit": "m/s", "positive_polarity": true, "latitude": 34.945, "longitude": -106.457, "elevation": 1850.0, "system_lifetime": "2023-12-15T08:00:00Z", "data_points": 10, "component": "Z", "data": [0.01, 0.12, -0.03, 0.04, -0.08, 0.10, -0.02, 0.03, -0.01, 0.07], "event": "Earthquake", "energy": 1.2e12, "magnitude": 4.5, "focal_mechanism": "Strike-slip", "source_latitude": 35.200, "source_longitude": -105.750, "source_elevation": 1500.0, "depth": 12.3, "alert_level": 2 }

  1. Copy the code into a Python module file and execute it or intagrate in your solution.

``` Python
import sac2kg

print('-------Reading a SAC file and create the VEO-KG-------------------') g1 = sac2kg.readfromjson('exampletrace.sac', ontology=False ) sac2kg.graphstore(g1, 'examplesackg.ttl', output='ttl')

print('-------Reading a JSON file and create the VEO-KG-------------------') g2 = sac2kg.readfromjson('exampletrace.json', ontology=False ) sac2kg.graphstore(g2, 'examplejsonkg.ttl', output='ttl') ```

Using the Command Line Interface (CLI)

The library provides a robust Command-Line Interface (CLI) tool located in the demo/ folder. This tool simplifies the process of mapping SAC or JSON trace files into Knowledge Graphs following the VEO schema. Whether you are working with single files or entire directories, the CLI provides flexible options for various use cases.

To explore the CLI in action, navigate to the demo/ folder and use the provided script. Below is an overview of its features and an example use case.

bash python -m sac2kg my_trace.sac my_kg

Advanced Usage

  • Custom Ontology Extensions: Extend the base ontology by adding new classes and properties using the provided ontology builder tools.
  • Integration with Existing RDF Graphs: Merge the generated RDF graphs with other semantic web datasets.

Documentation

Refer to the full documentation for detailed usage instructions, API references, and advanced examples.

Citations

If this work is with your interest, you can read the associated paper, and if you use it in your research, please don't forget to cite 👍 this work; the suggested citation in BibTex format is:

BibTex @article{Rincon2025, author = {Diego Rincon-Yanez and Sabrina Senatore and Declan O'Sullivan}, doi = {TBP}, issn = {16113349}, journal = {Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)}, month = {June}, title = {Scaling NeuroSymbolic AI integration for Seismic Event Detection}, volume = {TBP}, year = {To be Published}, }

Contributing

Contributions are welcome! Please follow the contribution guidelines.

Steps to Contribute

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Commit your changes with a descriptive message.
  4. Submit a pull request to the main repository.

License

This library is licensed under the MIT License.

Troubleshooting

If there are any troubles or you have any questions, please open an issue stating the encountered problem. Contributing is always welcome. The Github repository Issues URL. And contributing is always welcome. The Github repository URL.

Happy hacking!! 🖖🖖.

Owner

  • Name: Diego Rincon-Yanez
  • Login: d1egoprog
  • Kind: user
  • Location: Germany
  • Company: Bosch Research for AI

CS Researcher, Tech (enthusiastic and hunter), Nerd and occasional gamer

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Rincon-Yanez"
  given-names: "Diego"
  orcid: "https://orcid.org/0000-0002-8982-1678"
- family-names: "Senatore"
  given-names: "Sabrina"
  orcid: "https://orcid.org/0000-0002-7127-4290"
- family-names: "O'Sullivan"
  given-names: "Declan"
  orcid: "https://orcid.org/0000-0003-1090-3548"
title: "SAC2KG"
version: 1.0.0
doi: 10.5281/zenodo.1234
date-released: 2024-12-19
url: "https://github.com/d1egoprog/SAC2KG"

GitHub Events

Total
  • Release event: 2
  • Watch event: 1
  • Push event: 8
  • Create event: 4
Last Year
  • Release event: 2
  • Watch event: 1
  • Push event: 8
  • Create event: 4