当前位置: 首页>>代码示例>>PHP>>正文


PHP core_kernel_classes_Resource::getRdfTriples方法代码示例

本文整理汇总了PHP中core_kernel_classes_Resource::getRdfTriples方法的典型用法代码示例。如果您正苦于以下问题:PHP core_kernel_classes_Resource::getRdfTriples方法的具体用法?PHP core_kernel_classes_Resource::getRdfTriples怎么用?PHP core_kernel_classes_Resource::getRdfTriples使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core_kernel_classes_Resource的用法示例。


在下文中一共展示了core_kernel_classes_Resource::getRdfTriples方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: deepDelete

 public static function deepDelete(\core_kernel_classes_Resource $resource)
 {
     foreach ($resource->getRdfTriples() as $triple) {
         self::deleteDependencies($triple);
     }
     $resource->delete();
 }
开发者ID:kendaop,项目名称:extension-tao-revision,代码行数:7,代码来源:DeleteHelper.php

示例2: getResourceDescription

 public function getResourceDescription(core_kernel_classes_Resource $resource, $fromDefinition = true)
 {
     $returnValue = new stdClass();
     $properties = array();
     if ($fromDefinition) {
         $types = $resource->getTypes();
         foreach ($types as $type) {
             foreach ($type->getProperties(true) as $property) {
                 //$this->$$property->getUri() = array($property->getLabel(),$this->getPropertyValues());
                 $properties[$property->getUri()] = $property;
             }
         }
         //var_dump($properties);
         $properties = array_unique($properties);
         $propertiesValues = $resource->getPropertiesValues($properties);
         if (count($propertiesValues) == 0) {
             throw new common_exception_NoContent();
         }
         $propertiesValuesStdClasses = $this->propertiesValuestoStdClasses($propertiesValues);
     } else {
         $triples = $resource->getRdfTriples();
         if (count($triples) == 0) {
             throw new common_exception_NoContent();
         }
         foreach ($triples as $triple) {
             $properties[$triple->predicate][] = common_Utils::isUri($triple->object) ? new core_kernel_classes_Resource($triple->object) : new core_kernel_classes_Literal($triple->object);
         }
         $propertiesValuesStdClasses = $this->propertiesValuestoStdClasses($properties);
     }
     $returnValue->uri = $resource->getUri();
     $returnValue->properties = $propertiesValuesStdClasses;
     return $returnValue;
 }
开发者ID:nagyist,项目名称:generis,代码行数:33,代码来源:class.ResourceFormatter.php

示例3: commit

 /**
  * (non-PHPdoc)
  * @see \oat\taoRevision\model\Repository::commit()
  */
 public function commit($resourceId, $message, $version)
 {
     $user = \common_session_SessionManager::getSession()->getUser();
     $userId = is_null($user) ? null : $user->getIdentifier();
     $created = time();
     // save data
     $resource = new \core_kernel_classes_Resource($resourceId);
     $data = CloneHelper::deepCloneTriples($resource->getRdfTriples());
     $revision = $this->getStorage()->addRevision($resourceId, $version, $created, $userId, $message, $data);
     return $revision;
 }
开发者ID:kendaop,项目名称:extension-tao-revision,代码行数:15,代码来源:Repository.php

示例4: testDeepDeleteTriples

 public function testDeepDeleteTriples()
 {
     //create resources
     $repository = \tao_models_classes_FileSourceService::singleton()->addLocalSource("Label Test", \tao_helpers_File::createTempDir());
     $file = $repository->createFile("test.xml", "sample");
     //delete resource
     DeleteHelper::deepDeleteTriples($file->getRdfTriples());
     DeleteHelper::deepDeleteTriples($repository->getRdfTriples());
     //see if all is deleted
     //try to get the resource
     $resourceTest = new \core_kernel_classes_Resource($repository->getUri());
     $fileTest = new \core_kernel_classes_Resource($file->getUri());
     $this->assertCount(0, $resourceTest->getRdfTriples());
     $this->assertCount(0, $fileTest->getRdfTriples());
 }
开发者ID:kendaop,项目名称:extension-tao-revision,代码行数:15,代码来源:DeleteHelperTest.php

示例5: addResource

 /**
  * Add a resource to the graph
  * 
  * @param EasyRdf_Graph $graph
  * @param core_kernel_classes_Resource $resource
  * @ignore
  */
 private function addResource(EasyRdf_Graph $graph, core_kernel_classes_Resource $resource)
 {
     foreach ($resource->getRdfTriples() as $triple) {
         if (!empty($triple->lg)) {
             $graph->addLiteral($triple->subject, $triple->predicate, $triple->object, $triple->lg);
         } elseif (common_Utils::isUri($triple->object)) {
             $graph->add($triple->subject, $triple->predicate, $triple->object);
         } else {
             $graph->addLiteral($triple->subject, $triple->predicate, $triple->object);
         }
     }
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:19,代码来源:class.GenerisAdapterRdf.php

示例6: update

 /**
  *
  * @author Patrick Plichart, patrick@taotesting.com
  * @param string $uri            
  * @param array $propertiesValues            
  * @throws common_exception_InvalidArgumentType
  * @throws common_exception_PreConditionFailure
  * @throws common_exception_NoContent
  * @return core_kernel_classes_Resource
  */
 public function update($uri, $propertiesValues = array())
 {
     if (!common_Utils::isUri($uri)) {
         throw new common_exception_InvalidArgumentType();
     }
     if (!$this->isInScope($uri)) {
         throw new common_exception_PreConditionFailure("The URI must be a valid resource under the root Class");
     }
     $resource = new core_kernel_classes_Resource($uri);
     // if the resource does not exist, indicate a not found exception
     if (count($resource->getRdfTriples()->sequence) == 0) {
         throw new common_exception_NoContent();
     }
     foreach ($propertiesValues as $uri => $parameterValue) {
         $resource->editPropertyValues(new core_kernel_classes_Property($uri), $parameterValue);
     }
     return $resource;
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:28,代码来源:class.CrudService.php

示例7: restore

 /**
  * (non-PHPdoc)
  * @see \oat\taoRevision\model\Repository::restore()
  */
 public function restore(Revision $revision)
 {
     $resourceId = $revision->getResourceId();
     $data = $this->getStorage()->getData($revision);
     $resource = new \core_kernel_classes_Resource($resourceId);
     $originFilesystemMap = CloneHelper::getPropertyStorageMap($resource->getRdfTriples());
     DeleteHelper::deepDelete($resource);
     foreach (CloneHelper::deepCloneTriples($data, $originFilesystemMap) as $triple) {
         ModelManager::getModel()->getRdfInterface()->add($triple);
     }
     return true;
 }
开发者ID:oat-sa,项目名称:extension-tao-revision,代码行数:16,代码来源:RepositoryService.php


注:本文中的core_kernel_classes_Resource::getRdfTriples方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。