User:Vedmaka/Semantic Query Interface

Sqi.png  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 examplesEdit

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

DownloadsEdit

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