schema.rdfs.org is planning to do a daily parsing of the schema.org site to update changes in terms, and it provides a JSON definition of the terms. It might make sense to update the terms via a call to the JSON file they provide. There could be a local copy that is refreshed, either regularly or on demand.

Comments

scor’s picture

Note I didn't use the JSON file straight from rdfs.schema.org as it was too heavy (> 300 KB) and contained a lot more data than what we needed for the use case of schemaorg.module (no need for all domain, range and superterms). It would be nice for rdfs.schema.org to offer some more lightweight version or a service to request only the data you need (e.g. id and comments).

sheldon rampton’s picture

I've created a separate module named "Schema.org cache" which retrieves and caches the full schema from http://schema.rdfs.org/all.json:

http://drupal.org/sandbox/sheldon/1867720

The attached patch to the Schema.org module will enable the Schema.org module to use this regularly-updated JSON source instead of the current hardcoded JSON file. I've wrapped the patch inside a module_exists() function so the Schema.org module will still work using the hardcoded file if the "Schema.org cache" module is not enabled.

sheldon rampton’s picture

Status: Active » Needs review
sheldon rampton’s picture

Can someone please review this patch so we can see about getting it committed?

I've released me Schema.org cache module as a full project on Drupal.org, but it's not very useful by itself unless the Schema.org module accepts this patch:

https://drupal.org/project/schemaorg_cache

scor’s picture

Status: Needs review » Needs work
+++ b/schemaorg_ui/schemaorg_ui.module
@@ -31,8 +31,12 @@ function schemaorg_ui_form_node_type_form_alter(&$form, $form_state) {
+    $schemaorg_terms_path = base_path() . drupal_get_path('module', 'schemaorg_ui') . '/js/schemaorg_ui.terms.json';
+    if (module_exists('schemaorg_cache')) {
+      $schemaorg_terms_path = '/schemaorg_cache/autocomplete';

I don't see how this would work on a site located in a sub directory.

Also, this does not require to patch the schema.org module, the path to the schema.org terms can be altered via a hook_form_alter() that is run after schemaorg_ui form_alter implementation? (provided your module has a higher db weight than schema.org).

sheldon rampton’s picture

@scor: Good point regarding a site located in a subdirectory.

Is there a means by which I can guarantee that my module has a higher db weight than schema.org upon installation?

scor’s picture

There are different ways of doing this: https://drupal.org/node/110238.

sheldon rampton’s picture

Status: Needs work » Closed (fixed)

@scor: Thanks for the help. I've gone ahead and fixed the Schema.org cache module so it no longer needs this patch, so I'm closing this ticket.

FYI, here's the Schema.org cache module's ticket number where I documented the fix:

https://drupal.org/node/2046843