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

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

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

reasonable-0.1.47_alpha10.tar.gz (1.5 MB view details)

Uploaded Source

Built Distributions

reasonable-0.1.47_alpha10-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (6.5 kB view details)

Uploaded Python 3 manylinux: glibc 2.5+ x86-64

reasonable-0.1.47_alpha10-cp37-abi3-manylinux_2_24_x86_64.whl (438.7 kB view details)

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

reasonable-0.1.47_alpha10-cp37-abi3-macosx_10_7_x86_64.whl (410.7 kB view details)

Uploaded CPython 3.7+ macOS 10.7+ x86-64

File details

Details for the file reasonable-0.1.47_alpha10.tar.gz.

File metadata

File hashes

Hashes for reasonable-0.1.47_alpha10.tar.gz
Algorithm Hash digest
SHA256 ca9186b7cb31bf09dc17b3cd7aea5c91279e7daa28533d2e36bcbf5340fdd79f
MD5 2eab9127561da9fba60eb46eb2f4e6a0
BLAKE2b-256 60cb868ca0498fdfb1d2d308e285ff26deffc263fed84f4f832354eda5f192ab

See more details on using hashes here.

File details

Details for the file reasonable-0.1.47_alpha10-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for reasonable-0.1.47_alpha10-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5c14343c48a44bf0cb78d3c535c8012dd9fa2ec41f7b5b9d0341f02e0d39b972
MD5 96edfbb5cf6324155ad275d49b56ff95
BLAKE2b-256 39ddf29f487da4157ef05e61efd1cc3afccc2130e09feaae66d1a177764a999a

See more details on using hashes here.

File details

Details for the file reasonable-0.1.47_alpha10-cp37-abi3-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for reasonable-0.1.47_alpha10-cp37-abi3-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 dbdef3bd42f2c9d4f18f8cf7bad3ec89adee636423f764a4b18e0721f2511ddd
MD5 f9aff4759a372274f3dd0079bcd47179
BLAKE2b-256 faaf1b6188e3d7c124431b0e627a7752257a56b11219211fa5eed6aa9537f238

See more details on using hashes here.

File details

Details for the file reasonable-0.1.47_alpha10-cp37-abi3-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for reasonable-0.1.47_alpha10-cp37-abi3-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 19ca115db16ce576f150fcada1903694a7e6a80eb3a83aa905e4d4849c9468ed
MD5 3ce8b373a0d2df863e459308ec140772
BLAKE2b-256 80d7146f14add2a8dc65cf5cc16db8c7a045f2263a9b4f95c90107bd9f063855

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