コード例 #1
0
 public function testHardModel()
 {
     $this->hardify();
     $referencer = ResourceReferencer::singleton();
     $propertyProxy = PropertyProxy::singleton();
     $proxy = ResourceProxy::singleton();
     $domainProperty = new core_kernel_classes_Property(RDFS_DOMAIN);
     $rangeProperty = new core_kernel_classes_Property(RDFS_RANGE);
     $literalClass = new core_kernel_classes_Class(RDFS_LITERAL);
     $subClassOfProperty = new core_kernel_classes_Property(RDFS_SUBCLASSOF);
     $this->assertTrue($this->targetActorsProperty->exists());
     $this->assertTrue($this->targetMovieClass->exists());
     $this->assertTrue($this->targetWorkClass->isSubclassOf($this->taoClass));
     $this->assertTrue($this->targetWorkClass->getOnePropertyValue($subClassOfProperty)->getUri() == $this->taoClass->getUri());
     $this->assertTrue($referencer->isClassReferenced($this->targetWorkClass));
     $this->assertFalse(is_a($proxy->getImpToDelegateTo($this->targetWorkClass), 'core_kernel_persistence_smoothsql_Class'));
     $this->assertFalse(is_a($proxy->getImpToDelegateTo($this->targetMovieClass), 'core_kernel_persistence_smoothsql_Class'));
     $this->assertTrue($this->targetAuthorProperty->getOnePropertyValue($domainProperty)->getUri() == $this->targetWorkClass->getUri());
     $this->assertTrue($this->targetAuthorProperty->getOnePropertyValue($rangeProperty)->getUri() == RDFS_LITERAL);
     $this->assertTrue($this->targetMovieClass->isSubclassOf($this->targetWorkClass));
     $this->assertTrue($this->targetMovieClass->getOnePropertyValue($subClassOfProperty)->getUri() == $this->targetWorkClass->getUri());
     $this->assertTrue($referencer->isClassReferenced($this->targetMovieClass));
     $this->assertTrue($this->targetProducerProperty->getOnePropertyValue($domainProperty)->getUri() == $this->targetMovieClass->getUri());
     $this->assertTrue($this->targetProducerProperty->getOnePropertyValue($rangeProperty)->getUri() == RDFS_LITERAL);
     $this->assertTrue($this->targetActorsProperty->getOnePropertyValue($domainProperty)->getUri() == $this->targetMovieClass->getUri());
     $this->assertTrue($this->targetActorsProperty->getOnePropertyValue($rangeProperty)->getUri() == RDFS_LITERAL);
     $this->assertTrue($this->targetRelatedMoviesProperty->getOnePropertyValue($domainProperty)->getUri() == $this->targetMovieClass->getUri());
     $this->assertTrue($this->targetRelatedMoviesProperty->getOnePropertyValue($rangeProperty)->getUri() == $this->targetMovieClass->getUri());
     $parentClasses = $this->targetMovieClass->getParentClasses();
     $this->assertEquals(1, count($parentClasses));
     $this->assertTrue(array_key_exists($this->targetWorkClass->getUri(), $parentClasses));
     $prop = new core_kernel_classes_Property($this->targetRelatedMoviesProperty);
     $this->assertTrue($prop->isMultiple());
 }
コード例 #2
0
 /**
  * Check if a property is exposed
  *
  * @param RdfPropery $property the property to check
  *
  * @return bool true if exposed
  */
 public function doesExposeCategory(RdfProperty $property)
 {
     $exposeProperty = new RdfProperty(self::EXPOSE_PROP_URI);
     $expose = $property->getOnePropertyValue($exposeProperty);
     return !is_null($expose) && $expose->getUri() === GENERIS_TRUE;
 }