The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

RDF::Cowl - A lightweight API for working with OWL 2 ontologies

VERSION

version 1.0.0

SYNOPSIS

use RDF::Cowl;

use boolean;
use constant ONTO => 'corpus/example_pizza.owl';
use constant NS => "http://www.co-ode.org/ontologies/pizza/pizza.owl#";
use constant CLASS_NAME => "Food";

my $manager = RDF::Cowl::Manager->new;
my $onto = do { try { $manager->read_path(ONTO) }
  catch($e) { die "Failed to load ontology @{[ ONTO ]}: $e"; }
};

my $cls = RDF::Cowl::Class->from_string(NS . CLASS_NAME);

my @subclasses;
$onto->iterate_sub_classes( $cls, sub ($subclass) {
  push @subclasses, $subclass->get_iri->get_rem
    if $subclass->isa('RDF::Cowl::Class');

  return true;
}, false );

is \@subclasses, bag {
  item 'IceCream';
  item 'Pizza';
  item 'PizzaBase';
  item 'PizzaTopping';
  end();
}, 'Got Food direct subclasses';

DESCRIPTION

Cowl provides an API for parsing, querying, editing, and writing OWL 2 ontologies. It currently supports processing OWL2 Functional Syntax.

EXAMPLES

For now, the best place to look for example code is the tests under the t/upstream directory.

SEE ALSO

AUTHOR

Zakariyya Mughal <zmughal@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2024 by Auto-Parallel Technologies, Inc..

This is free software, licensed under Eclipse Public License - v 2.0.