Problem/Motivation

As described in the JSON-LD feature explanation, JSON-LD uses URIs for properties. In order to use JSON-LD as we want to, we need to create URIs for our fields and properties.

For example, field_tags might have a URI such as http://example.com/site-vocab/node/article/field_tags

It would be nice to use a consistent URI for certain universal properties such as UUID. However, determining which properties are universal properties and which are custom to the site is difficult. It may be better to just create a URI on the site for each term.

At the very least, we want to expose this for field instances and entity subtypes (bundles). We may also want to expose schema information for field types and entity types. These could have a subProperty and subClass relationship, which could possibly enable reasoning across sites that use the same field types.

We also need to have two vocabularies for the two supported domain models.

Proposed resolution

Base vocabulary URI

// Prefix = site
http://example.com/site-schema/

Terms from Drupal-specific domain model:

// Temp prefix = site-cs
http://example.com/site-schema/vnd-drupal/
--or--
http://example.com/site-schema/content-staging/

Entity type URIs

Common domain model:

// Entity type
site:entity/node
// Entity subtype
site:entity/node/article

Drupal specific domain model:

// Entity type
site-cs:entity/node
// Entity subtype
site-cs:entity/node/article

Field instance URIs -- primitive fields

Common domain model:

site:fields/node/article/field_body_value
site:fields/node/article/field_body_summary

Drupal specific domain model:

site-cs:fields/node/article/field_body
site-cs:field_types/text_textfield
site-cs:field_types/text_textfield/value
site-cs:field_types/text_textfield/summary
site-cs:field_types/text_textfield/format

Comments

scor’s picture

I had a chat with Lin about this yesterday during BADCamp, and I mostly agree. In my thesis I talked about a similar "site vocabulary" and I was using the path /ns# as namespace, but I think it's a bit obscure and /site-schema or /site-vocabulary is a better choice. This brings up the question of # URIs vs. 303 and httpRange-14 but I don't think it's something we need to worry about, it should work if the response describes only a particular field or content type, and we can live with the field and its representation being the same resource.

Regarding the local term of the content types, fields, if you look at an old example of such site vocabulary, I was using the content type directly as local term e.g. site:Article, but given that we want to support any entity type, we should prefix the entity type like node/ or comment/. For content types which are classes in the RDF world, the convention is to capitalize the first letter, so the machine name article becomes site:Article. This might look funny coming from a Drupal perspective where all machine names are lower case. I'm not sure this really matters too much given that these classes are not necessarily going to be reused outside the scope of content staging or schema sharing. External vocabularies will definitely continue to follow that convention though (schema.org, FOAF, DC, etc.). For properties, I was only modelling the fields (not their field properties), and I was namespacing them with the content type they belonged to, for example the title field of an article was article_Title. Slashes were not used because all terms were defined in the same site vocabulary document using hash URIs, but I find the slash URIs proposed in the OP more appealing.

Depending on which model is used for the serialization, and for sake of simplicity, we might want to stick to just one namespace even if there is some overlap and some terms are being defined in both namespaces. So for example, when serializing in the generic model, you might use site:entity/node/article, but when serializing in the Drupal specific model, use site-cs:entity/node/article. This would simplify the logic of the serializer, and these terms could be generated on the fly I believe (no need to store them since they follow a predictable pattern based on the various machine names).

@Lin: it might be good to show some examples of JSON-LD output using these proposed vocabulary URI patterns for both the generic and the Drupal specific models.

Edit: I think we should go ahead with the suggested patterns from the OP, as we can always rename the URIs after feature freeze, without changing the whole appoach.

scor’s picture

Issue summary: View changes

Added preliminary URI structure.

Anonymous’s picture

I added site-cs:field_types/text_textfield.

This would be the range of site-cs:fields/node/article/field_body, and the domain of site-cs:field_types/text_textfield/value, etc.

Anonymous’s picture

Anonymous’s picture

I've been rethinking this. Based on the fact that we want to expose all of the properties which have a bundle as their domain at the URI for that bundle, I think we might want to create separate types for the content staging and regular vocabularies.

For example,

site:entity/node/article
site-cs:entity/node/article

EDIT: I see that scor suggested this, so we're on the same page. I will edit the proposal to reflect this.

Anonymous’s picture

Issue summary: View changes

Added site-cs:field_types/text_textfield.

scor’s picture

Absolutely. I don't see a good use case for aligning both vocabularies anyways, it seems to me that the two models won't be used together in the same datasets. The future will tell, but for now just having one vocabulary for each model and just using that vocabulary when serializing the data keeps things nice and simple (relatively speaking). In any case OWL offers mechanisms for achieving ontology alignment if someone needs it, but that's not on the table for core.

scor’s picture

Issue summary: View changes

Edited vocabulary terms.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Active » Postponed (maintainer needs more info)

With RDF since removed from core wonder if this is still a valid task?

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.