-
Notifications
You must be signed in to change notification settings - Fork 0
/
ObjectPropertyCardinalityRestriction.php
32 lines (27 loc) · 1.21 KB
/
ObjectPropertyCardinalityRestriction.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
/**
* Created by PhpStorm.
* User: roll
* Date: Aug 24, 2010
* Time: 9:41:44 PM
* To change this template use File | Settings | File Templates.
*/
class ObjectPropertyCardinalityRestriction extends ObjectPropertyRestriction{
private $cardinality;
function __construct($objectPropertyExpression, $nni, $primary = null) {
parent::__construct($objectPropertyExpression, $primary);
$this->cardinality = $nni;
}
public function __toString() {
return $this->getObjectPropertyExpression()." ".$this->getRestrictionLabel()." "
. $this->cardinality . ($this->getClassExpression()? " " . $this->getClassExpression() : "");
}
public function toRdfArray() {
$bnodeId = RdfArray::getNewBnodeId();
$retval = RdfArray::createArray($bnodeId, "rdf:type", "owl:Restriction");
$retval []= RdfArray::createArray($bnodeId, "owl:qualifiedCardinality", new TypedLiteral($this->cardinality, "xsd:nonNegativeInteger"));
$retval []= RdfArray::createArray($bnodeId, "owl:onProperty", $this->getObjectPropertyExpression());
$retval []= RdfArray::createArray($bnodeId, "owl:onClass", $this->getClassExpression());
return $retval;
}
}