Nevalicori added a subscriber: Nevalicori.
Nevalicori added a comment.

Looking at wikibase:repo/includes/rdf/RdfSerializer.php and friends, there are 
a few places where this could be inserted fairly safely, depending upon project 
preference about abstraction cleanliness.

By the looks of the way the methods are separated, 
RdfSerializer::buildGraphForEntityRevision() looks intended to build a clean 
graph without any particular awareness of the requested serialisation, with 
RdfSerializer::serializeRdf() performing the actual serialisation of the actual 
graph.

This presents a little bit of a quandry: I can't see any reason why either 
method (or the helper method RdfSerializer::serializeEntityRevision()) couldn't 
perform graph modifications themselves, but it feels messy. On the other hand, 
RdfBuilder doesn't know what format the built graph will be serialised as (nor 
should it), but it also doesn't obviously know what all of the serialisations 
might be, either, so a generic solution there would require a bit more effort.

As a first pass, inserting something akin to:

  /* Indicate that the concrete representation is licensed as the abstract 
document is */
  $graph = $builder->getGraph();
  $concreteResource = $builder->getGraph()->resource( $dataURL . '.' . 
$this->format->getDefaultExtension() );
  $concreteResource->addResource( RdfBuilder::NS_CC . ':license', 
'http://creativecommons.org/publicdomain/zero/1.0/' );

around here 
<https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FWikibase/f4b572f05d74979e39ace26a21a1b7145fd99015/repo%2Fincludes%2Frdf%2FRdfSerializer.php#L129>
 would at least achieve the desired result, if a little messily than one might 
like.

(For bonus points one could throw in the dct:hasFormat or dct:isFormatOf, too, 
though I'd make keep the licensing statement attached to the concrete 
representation regardless to limit the hoops that processors need to jump 
through before they can determine whether something is licensed for their needs 
or not; self-interest side-note: I have such a discriminating processor 
<https://github.com/bbcarchdev/anansi/blob/develop/processors/lod.c#L203>).

//Note:// I don't have a running copy of Wikibase here, so this is entirely 
mental programming, apologies for any stupid errors.


TASK DETAIL
  https://phabricator.wikimedia.org/T73991

REPLY HANDLER ACTIONS
  Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign 
<username>.

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Nevalicori
Cc: Nevalicori, Wikidata-bugs, Lydia_Pintscher, daniel, aude



_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to