Event:168: Difference between revisions

From MWStake
Jump to navigation Jump to search
No edit summary
()
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 13:36, 3 March 2023

Blank.png Date (UTC): 3 March 2023 16:30:00 - 3 March 2023 17:30:00
Blank.png URL: https://meet.google.com/mdd-ufhn-ksb
Blank.png Etherpad: https://etherpad.wikimedia.org/p/mwstake-2023-03

Person.png 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

{{#copywatchers: Template:Event}}

Meeting agenda

  1. Wait for attendees & chat 5 min
  2. Wiki Quickie 5 min TBD
  3. MediaWiki News 20 min Mark
  4. 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.
  5. Wiki Watercooler remaining Open Mic

Notes

Chat transcript

  1. Gergo Tisza: https://etherpad.wikimedia.org/p/mwstake-2023-03
  2. Brian Wolff: JsonP is the name of a different technology. That was popular about 10 years ago
  3. Greg Rundlett: ahh, that was my confusion
  4. Bernhard Krabina: https://www.semantic-mediawiki.org/wiki/Help:Datatables_format_(v2)
  5. Greg Rundlett: This jQuery plugin right? https://datatables.net/
  6. Greg Rundlett: ^ yes
  7. Greg Rundlett: As seen here: https://www.semantic-mediawiki.org/wiki/Help:Plug-ins
  8. Greg Rundlett: I'm wondering about a Q I entered in Element.... How would you best access SMW properties from PHP / export to JS?
  9. Bernhard Krabina: maybe this helps? https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/master/docs/architecture/querying.data.md
  10. 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;
       }
    }
    
  11. Thomas-topway-it: yes, I recognize it
  12. Greg Rundlett: Posted above into Element for 'saving' outside this meeting
  13. Brian Wolff: FREEDOM is the issue 🇺🇸 🇺🇸 🦅🦅
  14. Bryan: @Charly, did Google cut off some of your code?
  15. Charlot Cobben: Google? I copied it from some code I have... I'll put in in Element
  16. Bernhard Krabina: just read about Elastic vs. OpenSearch here: https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/5451
  17. Bryan: Google Meet chat, I think it cut off the end?
  18. Charlot Cobben: I mean etherpad
  19. Gergo Tisza: https://phabricator.wikimedia.org/T280482

Action board

Search actions Add an action See this page for more information

Open
None of these labels
+ MWStake