Other module should be able to alter the RDF model while it's getting built, for example to add more triples if the generic entity API based algorithm does not support some required triples.

Comments

scor’s picture

Status: Active » Needs review
StatusFileSize
new559 bytes
bkudrle’s picture

Patch was applied successfully in the Quickstart environment and passed all of the RDF and RDFx simpletests. I plan on doing some tests with other modules as well.

scor’s picture

Issue tags: +RDF, +sprint

tagging

Anonymous’s picture

Using drupal_alter at this point will result in a further divergence between RDFa and other serializations of the same resource, and one which doesn't come from the differences in syntax itself.

I don't have an issue in particular with this, but it will rile the pedants.

scor’s picture

True. One the other hand, wouldn't it help to add to the RDF model the bits which are only present in RDFa? There might be cases though where some data does not make sense to appear in the HTML because it's too verbose or naturally doesn't appear in HTML (I agree it could be added with hidden metadata elements though). Danbri also made the argument that there is no rule, and that "there are all kinds of reasons why human-facing HTML pages vs feed-style RDF/XML links would be organized differently".

Let's try to find a compromise here. I think that at least anything that appears in RDFa should also appear in the RDF model (and thus any serialization + SPARQL Endpoint).

Anonymous’s picture

Dan Bri also says:

on the other hand, having things diverge without reason can also confuse

It should at least be very clearly documented that this shouldn't be used as a hack workaround and that people should register their predicates with the core Mapping API to the greatest degree possible.

scor’s picture

Assigned: Unassigned » scor
Status: Needs review » Needs work

I agree, this needs to be documented. I'll take care of that.

scor’s picture

Status: Needs work » Needs review
StatusFileSize
new657 bytes

here is an updated patch with a warning on diverging RDF data. Does that address your concerns, Lin?

Anonymous’s picture

Status: Needs review » Needs work

I don't believe it's strong enough, and it is difficult to parse.

I would say:

Allow other modules to alter the RDF data model before serialization. For example, a module could add elements which are not supported by the Entity API.

This should only be used in special cases. The data is not added to Drupal's internal model, and is thus not accessible to other modules or during Drupal's normal rendering stream. It will only show up in non-RDFa serializations of the entity.

scor’s picture

Status: Needs work » Needs review
StatusFileSize
new954 bytes

Thanks Lin, incorporated your suggestion. Also split the index attachment and CURIEs expansion so the drupal_alter() happens in between the two.

ashepherd’s picture

I'm wondering if the $id the drupal_alter() line was meant to refer to the entity id, the $wrapper->getIdentifier()

drupal_alter('rdf_model', $res, $type, $id);
to
drupal_alter('rdf_model', $res, $type, $wrapper->getIdentifier());

my apologies, I was working off of "7.x-2.0-alpha4"

ashepherd’s picture

Issue summary: View changes

fix typo

scor’s picture

Not sure I understand your question. yes, $id is the entity ID passed to the rdfx_get_rdf_model(). It might be the same as $wrapper->getIdentifier().

scor’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

I've been using this patch on a few projects and it's working well. I'm planning to commit this in 2 weeks.

scor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.