diff --git a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php index cfffa8c..8acb212 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/JsonldEntityWrapper.php @@ -78,7 +78,7 @@ public function getId() { public function getTypeUri() { $entity_type = $this->entity->entityType(); $bundle = $this->entity->bundle(); - return url('site-schema/content-staging/' . $entity_type . '/' . $bundle, array('absolute' => TRUE)); + return url('site-schema/content-deployment/' . $entity_type . '/' . $bundle, array('absolute' => TRUE)); } /** diff --git a/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php b/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php index 9ecfda5..e4b1636 100644 --- a/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php +++ b/core/modules/jsonld/lib/Drupal/jsonld/Tests/NormalizeDenormalizeTest.php @@ -147,7 +147,7 @@ public function testNormalize() { function testDenormalize() { $incomingData = array( - '@type' => url('jsonld-test/content-staging/entity_test/entity_test', array('absolute' => TRUE)), + '@type' => url('jsonld-test/content-deployment/entity_test/entity_test', array('absolute' => TRUE)), 'name' => array( 'en' => array( array( diff --git a/core/modules/rdf/lib/Drupal/rdf/EventSubscriber/RouteSubscriber.php b/core/modules/rdf/lib/Drupal/rdf/EventSubscriber/RouteSubscriber.php index 625e1a3..f05d12b 100644 --- a/core/modules/rdf/lib/Drupal/rdf/EventSubscriber/RouteSubscriber.php +++ b/core/modules/rdf/lib/Drupal/rdf/EventSubscriber/RouteSubscriber.php @@ -9,7 +9,6 @@ use Drupal\Core\Routing\RouteBuildEvent; use Drupal\Core\Routing\RoutingEvents; use Drupal\rdf\SiteSchema\SiteSchema; -use Drupal\rdf\SiteSchema\SchemaConstants; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Routing\Route; @@ -30,8 +29,8 @@ public function routes(RouteBuildEvent $event) { // The paths of the site-generated schemas. $schemaPaths = array( - SchemaConstants::CONTENT_STAGING, - SchemaConstants::SYNDICATION, + SiteSchema::CONTENT_DEPLOYMENT, + SiteSchema::SYNDICATION, ); // Add the routes for all of the terms in both schemas. diff --git a/core/modules/rdf/lib/Drupal/rdf/RdfConstants.php b/core/modules/rdf/lib/Drupal/rdf/RdfConstants.php index e3bd9ab..f970e44 100644 --- a/core/modules/rdf/lib/Drupal/rdf/RdfConstants.php +++ b/core/modules/rdf/lib/Drupal/rdf/RdfConstants.php @@ -13,6 +13,7 @@ abstract class RdfConstants { const RDF_TYPE = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'; // RDF Schema terms. + const RDFS_CLASS = 'http://www.w3.org/2000/01/rdf-schema#class'; const RDFS_DOMAIN = 'http://www.w3.org/2000/01/rdf-schema#domain'; const RDFS_IS_DEFINED_BY = 'http://www.w3.org/2000/01/rdf-schema#isDefinedBy'; const RDFS_RANGE = 'http://www.w3.org/2000/01/rdf-schema#range'; diff --git a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/BundleSchema.php b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/BundleSchema.php index 4ea9839..4a04222 100644 --- a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/BundleSchema.php +++ b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/BundleSchema.php @@ -9,13 +9,14 @@ use Drupal\rdf\RdfConstants; use Drupal\rdf\SiteSchema\EntitySchema; -use Drupal\rdf\SiteSchema\SchemaConstants; /** * Defines RDF terms corresponding to Drupal bundles. */ class BundleSchema extends EntitySchema { + const URI_PATTERN = '{entity_type}/{bundle}'; + /** * The bundle that this term identifies. * @@ -26,7 +27,7 @@ class BundleSchema extends EntitySchema { /** * Constructor. * - * @param \Drupal\rdf\SiteSchema $siteSchema + * @param \Drupal\rdf\SiteSchema\SiteSchema $siteSchema * The schema the term is defined in. * @param string $entity_type * The entity type. @@ -42,7 +43,7 @@ public function __construct($siteSchema, $entity_type, $bundle) { * Implements \Drupal\rdf\SiteSchema\SchemaBase::getUri(). */ public function getUri() { - $path = str_replace(array('{entity_type}', '{bundle}'), array($this->entityType, $this->bundle), SchemaConstants::URI_PATTERN_BUNDLE); + $path = str_replace(array('{entity_type}', '{bundle}'), array($this->entityType, $this->bundle), self::URI_PATTERN); return $this->siteSchema->getUri() . $path; } diff --git a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/EntitySchema.php b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/EntitySchema.php index 74d01ac..362494e 100644 --- a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/EntitySchema.php +++ b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/EntitySchema.php @@ -7,14 +7,16 @@ namespace Drupal\rdf\SiteSchema; +use Drupal\rdf\RdfConstants; use Drupal\rdf\SiteSchema\SchemaBase; -use Drupal\rdf\SiteSchema\SchemaConstants; /** * Defines RDF terms corresponding to Drupal entity types. */ class EntitySchema extends SchemaBase { + const URI_PATTERN = '{entity_type}'; + /** * The entity type that this term identifies. * @@ -39,7 +41,7 @@ public function __construct($siteSchema, $entity_type) { * Implements \Drupal\rdf\SiteSchema\SchemaBase::getUri(). */ public function getUri() { - $path = str_replace('{entity_type}', $this->entityType , SchemaConstants::URI_PATTERN_ENTITY); + $path = str_replace('{entity_type}', $this->entityType , self::URI_PATTERN); return $this->siteSchema->getUri() . $path; } @@ -48,6 +50,7 @@ public function getUri() { */ public function getProperties() { $properties = parent::getProperties(); + $properties[RdfConstants::RDF_TYPE] = RdfConstants::RDFS_CLASS; return $properties; } diff --git a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SchemaBase.php b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SchemaBase.php index 7c116f2..429788b 100644 --- a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SchemaBase.php +++ b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SchemaBase.php @@ -47,7 +47,7 @@ public function getProperties() { * Get the URI of the term. * * Implementations of this method will use the URI patterns defined in - * SchemaConstants and replace placeholders with actual values. + * URI_PATTERN constants and replace placeholders with actual values. * * @return string * The URI of the term. diff --git a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SchemaConstants.php b/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SchemaConstants.php deleted file mode 100644 index 95c1f9a..0000000 --- a/core/modules/rdf/lib/Drupal/rdf/SiteSchema/SchemaConstants.php +++ /dev/null @@ -1,20 +0,0 @@ - $this->schemaPath . SchemaConstants::URI_PATTERN_BUNDLE, + 'bundle' => $this->schemaPath . BundleSchema::URI_PATTERN, ); } } diff --git a/core/modules/rdf/lib/Drupal/rdf/Tests/SiteSchemaTest.php b/core/modules/rdf/lib/Drupal/rdf/Tests/SiteSchemaTest.php index a23a03c..f0e55f0 100644 --- a/core/modules/rdf/lib/Drupal/rdf/Tests/SiteSchemaTest.php +++ b/core/modules/rdf/lib/Drupal/rdf/Tests/SiteSchemaTest.php @@ -9,7 +9,6 @@ use Drupal\rdf\SiteSchema\BundleSchema; use Drupal\rdf\SiteSchema\SiteSchema; -use Drupal\rdf\SiteSchema\SchemaConstants; use Drupal\simpletest\WebTestBase; /** @@ -37,15 +36,16 @@ public static function getInfo() { */ function testSiteSchema() { $entityType = $bundle = 'entity_test'; - $schema = new SiteSchema(SchemaConstants::SYNDICATION); + $schema = new SiteSchema(SiteSchema::SYNDICATION); $schemaPath = 'site-schema/syndication/'; // Bundle. $bundleSchema = $schema->bundle($entityType, $bundle); $bundleUri = url("$schemaPath$entityType/$bundle", array('absolute' => TRUE)); $bundleProperties = array( - "http://www.w3.org/2000/01/rdf-schema#isDefinedBy" => url($schemaPath, array('absolute' => TRUE)), - "http://www.w3.org/2000/01/rdf-schema#subClassOf" => url("$schemaPath$entityType", array('absolute' => TRUE)), + 'http://www.w3.org/2000/01/rdf-schema#isDefinedBy' => url($schemaPath, array('absolute' => TRUE)), + 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' => 'http://www.w3.org/2000/01/rdf-schema#class', + 'http://www.w3.org/2000/01/rdf-schema#subClassOf' => url("$schemaPath$entityType", array('absolute' => TRUE)), ); $this->assertEqual($bundleSchema->getUri(), $bundleUri, 'Bundle term URI is generated correctly.');