User:Vedmaka/Semantic Query Interface

  Semantic Query Interface — mediawiki extension developed for devs who use Semantic Mediawiki extension.

It provides class for easy interaction with semantic data.

Current state: alpha, sub-objects are supported. Unmaintained at the moment, contributions are appreciated.

Usage examples edit

How to query for page properties? edit

$sqi = new \SQI\SemanticQueryInterface();
$properties = $sqi->from("SomePage")->toArray();

How to search for pages with specific property value? edit

$pages = $sqi->condition('My property', "Target value")->toArray();

How to get all pages from category? edit

$pages = $sqi->category("Some category")->toArray();

How to get pages match multiple conditions? edit

$pages = $sqi->condition('PropA','ValueA')
             ->condition('PropB','ValueB')
             ->condition('PropC','ValueC')
             ->toArray();

How to get specified property value from some page? edit

$value = $sqi->from('Some page')->printout('Specified property name')->toArray();

How to limit or offset query? edit

$sqi->category('One category')->category('And another category')->limit(10)->offset(5)->toArray();

How to count result? edit

$count = $sqi->from('Some page')->count();

How to sort result?

$sqi->sort('', 'DESC') // Sort by pagename descending
$sqi->sort('Property1', 'ASC') // Sort by property Property1 ascending

Note: every result page have special properties included:

  • Categories (array)
  • SubcategoryOf
  • ModificationDate
  • CreationDate
  • LastEditor

Downloads edit

You can download master branch from github. Please feel free to submit bugs and pull-requests.