Protege: how to connect two classes with a data property - owl

I am trying to implement an ontology in Protege. I have a class Murder and a class Person. The class Murder is connected to class Person by two object properties that are:
hasCriminal --> domain Murder, range Person
hasVictim --> domain Murder, range Person
I would like to express that class Murder needs to have a Victim who is dead. So i put a data property of Person named dead of type boolean (yes or no).
How can I say in class Murder that the data property "dead" of Person should be put true?
Thanks in advance.

Related

Describing nested classes in english

I am not sure I understand nested classes conceptually. A university class may have a student object inside it. That is composition. A university class may be a school, which is inheritance. But if I have a class defined within another class, how do I describe this relationship in a complete English statement? thanks.
A nested class is a member and as such has the same access rights as any other member.
Consider a Book which has properties like title, author, genre, year, publisher. Now publisher can be the inner class having properties like name, id, contact details etc.
Hope this helps

How add atributes of class in Protege 5.0?

I am using Methontology as Methodology for the construction of a Ontology, in the task 7 for this methodology "Task 7: To define class attributes in detail", I know how to add the instance attributes in Protege but I don't know how to add the class attributes in Protege 5.0.
I send you the tables of class attributes and instance attributes, for show the diference between them
Atributes of class
Atributes of Instance
"Class attributes" that apply to the class rather than to instances of the class are modelled in OWL as annotation properties.

CakePHP 1.3: extending class unable to find its parent model PHP file

In the class declaration line of the model (.php) files, I'm trying to extend off of a different class then AppModel. Let's say I have some models, including Model, ModelOrder, and ModelLastShipment, etc. And yes, "Model" is a made up name for the sake of generalization.
Model does not use a table and does not have any table association. It extends AppModel. It has some basic functions that I'd like ModelOrder and ModelLastShipment (and other Model... classes) to inherit. The problem is that while ModelOrder can be extended (i.e. class ModelOrder extends Model {...}), I'm unable to do the same with the following because of a missing file error.
model_last_shipment.php:
class ModelLastShipment extends Model {...}
This returns the error,
Fatal error: Class 'Model' not found in C:\xampp\htdocs\my_app\app\models\model_last_shipment.php on line 3
Including include_once('model.php') before the declaration solves this issue, but why does the extension work for ModelOrder without explicit inlcusion but not for ModelLastShipment?
Please let me know if there is more information needed to resolve this. There are many articles and posts regarding this sort of error, but I've yet to find out why I'm getting this error for one and not for another.
Let's say I have some models, including Model
It's impossible to create a class named "Model"
Model is a core class. If you create a class named Model, it with either not be loaded (because the class Model already exists) or cause fatal behavior - possibly "at random".
The class structure in the question is:
Overloadable (Cake)
Model (Cake)
AppModel (App)
Model (App) <- problem
That cannot work. Class names must be unique and Model is a core class.
Including include_once('model.php') before the declaration solves this issue
Are these model class names made up? As stated above that isn't possible with a class named Model.
Intermediary class models are not automatically loaded
These are the only model classes that are loaded automatically in Cake 1.3:
Model
AppModel
AppModel (when appropriate)
If the class hierarchy of your models is such that there are more intermediary classes - they need to be loaded explicitly:
<?php
App::import('Model', 'SomethingElse');
class NotNamedModel extends SomethingElse {

cakephp how to have a controller class that other controllers extend

I want a ThingsController that extends AppController. My individual controllers will extend ThingsController. The functions are repetitive for each model, and each model has its own mainly redundant controller.
A) Is this a good idea?
B) How do I do it? I tried adding it to the controllers directory, but cake did not find it.
c) How should I code in beforeFilter and beforeRender? That includes Auth.
It will work fine. Controllers are nothing more than php classes, you can have them inherit any way you like, so long as Cake can find them.
Create your ThingsController and place it in app/controllers/things_controller.php
In your derived controller, add App::import('Controller', 'Things'); above the class definition.
Define the class properly: class TestController extends ThingsController {}
Filters will inherit like normal.
nowadays you can use App::uses('ClassName', 'Folder/Subfolder')
extending a class does nothing for you in terms of tables in the database... as soon as you extend a model, your extended model name is the table name that cake will look for in the database. you don't get to store the common fields in a common table, and the extended fields in the extended class' table. for that you need model associations anyway, so there's not much point extending models and controllers in cakePHP. to have multiple models deal with the same table, you'd override the table the model uses in the Model definition with $useTable, but I can't imagine much point in that other than your project needs to talk to tables that you can't rename.
so in your case I would say Automobile extends AppModel, Car extends AppModel, Truck extends AppModel, (normal cake models) Truck $belongsTo Automobile, Car $belongsTo Automobile. put your common properties and methods in Automobile just like as if you were going to extend from Automobile, and instead of inheriting the methods, you access them by model association as in $this->Truck->Automobile->vin with object notation rather than with $this->Truck->vin which is what you want to do with inheritance.
in other words you won't get any closer to database normalization by extending Models in cakePHP -- that is done through model associations. you inherit from AppModel and AppController in order to get the basic methods like find(), save() etc and callbacks like beforeFilter() and afterRender(), etc. WRT your question, when you override the callbacks like beforeFilter() in an extending class, you have to call parent::beforeFilter() inside the method or things will break.
i suppose you could have a table with all the fields for the extended properties in it (table automobile with fields year, vin and also box_length, trunk_litres), then extend Models from the base class and override the table which the extended models use to use the base class table name (class Car extends Auto {$useTable = auto}), but this leaves lots of empty fields in the table and is not a proper normalized table structure. it would be a way to have say, VIN be a unique field among all the extended classes without much effort though. not sure how the auto_increment for the ID works in that case though. but then it takes extra work to extract from that common table records of a given type that match the extended class' type (table auto has field auto_type, class Truck extends Auto {$autoType = 'truck'}), so no gain.
similarly there is no gain with views. if you have class AutoController extends AppController { function displayListing()} and then class TruckController extends AutoController you can call TruckController->display_listing() but unless you tell the action to $this->render('Auto/display_listing') you will need to create a duplicate of the view in /View/Truck/display_listing.ctp, and if you do the override, then the view in View/Auto/display_listing.ctp will have to have many if statements to render the portions of the view specific to Truck or Car, so again, no gain.

How do I get all entities of an App Engine model class, including those of its subclasses?

I've got a question about Google App Engine and querying the datastore.
Suppose I've got three classes:
class Animal(db.Model):
age = db.IntegerProperty()
class Giraffe(Animal):
# ...
class Mouse(Animal):
# ...
Now I want to get all the Animal entities. I might try
Animal.all()
But that doesn't return anything (I created all the Animal entities using the Giraffe and Mouse constructors).
How do I get all the Animal entities? Is the general approach (subclasses of a subclass of db.Modell) ok?
App Engine doesn't directly support class inheritance, but there's an extension built into the SDK called PolyModel that does. Modify your Animal class to extend PolyModel instead of Model, and everything will work the way you expect.
The datastore doesn't keep track of inheritances like this. Each Entity has a single "kind".
If you wanted all of the animals to be of the same kind, you could have a property that indicates which sort of animal (Giraffe or Mouse) it is. So, you'd make each new entity an Animal, but then set the "type" property or whatever to Giraffe or Mouse. You lose some of the nice features of inheritance this way, which is a drag.

Resources