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


PHP rdf_get_mapping函数代码示例

本文整理汇总了PHP中rdf_get_mapping函数的典型用法代码示例。如果您正苦于以下问题:PHP rdf_get_mapping函数的具体用法?PHP rdf_get_mapping怎么用?PHP rdf_get_mapping使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     // Enables anonymous user comments.
     user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array('access comments' => TRUE, 'post comments' => TRUE, 'skip comment approval' => TRUE));
     // Allows anonymous to leave their contact information.
     $this->setCommentAnonymous(COMMENT_ANONYMOUS_MAY_CONTACT);
     $this->setCommentPreview(DRUPAL_OPTIONAL);
     $this->setCommentForm(TRUE);
     $this->setCommentSubject(TRUE);
     $this->setCommentSettings('comment_default_mode', CommentManagerInterface::COMMENT_MODE_THREADED, 'Comment paging changed.');
     // Prepares commonly used URIs.
     $this->base_uri = url('<front>', array('absolute' => TRUE));
     $this->node_uri = url('node/' . $this->node->id(), array('absolute' => TRUE));
     // Set relation between node and comment.
     $article_mapping = rdf_get_mapping('node', 'article');
     $comment_count_mapping = array('properties' => array('sioc:num_replies'), 'datatype' => 'xsd:integer', 'datatype_callback' => array('callable' => 'Drupal\\rdf\\CommonDataConverter::rawValue'));
     $article_mapping->setFieldMapping('comment_count', $comment_count_mapping)->save();
     // Save user mapping.
     $user_mapping = rdf_get_mapping('user', 'user');
     $username_mapping = array('properties' => array('foaf:name'));
     $user_mapping->setFieldMapping('name', $username_mapping)->save();
     $user_mapping->setFieldMapping('homepage', array('properties' => array('foaf:page'), 'mapping_type' => 'rel'))->save();
     // Save comment mapping.
     $mapping = rdf_get_mapping('comment', 'comment');
     $mapping->setBundleMapping(array('types' => array('sioc:Post', 'sioct:Comment')))->save();
     $field_mappings = array('subject' => array('properties' => array('dc:title')), 'created' => array('properties' => array('dc:date', 'dc:created'), 'datatype' => 'xsd:dateTime', 'datatype_callback' => array('callable' => 'date_iso8601')), 'changed' => array('properties' => array('dc:modified'), 'datatype' => 'xsd:dateTime', 'datatype_callback' => array('callable' => 'date_iso8601')), 'comment_body' => array('properties' => array('content:encoded')), 'pid' => array('properties' => array('sioc:reply_of'), 'mapping_type' => 'rel'), 'uid' => array('properties' => array('sioc:has_creator'), 'mapping_type' => 'rel'), 'name' => array('properties' => array('foaf:name')));
     // Iterate over shared field mappings and save.
     foreach ($field_mappings as $field_name => $field_mapping) {
         $mapping->setFieldMapping($field_name, $field_mapping)->save();
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:32,代码来源:CommentAttributesTest.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->vocabulary = $this->createVocabulary();
     // RDF mapping - term bundle.
     rdf_get_mapping('taxonomy_term', $this->vocabulary->id())->setBundleMapping(array('types' => array('skos:Concept')))->setFieldMapping('name', array('properties' => array('rdfs:label', 'skos:prefLabel')))->save();
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:7,代码来源:TaxonomyAttributesTest.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:link')))->save();
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:11,代码来源:LinkFieldRdfaTest.php

示例4: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:dateCreated')))->save();
     // Set up test entity.
     $this->entity = EntityTest::create(array());
     $this->entity->{$this->fieldName}->value = $this->testValue;
 }
开发者ID:318io,项目名称:318-io,代码行数:11,代码来源:DateTimeFieldRdfaTest.php

示例5: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:email')))->save();
     // Set up test values.
     $this->testValue = 'test@example.com';
     $this->entity = entity_create('entity_test', array());
     $this->entity->{$this->fieldName}->value = $this->testValue;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:EmailFieldRdfaTest.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:telephone')))->save();
     // Set up test values.
     $this->testValue = '555-555-5555';
     $this->entity = entity_create('entity_test', array());
     $this->entity->{$this->fieldName}->value = $this->testValue;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:12,代码来源:TelephoneFieldRdfaTest.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:text')))->save();
     // Set up test entity.
     $this->entity = entity_create('entity_test');
     $this->entity->{$this->fieldName}->value = $this->testValue;
     $this->entity->{$this->fieldName}->summary = $this->testSummary;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:12,代码来源:StringFieldRdfaTest.php

示例8: setUp

 protected function setUp()
 {
     parent::setUp();
     $web_user = $this->drupalCreateUser(array('bypass node access', 'administer taxonomy'));
     $this->drupalLogin($web_user);
     $this->vocabulary = $this->createVocabulary();
     // Create the field.
     $this->fieldName = 'field_taxonomy_test';
     $this->createTaxonomyTermReferenceField($this->fieldName, $this->vocabulary);
     // Set the RDF mapping for the new field.
     rdf_get_mapping('node', 'article')->setFieldMapping($this->fieldName, array('properties' => array('dc:subject'), 'mapping_type' => 'rel'))->save();
     rdf_get_mapping('taxonomy_term', $this->vocabulary->id())->setBundleMapping(array('types' => array('skos:Concept')))->setFieldMapping('name', array('properties' => array('rdfs:label')))->save();
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:13,代码来源:TaxonomyTermFieldAttributesTest.php

示例9: testFieldMapping

 /**
  * Test the handling of field mappings.
  */
 function testFieldMapping()
 {
     $field_name = 'created';
     // Test that the field mapping can be saved.
     $mapping = array('properties' => array('dc:created'), 'datatype' => 'xsd:dateTime', 'datatype_callback' => array('callable' => 'Drupal\\rdf\\CommonDataConverter::dateIso8601Value'));
     rdf_get_mapping($this->entityType, $this->bundle)->setFieldMapping($field_name, $mapping)->save();
     $field_mapping = rdf_get_mapping($this->entityType, $this->bundle)->getFieldMapping($field_name);
     $this->assertEqual($mapping, $field_mapping, 'Field mapping saved.');
     // Test that the field mapping can be edited.
     $mapping = array('properties' => array('dc:date'), 'datatype' => 'foo:bar', 'datatype_callback' => array('callable' => 'Drupal\\rdf\\CommonDataConverter::dateIso8601Value'));
     rdf_get_mapping($this->entityType, $this->bundle)->setFieldMapping($field_name, $mapping)->save();
     $field_mapping = rdf_get_mapping($this->entityType, $this->bundle)->getFieldMapping($field_name);
     $this->assertEqual($mapping, $field_mapping, 'Field mapping updated.');
 }
开发者ID:318io,项目名称:318-io,代码行数:17,代码来源:CrudTest.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:interactionCount'), 'datatype_callback' => array('callable' => 'Drupal\\rdf\\Tests\\Field\\TestDataConverter::convertFoo')))->save();
     // Set up test values.
     $this->test_value = $this->randomName();
     $this->entity = entity_create('entity_test');
     $this->entity->{$this->fieldName}->value = $this->test_value;
     $this->entity->save();
     $this->uri = $this->getAbsoluteUri($this->entity);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:14,代码来源:FieldRdfaDatatypeCallbackTest.php

示例11: submitForm

  /**
   * Saves Schema.org mappings in \Drupal\node\NodeTypeForm.
   */
  public static function submitForm(array &$form, FormStateInterface $form_state) {
    if ($form_state->hasValue('types')) {
      $entity_type = $form_state->getFormObject()->getEntity();
      $mapping = rdf_get_mapping('node', $entity_type->id());
      if ($entity_type->isNew()) {
        $mapping = rdf_get_mapping('node', $form_state->getValue('types'));
      }

      if ($form_state->hasValue('types')) {
        $mapping->setBundleMapping(array('types' => array($form_state->getValue('types'))))
          ->save();
      }
    }
  }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:17,代码来源:ContentMappings.php

示例12: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->fieldName = 'field_image';
     // Create the image field.
     $this->createImageField($this->fieldName, 'article');
     // Set the RDF mapping for the new field.
     rdf_get_mapping('node', 'article')->setFieldMapping($this->fieldName, array('properties' => array('og:image'), 'mapping_type' => 'rel'))->setBundleMapping(array('types' => array()))->save();
     // Get the test image that simpletest provides.
     $image = current($this->drupalGetTestFiles('image'));
     // Save a node with the image.
     $nid = $this->uploadNodeImage($image, $this->fieldName, 'article', $this->randomMachineName());
     $this->node = Node::load($nid);
     $this->file = file_load($this->node->{$this->fieldName}->target_id);
 }
开发者ID:RealLukeMartin,项目名称:drupal8tester,代码行数:15,代码来源:ImageFieldAttributesTest.php

示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $web_user = $this->drupalCreateUser(array('bypass node access', 'administer taxonomy'));
     $this->drupalLogin($web_user);
     $this->vocabulary = $this->createVocabulary();
     // Create the field.
     $this->fieldName = 'field_taxonomy_test';
     $handler_settings = array('target_bundles' => array($this->vocabulary->id() => $this->vocabulary->id()), 'auto_create' => TRUE);
     $this->createEntityReferenceField('node', 'article', $this->fieldName, 'Tags', 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED);
     entity_get_form_display('node', 'article', 'default')->setComponent($this->fieldName, array('type' => 'options_select'))->save();
     entity_get_display('node', 'article', 'full')->setComponent($this->fieldName, array('type' => 'entity_reference_label'))->save();
     // Set the RDF mapping for the new field.
     rdf_get_mapping('node', 'article')->setFieldMapping($this->fieldName, array('properties' => array('dc:subject'), 'mapping_type' => 'rel'))->save();
     rdf_get_mapping('taxonomy_term', $this->vocabulary->id())->setBundleMapping(array('types' => array('skos:Concept')))->setFieldMapping('name', array('properties' => array('rdfs:label')))->save();
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:16,代码来源:EntityReferenceFieldAttributesTest.php

示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->fieldName = strtolower($this->randomMachineName());
     $type_name = 'article';
     $this->createFileField($this->fieldName, 'node', $type_name);
     // Set the teaser display to show this field.
     entity_get_display('node', 'article', 'teaser')->setComponent($this->fieldName, array('type' => 'file_default'))->save();
     // Set the RDF mapping for the new field.
     $mapping = rdf_get_mapping('node', 'article');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('rdfs:seeAlso'), 'mapping_type' => 'rel'))->save();
     $test_file = $this->getTestFile('text');
     // Create a new node with the uploaded file.
     $nid = $this->uploadNodeFile($test_file, $this->fieldName, $type_name);
     $this->node = node_load($nid, TRUE);
     $this->file = file_load($this->node->{$this->fieldName}->target_id);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:17,代码来源:FileFieldAttributesTest.php

示例15: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test_rev');
     entity_reference_create_field($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType);
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:knows')))->save();
     // Create the entity to be referenced.
     $this->target_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->target_entity->save();
     // Create the entity that will have the entity reference field.
     $this->entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->entity->save();
     $this->entity->{$this->fieldName}->entity = $this->target_entity;
     $this->entity->{$this->fieldName}->access = TRUE;
     $this->uri = $this->getAbsoluteUri($this->entity);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:18,代码来源:EntityReferenceRdfaTest.php


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