[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-12-11 Thread daniel
daniel added a comment.

@Physikerwelt Yes, that's the correct hook. In the hook handle, you would do 
something like this:

  public static function onWikibaseClientDataTypes( array &$dataTypeDefinitions 
) {
  $dataTypeDefinitions['PT:math'] = array(
  'value-type' => 'string',
  'validator-factory-callback' => function() {
  $repo = WikibaseRepo::getDefaultInstance();
  return new MathValidator( ... );
  },
  'parser-factory-callback' => function( $format, FormatterOptions 
$options ) {
  $repo = WikibaseRepo::getDefaultInstance();
  $normalizer = new WikibaseStringValueNormalizer( 
$repo->getStringNormalizer() );
  return new StringParser( $normalizer );
  }
  'formatter-factory-callback' => function( $format, FormatterOptions 
$options ) {
  $repo = WikibaseRepo::getDefaultInstance();
  return new MathFormatter( ... );
  },
  );
  }

Note the "PT:" prefix, indicating that "math" is a property type, not a value 
type ("VT:"). Also note that the extension point for adding data types is 
pretty new, and still in flux. The PT and VT prefixes were added only this 
week. I'll try to keep it more stable now though.


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

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

To: Physikerwelt, daniel
Cc: Llyrian, WickieTheViking, Aklapper, MGChecker, Micru, Sannita, 
Ricordisamoa, Rits, Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, 
Wikidata-bugs, Bene, Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-12-11 Thread Physikerwelt
Physikerwelt added a comment.

@daniel: @Llyrian and @WickieTheViking now have a good understand how WikiData 
works. Moreover, they managed to set up a testing environment at wmflabs. Now, 
the implementation must be done. Will the code go to the wikibase repo or can 
the math extension hook into wikidata without the requirement to modify 
wikibase extension code itself?
Moreover it would be nice, if the mathml mode could be enabled on wikidata. If 
you could point me to the server configuration file I can make a pull request 
for that.
https://github.com/wikimedia/operations-mediawiki-config/blob/5bc5ee989f22664648e2635dee1b0ed31711b04b/wmf-config/CommonSettings.php#L2171
Along the lines if wikidata -> $wgDefaultUserOptions['math'] = 'mathml'; But 
maybe there is more appropriate place to configure wikidata specific settings


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

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

To: Physikerwelt
Cc: Llyrian, WickieTheViking, Aklapper, MGChecker, Micru, Sannita, 
Ricordisamoa, Rits, Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, 
Wikidata-bugs, Bene, Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-12-11 Thread Physikerwelt
Physikerwelt added a comment.

@daniel... is that https://gerrit.wikimedia.org/r/#/c/228854/17/docs/hooks.txt 
the hook I'm looking for?


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

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

To: Physikerwelt
Cc: Llyrian, WickieTheViking, Aklapper, MGChecker, Micru, Sannita, 
Ricordisamoa, Rits, Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, 
Wikidata-bugs, Bene, Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-11-12 Thread Physikerwelt
Physikerwelt added a comment.

@daniel: What is special about the display code:
I would imagine something like

  $renderer = MathRenderer::getRenderer( $tex, array('id'=>$wikidataId, 
'mathml' );
  $checkResult = $renderer->checkTex();
  ...
  $renderer->render()
  $renderer->getHtmlOutput();


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

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

To: Physikerwelt
Cc: WickieTheViking, Aklapper, MGChecker, Micru, Sannita, Ricordisamoa, Rits, 
Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, Wikidata-bugs, Bene, 
Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-11-12 Thread daniel
daniel added a comment.

@Physikerwelt if the math extension offers a nice interface like that, then 
it's probably just that easy, yea :)


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

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

To: Physikerwelt, daniel
Cc: WickieTheViking, Aklapper, MGChecker, Micru, Sannita, Ricordisamoa, Rits, 
Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, Wikidata-bugs, Bene, 
Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-11-11 Thread Physikerwelt
Physikerwelt added a comment.

In https://phabricator.wikimedia.org/T67397#1326574, @Bene wrote:

> Should this datatype go into its own extension or should Wikibase have a soft 
> dependency on the Math extension 
> ?


If that's possible I'd prefer that. Are there examples of other data types 
implementd in extensions?
cf. https://github.com/TU-Berlin-DIMA/dbproW15WikiData/issues/2


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

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

To: Physikerwelt
Cc: WickieTheViking, Aklapper, MGChecker, Micru, Sannita, Ricordisamoa, Rits, 
Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, Wikidata-bugs, Bene, 
Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-11-11 Thread Physikerwelt
Physikerwelt added a comment.

@Lydia_Pintscher: I thought this would be an optimal task for our database 
project course. In the database project course students apply their knowledge 
on databases and data modelling they obtained in classes on database management 
to real world problems. I think it would be super awesome if some of the effort 
that is spent in this class could actually be used in production.


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

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

To: Physikerwelt
Cc: WickieTheViking, Aklapper, MGChecker, Micru, Sannita, Ricordisamoa, Rits, 
Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, Wikidata-bugs, Bene, 
Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-11-11 Thread Lydia_Pintscher
Lydia_Pintscher added a comment.

Hah! Yeah if it gets done by the students let's actually make it so they can 
get the code into production. In this case I would also advise against making 
it its own extension as that complicates code review and deployment 
considerably (for little gain here as far as I can see).


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

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

To: Physikerwelt, Lydia_Pintscher
Cc: WickieTheViking, Aklapper, MGChecker, Micru, Sannita, Ricordisamoa, Rits, 
Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, Wikidata-bugs, Bene, 
Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-11-11 Thread Lydia_Pintscher
Lydia_Pintscher added a comment.

@physikerwelt: You want to do it? That's be awesome! Before you start I think 
we should have a quick chat as there are still a few things in the air about 
this. I'd hate for you to waste time on dead-ends.


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

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

To: Physikerwelt, Lydia_Pintscher
Cc: WickieTheViking, Aklapper, MGChecker, Micru, Sannita, Ricordisamoa, Rits, 
Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, Wikidata-bugs, Bene, 
Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs


[Wikidata-bugs] [Maniphest] [Commented On] T67397: [Story] add a new datatype for formulas

2015-11-11 Thread daniel
daniel added a comment.

@Physikerwelt I'm afraid implementing this will have next to nothing to do with 
databasemodelling. It's more an exerciser in integrating the math extension 
with wikibase.

To answer your questions regarding datatypes being implemented by extensions: 
there are no examples, because we are only now making it possible to 
dynamically define datatypes.


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

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

To: Physikerwelt, daniel
Cc: WickieTheViking, Aklapper, MGChecker, Micru, Sannita, Ricordisamoa, Rits, 
Liuxinyu970226, NiharikaKohli, Tpt, Physikerwelt, Wikidata-bugs, Bene, 
Tobias1984, Lydia_Pintscher, daniel, aude, Mbch331



___
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs