| SADI documentation | Contained in the SADI distribution. |
SADI::Data::Def::DatatypeProperty - definition of an owl datatype property
use SADI::Data::Def::DatatypeProperty;
# create a new data type
my $datatype = new SADI::Data::Def::DatatypeProperty
( name => 'MySequenceProperty',
domain => 'http://some.domain.com/MySequenceDomain',
uri => 'http://some.domain.com/MySequenceProperty',
range => 'http://some.domain.com/MySequence',
parent => 'http://some.domain.com/MySequencePropertyParent',
);
# get the name of this datatype property
print $datatype->name;
A container representing an OWL datatype property definition
Edward Kawas (edward.kawas [at] gmail [dot] com)
Details are in SADI::Base. Here just a list of them:
A name of this datatype property
A parent for this datatype property ... defaults to SADI::Data::OWL::DatatypeProperty
The domain of this datatype property
The range of this datatype property
The uri of this datatype property
| SADI documentation | Contained in the SADI distribution. |
#----------------------------------------------------------------- # SADI::Data::Def::DatatypeProperty # Author: Edward Kawas <edward.kawas@gmail.com>, # For copyright and disclaimer see below. # # $Id: DatatypeProperty.pm,v 1.8 2010-01-07 21:48:08 ubuntu Exp $ #----------------------------------------------------------------- package SADI::Data::Def::DatatypeProperty; use base qw( SADI::Base ); use strict; # add versioning to this module use vars qw /$VERSION/; $VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /: (\d+)\.(\d+)/;
#----------------------------------------------------------------- # A list of allowed attribute names. See SADI::Base for details. #-----------------------------------------------------------------
{ my %_allowed = ( uri => { type => SADI::Base->STRING, post => sub { my ($self) = shift; my $package = $self->oProperty2module( $self->uri2package( $self->uri ) ); $self->{module_name} = $package; # extract our name and set it my $name = $1 if $package =~ m|\:\:(\w+)$|gi; $name = $package unless $name; $self->{name} = $name; } }, parent => { type => SADI::Base->STRING, post => sub { my ($self) = shift; my $name = $self->parent; $self->{module_parent} = $self->oProperty2module( $self->uri2package( $self->{parent} ) ) unless $self->{parent} eq 'SADI::Data::OWL::DatatypeProperty'; $self->{module_parent} = $self->{parent} if $self->{parent} eq 'SADI::Data::OWL::DatatypeProperty'; }, }, domain => { type => SADI::Base->STRING, }, name => { type => SADI::Base->STRING, post => sub { my ($self) = shift; my $package = $self->oProperty2module( $self->uri2package( $self->{name} ) ); # extract our name and set it my $name = $1 if $package =~ m|\:\:(\w+)$|gi; $name = $package unless $name; $self->{name} = $name; } }, range => { type => SADI::Base->STRING, }, # used internally (but cannot start with underscore - Template would ignore them) module_name => undef, module_parent => undef, ); sub _accessible { my ( $self, $attr ) = @_; exists $_allowed{$attr} or $self->SUPER::_accessible($attr); } sub _attr_prop { my ( $self, $attr_name, $prop_name ) = @_; my $attr = $_allowed{$attr_name}; return ref($attr) ? $attr->{$prop_name} : $attr if $attr; return $self->SUPER::_attr_prop( $attr_name, $prop_name ); } } #-----------------------------------------------------------------
#----------------------------------------------------------------- # init #----------------------------------------------------------------- sub init { my ($self) = shift; $self->SUPER::init(); $self->parent('SADI::Data::OWL::DatatypeProperty'); } 1; __END__