Tiny-ME Objective-C

Tiny-ME - The Tiny Matchmaking Engine is a multiplatform, lightweight OWL reasoner and matchmaker for the Semantic Web of Everything, developed by SisInf Lab at the Polytechnic University of Bari. This repository contains the Objective-C interface of the reasoner.

Using the framework

The framework supports iOS 8.0 and later and macOS 10.11 and later. Here is how to use it:

  • Download a suitable build from the downloads page.
  • Place the framework anywhere into the directory of your project.
  • Open your Xcode project and navigate to its build settings.
  • In the “General” tab, add the compiled framework to the Frameworks and Libraries section.

Usage examples

Here are some examples to get you started. To learn more, check out the API docs.

Objective-C:

@import OWLAPI;
@import TinyME;

...

// Load the ontology.
NSURL *url = [NSBundle.mainBundle URLForResource:@"ontology" withExtension:@"owl"];
id<OWLOntologyManager> manager = [OWLManager createOWLOntologyManager];
id<OWLOntology> ontology = [manager loadOntologyFromDocumentAtURL:url error:NULL];

// Instantiate the reasoner.
TMEReasoner *reasoner = [[TMEReasoner alloc] initWithOntology:ontology];

// OWL constructs and other model classes can be instantiated via a TMEDataFactory.
TMEDataFactory *factory = reasoner.factory;
TMELogger *logger = factory.consoleLogger;

// Perform reasoning tasks, e.g.:
// - Classification
[reasoner classify];
[logger logTaxonomy:reasoner];

// - Coherence
BOOL coherent = [reasoner isCoherent];

// - Subsumption
OWLIRI *superIri = [[OWLIRI alloc] initWithString:@"http://onto.owl#A"];
OWLIRI *subIri = [[OWLIRI alloc] initWithString:@"http://onto.owl#B"];
BOOL isSubsumed = [reasoner classWithIri:subIri isSubClassOf:superIri];

// - Matchmaking
OWLIRI *res = [[OWLIRI alloc] initWithString:@"http://onto.owl#res"];
OWLIRI *req = [[OWLIRI alloc] initWithString:@"http://onto.owl#req"];

if ([reasoner compatibilityBetweenResource:res andRequest:req]) {
    TMEAbduction *abduction = [reasoner abductionBetweenResource:res
                                                      andRequest:req];
    ...
} else {
    TMEContraction *contraction = [reasoner contractionBetweenResource:res
                                                            andRequest:req];
    ...
}

Swift:

import OWLAPI
import TinyME

...

// Load the ontology.
let url = Bundle.main.url(forResource: "ontology", withExtension: "owl")!
let manager = OWLManager.createOWLOntologyManager()
let ontology = try! manager.loadOntologyFromDocument(at: url)

// Instantiate the reasoner.
let reasoner = TMEReasoner(ontology: ontology)

// OWL constructs and other model classes can be instantiated via a TMEDataFactory.
let factory = reasoner.factory;
let logger = factory.consoleLogger();

// Perform reasoning tasks, e.g.:
// - Classification
reasoner.classify()
logger.logTaxonomy(reasoner)

// - Coherence
let coherent = reasoner.isCoherent()

// - Subsumption
let superIri = OWLIRI(string: "http://onto.owl#A")
let subIri = OWLIRI(string: "http://onto.owl#B")
let isSubsumed = reasoner.class(with: subIri, isSubClassOf: superIri)

// - Matchmaking
let res = OWLIRI(string: "http://onto.owl#res")
let req = OWLIRI(string: "http://onto.owl#req")

if reasoner.compatibilityBetweenResource(res, andRequest: req) {
    let abduction = reasoner.abductionBetweenResource(res, andRequest: req)
    ...
} else {
    let contraction = reasoner.contractionBetweenResource(res, andRequest: req)
    ...
}

License

The current Tiny-ME version is distributed for the only purpose of academic review and evaluation. Any other use is not allowed.