professional-wiki/sparql
Composer 安装命令:
composer require professional-wiki/sparql
包简介
Allows running SPARQL queries via lua
关键字:
README 文档
README
MediaWiki extension for executing SPARQL queries and templating their results via Lua.
Professional.Wiki created and maintains SPARQL. We provide Wikibase hosting, Wikibase development, MediaWiki development, and Wikibase consulting.
Table of Contents
Usage Documentation
Define a lua module that requires the SPARQL binding and uses its runQuery method.
Example: create page Module:MySPARQL:
local sparql = require('SPARQL') -- Load the SPARQL binding local p = {} function p.showFirstValue(frame) local sparqlQuery = frame.args[1] local queryResults = sparql.runQuery(sparqlQuery) -- Use the runQuery method local firstColName = queryResults['head']['vars'][0] return queryResults['results']['bindings'][0][firstColName]['value'] end return p
Which can then be invoked via Scribunto's normal mechanisms from within wikitext. Example:
{{#invoke:MySPARQL|showFirstValue|your SPARQL query here}}
Lua module examples:
Installation
Platform requirements:
We also recommend installing the CodeEditor extension for a better editing experience of Lua modules.
Installing The SPARQL Extension
The recommended way to install the SPARQL extension is using Composer with MediaWiki's built-in support for Composer.
On the commandline, go to your wikis root directory. Then run these two commands:
COMPOSER=composer.local.json composer require --no-update professional-wiki/sparql:~1.0
composer update professional-wiki/sparql --no-dev -o
Then enable the extension by adding the following to the bottom of your wikis LocalSettings.php file:
wfLoadExtension( 'SPARQL' );
You can verify the extension was enabled successfully by opening your wikis Special:Version page.
PHP Configuration
Configuration can be changed via LocalSettings.php.
SPARQL Endpoint URL
Variable: $wgSPARQLEndpoint
Required for the extension to function. You can enable the extension without setting this variable without breaking your wiki, but the extension will not work.
Example:
$wgSPARQLEndpoint = 'https://query.portal.mardi4nfdi.de/proxy/wdqs/bigdata/namespace/wdq/sparql';
Development
Run composer install in extensions/SPARQL/ to make the code quality tools available.
Running Tests and CI Checks
You can use the Makefile by running make commands in the SPARQL directory.
make ci: Run everythingmake test: Run all testsmake phpunit --filter FooBar: run only PHPUnit tests with FooBar in their namemake phpcs: Run all style checksmake cs: Run all style checks and static analysis
Updating Baseline Files
Sometimes Psalm and PHPStan generate errors or warnings we do not wish to fix.
These can be ignored by adding them to the respective baseline file. You can update
these files with make stan-baseline and make psalm-baseline.
Release Notes
Version 2.0.0 - Under development
- Raised the minimum MediaWiki version from 1.39 to 1.43
Version 1.0.0 - 2023-11-24
- Lua binding
SPARQL.runQueryto execute SPARQL queries and return the results as a Lua table - Compatibility with MediaWiki 1.39, 1.40 and 1.41
- Compatibility with PHP 8.1 and 8.2
professional-wiki/sparql 适用场景与选型建议
professional-wiki/sparql 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 282 次下载、GitHub Stars 达 6, 最近一次更新时间为 2023 年 11 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sparql」 「mediawiki」 「wikibase」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 professional-wiki/sparql 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 professional-wiki/sparql 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 professional-wiki/sparql 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
SPARQL abstraction layer for PHP
Automatically logs-in users if they are already authenticated by a remote source. (e.g. environment variable REMOTE_USER)
An extension to Semantic MediaWiki allowing to build breadcrumb links from an attributive property filter
Helper functions for the MediaWiki ExtensionRegistry
Adds the EDTF data type to Wikibase
Provides line-by-line readers and iterators for Wikibase/Wikidata JSON dumps
统计信息
- 总下载量: 282
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2023-11-24