Skip to main content

An OWL 2 RL reasoner with reasonable performance

Project description

Reasonable

Nightly Build Build PyPI version

An OWL 2 RL reasoner with reasonable performance

Performance

Comparing performance of reasonable with OWLRL and Allegro. Evaluation consisted of loading Brick models of different sizes into the respective reasoning engine and timing how long it took to produce the materialization. reasonable is about 7x faster than Allegro and 38x faster than OWLRL on this workload.

benchmark

How to Use

Command Line Interface

You can download a static build of the command line tool here (this is automatically built from the latest master).

Usage as follows:

$ reasonable -h
An OWL 2 RL reasoner with reasonable performance

Usage: reasonable [OPTIONS] <INPUT_FILES>...

Arguments:
  <INPUT_FILES>...  

Options:
  -o, --output-file <OUTPUT_FILE>  [default: output.ttl]
  -h, --help                       Print help
  -V, --version                    Print version

Example:

$ reasonable example_models/ontologies/Brick.n3 example_models/small1.n3 -o myout.ttl
[2023-07-04T15:31:52Z INFO  reasonable] Loading file example_models/ontologies/Brick.n3
[2023-07-04T15:31:52Z INFO  reasonable::reasoner] Loaded 14803 triples from file example_models/ontologies/Brick.n3
[2023-07-04T15:31:52Z INFO  reasonable] Loading file example_models/small1.n3
[2023-07-04T15:31:52Z INFO  reasonable::reasoner] Loaded 14 triples from file example_models/small1.n3
[2023-07-04T15:31:52Z INFO  reasonable] Starting reasoning
[2023-07-04T15:32:11Z INFO  reasonable] Reasoning completed in 18.66sec
[2023-07-04T15:32:11Z INFO  reasonable] Writing to myout.ttl

Python

To facilitate usage, we use the pyo3 project to generate Python 3.x bindings to this project. Installing these should be as easy as pip install reasonable.

See also the brickschema package for working with Brick models. The package provides a generic interface to this reasoner and several others.

Usage looks like:

import reasonable

# import triples from an rdflib Graph
import rdflib
g = rdflib.Graph()
g.parse("example_models/ontologies/Brick.n3", format="n3")
g.parse("example_models/small1.n3", format="n3")

r = reasonable.PyReasoner()
r.from_graph(g)
triples = r.reason()
print("from rdflib:", len(triples))

# import triples from files on disk
r = reasonable.PyReasoner()
r.load_file("example_models/ontologies/Brick.n3")
r.load_file("example_models/small1.n3")
triples = r.reason()
print("from files:", len(triples))

Rust

See Rust docs

Example of usage from Rust:

use ::reasonable::owl::Reasoner;
use std::env;
use std::time::Instant;
use log::info;

fn main() {
    env_logger::init();
    let mut r = Reasoner::new();
    env::args().skip(1).map(|filename| {
        info!("Loading file {}", &filename);
        r.load_file(&filename).unwrap()
    }).count();
    let reasoning_start = Instant::now();
    info!("Starting reasoning");
    r.reason();
    info!("Reasoning completed in {:.02}sec", reasoning_start.elapsed().as_secs_f64());
    r.dump_file("output.ttl").unwrap();
}

OWL 2 Rules

Using rule definitions from here.

TODO: implement RDF/RDFS entailment semantics as described here

Note: haven't implemented rules that produce exceptions; waiting to determine the best way of handling these errors.

Equality Semantics

Completed Rule name Notes
no eq-ref implementation is very inefficient; causes lots of flux
yes eq-sym
yes eq-trans
yes eq-rep-s
yes eq-rep-p
yes eq-rep-o
no eq-diff1 throws exception
no eq-diff2 throws exception
no eq-diff3 throws exception

Property Axiom Semantics

Completed Rule name Notes
no prp-ap
yes prp-dom
yes prp-rng
yes prp-fp
yes prp-ifp
yes prp-irp throws exception
yes prp-symp
yes prp-asyp throws exception
yes prp-trp
yes prp-spo1
no prp-spo2
yes prp-eqp1
yes prp-eqp2
yes prp-pdw throws exception
no prp-adp throws exception
yes prp-inv1
yes prp-inv2
no prp-key
no prp-npa1 throws exception
no prp-npa2 throws exception

Class Semantics

Completed Rule name Notes
yes cls-thing
yes cls-nothing1
yes cls-nothing2 throws exception
yes cls-int1
yes cls-int2
yes cls-uni
yes cls-com throws exception
yes cls-svf1
yes cls-svf2
yes cls-avf
yes cls-hv1
yes cls-hv2
no cls-maxc1 throws exception
no cls-maxc2
no cls-maxqc1 throws exception
no cls-maxqc2 throws exception
no cls-maxqc3
no cls-maxqc4
no cls-oo

Class Axiom Semantics

Completed Rule name Notes
yes cax-sco
yes cax-eqc1
yes cax-eqc2
yes cax-dw throws exception
no cax-adc throws exception

Other

  • no datatype semantics for now

Development Notes

To publish new versions of reasonable, tag a commit with the version (e.g. v1.3.2) and push the tag to GitHub. This will execute the publish action which builds an uploads to PyPi.

Project details


Release history Release notifications | RSS feed

This version

0.2.6

Download files

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

Source Distribution

reasonable-0.2.6.tar.gz (1.5 MB view details)

Uploaded Source

Built Distributions

reasonable-0.2.6-cp37-abi3-win_amd64.whl (323.2 kB view details)

Uploaded CPython 3.7+ Windows x86-64

reasonable-0.2.6-cp37-abi3-win32.whl (316.8 kB view details)

Uploaded CPython 3.7+ Windows x86

reasonable-0.2.6-cp37-abi3-musllinux_1_2_x86_64.whl (5.0 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ x86-64

reasonable-0.2.6-cp37-abi3-musllinux_1_2_i686.whl (4.9 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ i686

reasonable-0.2.6-cp37-abi3-musllinux_1_2_armv7l.whl (4.8 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARMv7l

reasonable-0.2.6-cp37-abi3-musllinux_1_2_aarch64.whl (4.9 MB view details)

Uploaded CPython 3.7+ musllinux: musl 1.2+ ARM64

reasonable-0.2.6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ x86-64

reasonable-0.2.6-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (4.5 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARMv7l

reasonable-0.2.6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (4.7 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.17+ ARM64

reasonable-0.2.6-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl (4.8 MB view details)

Uploaded CPython 3.7+ manylinux: glibc 2.5+ i686

reasonable-0.2.6-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (1.0 MB view details)

Uploaded CPython 3.7+ macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

reasonable-0.2.6-cp37-abi3-macosx_10_7_x86_64.whl (504.4 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

Details for the file reasonable-0.2.6.tar.gz.

File metadata

  • Download URL: reasonable-0.2.6.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for reasonable-0.2.6.tar.gz
Algorithm Hash digest
SHA256 5d26aeb8b6c3f566aa2ef11c308b2208ec7669a30e9113728f243024c6276205
MD5 30938f63225cc55ab7837ecdee3edec9
BLAKE2b-256 a2567c9838902bbc2b54d64aae1a59498558d3a4efe3b3c37ee9edfefd79d404

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-win_amd64.whl.

File metadata

  • Download URL: reasonable-0.2.6-cp37-abi3-win_amd64.whl
  • Upload date:
  • Size: 323.2 kB
  • Tags: CPython 3.7+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 02332c2100748106be7580059d6e0a2769022fd687175594fe65ac8935cc32b6
MD5 92ead71dbca4a5e3ab56ca7309bef441
BLAKE2b-256 de74bec12904054932a3322ffd45da1e5b55d6e2d00c6789070b2aa50d7508b1

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-win32.whl.

File metadata

  • Download URL: reasonable-0.2.6-cp37-abi3-win32.whl
  • Upload date:
  • Size: 316.8 kB
  • Tags: CPython 3.7+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-win32.whl
Algorithm Hash digest
SHA256 6a4260330d62705eb4ea49926cd007b7a9278a9cf6548079a9ea53a6f277a15d
MD5 cd7bb30e71423a7fcd3899b5f4d53f9d
BLAKE2b-256 e1f74713769555161dac91d2f35e0c9638082f8c38f32835eb5114822d39e94a

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e6d066a68672c53d9d28c670839664e860a9f070c007c1318f91800b074710d4
MD5 12b40506de4dbc471aa448d2fdd7ce5c
BLAKE2b-256 726f48f422c652fb4389a4c1077a88cc81a98efe20e9e705ff7e3f64fda86363

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-musllinux_1_2_i686.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-musllinux_1_2_i686.whl
Algorithm Hash digest
SHA256 995ae5061cb31a38452d68e63dc6a301658e0bb0ef4e4efb98918927c7a73fb7
MD5 e64e476addfcc1955ffe88315b5ce5e9
BLAKE2b-256 d63da36dba287ca913587eebc242bbb546aa3beacd100ef57b6ae53ea990d00b

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-musllinux_1_2_armv7l.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-musllinux_1_2_armv7l.whl
Algorithm Hash digest
SHA256 a32e66baa6a9d95186a042cab5cb5f250e7764b79da3721ef516726a9a947580
MD5 09105dfd4dd22992b7fafa53ff7ae3d5
BLAKE2b-256 43a11817c0ae46a09e5f5a829fc53f072557a648e9b7d314bb4d2a2e768d3a88

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 53d8d7789f47ff777930448af82b24db081af4fe84e6a1bfd5448de74bb807a6
MD5 ea820dc57f1e71ed5f8f542f9109eb86
BLAKE2b-256 405888cce25dbff5852549334f800ed334be2ca5c5a2814eb84250a08f7a0ffc

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5e6b5aea2bbf4cadcf26a8e256d76670f37848707849a9590f94d2aa1a9c2392
MD5 d4836a3679d2f369dfbc0fcec9bb7508
BLAKE2b-256 f8bd9cf93e42daa7b14bc0699d0bd10665345eb1d387f04d0abf47f436662c2d

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 6efa7596329e0b45421b7dd10d5806021850f1e294c41371b601ac611bfbe42b
MD5 a1f9c5060f6ae3f71a74d9581bc5a61a
BLAKE2b-256 eae22009830cf7cf9a54d1fd43576604a94d6782ac01e92f5dd5a4780cc27088

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 76b9f9279ca06cec734ae1d46494ec1ef9a003e528ca2029856e61ed6d6221c9
MD5 1c797483824761996eefd6d8a3218044
BLAKE2b-256 8d2eac1327ac62d9fd267ccc857dc35e5630c2e9baccd0e44c3ac983002fe27d

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 f0d9c8a15404cf3e385ee74db6fb06a7f8d04511cd5b69313162fb4068053b06
MD5 6b9a1426c846196bbab47c8bf4a52f18
BLAKE2b-256 689d6838303de14493eaf33ddebc5fda4b8929907a390e42e12a8b4372e74d34

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 f06bfde7d128f3fff653f042634f8c4e68ded0a6150e3fa398e288d993bffbd4
MD5 1b72fd72fe1a3bff11407bd32ff160a2
BLAKE2b-256 bdf7070ce74598eff6c2c8e6759ad32063763b76cb575ee56f6c0fd51f707cfd

See more details on using hashes here.

File details

Details for the file reasonable-0.2.6-cp37-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for reasonable-0.2.6-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4aa6bf17159b96e42821cf7af6738d95330dbc4a88e09834378a28df3333c483
MD5 3972668e6b2419cc1b0018adb79ba373
BLAKE2b-256 bd13d9182d7dfbbd35818c74c07dc2d33bbafc05ddab294c09411373afc54566

See more details on using hashes here.

Supported by

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