byjg/sparqllib
最新稳定版本:2.0.0
Composer 安装命令:
composer require byjg/sparqllib
包简介
Simple library to query SPARQL from PHP
README 文档
README
Copyright 2010,2011,2012 Christopher Gutteridge & University of Southampton Licensed as LGPL
Info
- Forked code by Joao Gilberto Magalhaes.
- Refactored code to support PHP 5.x namespaces, composer, autoload classes and unit tests;
- Full documentation: http://graphite.ecs.soton.ac.uk/sparqllib/
Example:
$db = new \SparQL\Connection( "http://rdf.ecs.soton.ac.uk/sparql/" ); $db->ns( "foaf","http://xmlns.com/foaf/0.1/" ); $sparql = "SELECT * WHERE { ?person a foaf:Person . ?person foaf:name ?name } LIMIT 5"; $result = $db->query( $sparql ); $fields = $result->fieldArray(); print "<p>Number of rows: " . $result->numRows() . " results.</p>"; print "<table class='example_table'>"; print "<tr>"; foreach( $fields as $field ) { print "<th>$field</th>"; }
Simplified call
$results = new \SparQL\Connection::get( "http://rdf.ecs.soton.ac.uk/sparql/" ) ->withNamespace( "foaf","http://xmlns.com/foaf/0.1/" ) ->fetch("SELECT * WHERE { ?person a foaf:Person . ?person foaf:name ?name } LIMIT 5"); foreach ($results as $item) { print "<th>" . $item["person"] }
Run tests
Just type:
phpunit
统计信息
- 总下载量: 50.37k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2015-04-11