Event:168: Difference between revisions
Jump to navigation
Jump to search
Bryandamon (talk | contribs) No edit summary |
Bryandamon (talk | contribs) (→) |
||
Line 20: | Line 20: | ||
==Notes== | ==Notes== | ||
===Chat transcript=== | |||
# '''Gergo Tisza:''' https://etherpad.wikimedia.org/p/mwstake-2023-03 | |||
# '''Brian Wolff:''' JsonP is the name of a different technology. That was popular about 10 years ago | |||
# '''Greg Rundlett:''' ahh, that was my confusion | |||
# '''Bernhard Krabina:''' https://www.semantic-mediawiki.org/wiki/Help:Datatables_format_(v2) | |||
# '''Greg Rundlett:''' This jQuery plugin right? https://datatables.net/ | |||
# '''Greg Rundlett:''' ^ yes | |||
# '''Greg Rundlett:''' As seen here: https://www.semantic-mediawiki.org/wiki/Help:Plug-ins | |||
# '''Greg Rundlett:''' I'm wondering about a Q I entered in Element.... How would you best access SMW properties from PHP / export to JS? | |||
# '''Bernhard Krabina:''' maybe this helps? https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/architecture/querying.data.md | |||
# '''Charlot Cobben:''' Get a SMW property: | |||
#: <syntaxhighlight lang="JS" style="max-width:850px"> | |||
public static function getSemanticProperty( $title, string $propertyLabel ) { | |||
if ( $title === null ) { | |||
return null; | |||
} | |||
if ( is_string( $title ) ) { | |||
$title = Title::newFromText( $title ); | |||
} | |||
// Use Semantic MediaWiki code to properly retrieve the value | |||
$page = SMWDIWikiPage::newFromTitle( $title ); | |||
$store = StoreFactory::getStore(); | |||
$data = $store->getSemanticData( $page ); | |||
$property = SMWDIProperty::newFromUserLabel( $propertyLabel ); | |||
$values = $data->getPropertyValues( $property ); | |||
if ( count( $values ) > 0 ) { | |||
$value = array_shift( $values ); | |||
if ( method_exists( $value, 'getTitle' ) ) { | |||
return $value->getTitle(); | |||
} | |||
return $value->getString(); | |||
} else { | |||
return null; | |||
} | |||
}</syntaxhighlight> | |||
# '''Thomas-topway-it:''' yes, I recognize it | |||
# '''Greg Rundlett:''' Posted above into Element for 'saving' outside this meeting | |||
# '''Brian Wolff:''' FREEDOM is the issue 🇺🇸 🇺🇸 🦅🦅 | |||
# '''Bryan:''' @Charly, did Google cut off some of your code? | |||
# '''Charlot Cobben:''' Google? I copied it from some code I have... I'll put in in Element | |||
# '''Bernhard Krabina:''' just read about Elastic vs. OpenSearch here: https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/5451 | |||
# '''Bryan:''' Google Meet chat, I think it cut off the end? | |||
# '''Charlot Cobben:''' I mean etherpad | |||
# '''Gergo Tisza:''' https://phabricator.wikimedia.org/T280482 | |||
==Action board== | ==Action board== |
Revision as of 12:36, 3 March 2023
Date (UTC): | 3 March 2023 16:30:00 - 3 March 2023 17:30:00 |
---|---|
URL: | https://meet.google.com/mdd-ufhn-ksb |
Etherpad: | https://etherpad.wikimedia.org/p/mwstake-2023-03
|
Attendees: | Ad Strack van Schijndel, Bernhard Krabina, Brian Wolff, Bryan Hildebrand, Charlot Cobben, Cindy Cicalese, Gergő Tisza, Greg Rundlett, Jared Olson, Mark Hershberger, Thomas Topway |
Click for time zone conversion
Meeting agenda
- Wait for attendees & chat 5 min
- Wiki Quickie 5 min TBD
- MediaWiki News 20 min Mark
- Editing JSON with FlexForm 15 min Charly
- Especially when dealing with scientific data stored as json in a wiki, it can be very useful to be able to edit that data or perhaps enrich it. But also a simpler jsons for e.g. a menu structure would be great to edit. I'd like to demonstrate how to identify the data you are using inside a variant of a json schema and how you can then edit all this data very easily with FlexForm.
- Wiki Watercooler remaining Open Mic
Notes
Chat transcript
- Gergo Tisza: https://etherpad.wikimedia.org/p/mwstake-2023-03
- Brian Wolff: JsonP is the name of a different technology. That was popular about 10 years ago
- Greg Rundlett: ahh, that was my confusion
- Bernhard Krabina: https://www.semantic-mediawiki.org/wiki/Help:Datatables_format_(v2)
- Greg Rundlett: This jQuery plugin right? https://datatables.net/
- Greg Rundlett: ^ yes
- Greg Rundlett: As seen here: https://www.semantic-mediawiki.org/wiki/Help:Plug-ins
- Greg Rundlett: I'm wondering about a Q I entered in Element.... How would you best access SMW properties from PHP / export to JS?
- Bernhard Krabina: maybe this helps? https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/architecture/querying.data.md
- Charlot Cobben: Get a SMW property:
-
public static function getSemanticProperty( $title, string $propertyLabel ) { if ( $title === null ) { return null; } if ( is_string( $title ) ) { $title = Title::newFromText( $title ); } // Use Semantic MediaWiki code to properly retrieve the value $page = SMWDIWikiPage::newFromTitle( $title ); $store = StoreFactory::getStore(); $data = $store->getSemanticData( $page ); $property = SMWDIProperty::newFromUserLabel( $propertyLabel ); $values = $data->getPropertyValues( $property ); if ( count( $values ) > 0 ) { $value = array_shift( $values ); if ( method_exists( $value, 'getTitle' ) ) { return $value->getTitle(); } return $value->getString(); } else { return null; } }
-
- Thomas-topway-it: yes, I recognize it
- Greg Rundlett: Posted above into Element for 'saving' outside this meeting
- Brian Wolff: FREEDOM is the issue 🇺🇸 🇺🇸 🦅🦅
- Bryan: @Charly, did Google cut off some of your code?
- Charlot Cobben: Google? I copied it from some code I have... I'll put in in Element
- Bernhard Krabina: just read about Elastic vs. OpenSearch here: https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/5451
- Bryan: Google Meet chat, I think it cut off the end?
- Charlot Cobben: I mean etherpad
- Gergo Tisza: https://phabricator.wikimedia.org/T280482
Action board
this page for more information
SeeOpen | |||
---|---|---|---|
|