sweetrdf/easyrdf
Composer 安装命令:
composer require sweetrdf/easyrdf
包简介
EasyRdf is a PHP library designed to make it easy to consume and produce RDF.
README 文档
README
Note
This is a fork of the Original Easyrdf library written by Nicholas Humfrey. I maintain it in my spare time to keep it alive and usable on the latest PHP versions. Code is more or less maintained but not developed any further. If you wanna participate, feel free to open a pull request!
About EasyRdf
EasyRdf is a PHP library designed to make it easy to consume and produce RDF. It was designed for use in mixed teams of experienced and inexperienced RDF developers. It is written in Object Oriented PHP and has been tested extensively using PHPUnit.
After parsing EasyRdf builds up a graph of PHP objects that can then be walked around to get the data to be placed on the page. Dump methods are available to inspect what data is available during development.
Data is typically loaded into an EasyRdf\Graph object from source RDF
documents, loaded from the web via HTTP. The EasyRdf\GraphStore class
simplifies loading and saving data to a SPARQL 1.1 Graph Store.
SPARQL queries can be made over HTTP to a Triplestore using the
EasyRdf\Sparql\Client class. SELECT and ASK queries will return an
EasyRdf\Sparql\Result object and CONSTRUCT and DESCRIBE queries will return
an EasyRdf\Graph object.
Example
$foaf = new \EasyRdf\Graph("https://www.aelius.com/njh/foaf.rdf"); $foaf->load(); $me = $foaf->primaryTopic(); echo "My name is: ".$me->get('foaf:name')."\n";
Requirements
- PHP 8.0 or higher
- PHP Extensions: dom, mbstring, pcre, xmlreader
- PHP Libs: libxml
Features
- No required external dependencies upon other libraries (PEAR, etc...)
- Library runs in Linux and Windows environments
- Extensive unit tests written using PHPUnit
- Built-in parsers and serialisers: RDF/JSON, N-Triples, RDF/XML, Turtle
- Optional parsing support for: ARC2, rapper
- Optional support for
Laminas\Http\Client - Type mapper - resources of type
foaf:Personcan be mapped into PHP object of classFoaf_Person - Support for visualisation of graphs using GraphViz
- Comes with a number of examples
Documentation
EasyRdf documentation is scarce at the moment, but here is what we have already. Additions/changes are welcome.
List of Examples
basic.php- Basic "Hello World" type examplebasic_sparql.php- Example of making a SPARQLSELECTqueryconverter.php- Convert RDF from one format to anotherdump.php- Display the contents of a graphfoafinfo.php- Display the basic information in a FOAF documentfoafmaker.php- Construct a FOAF document with a choice of serialisationsgraph_direct.php- Example of usingEasyRdf\Graphdirectly withoutEasyRdf\Resourcegraphstore.php- Store and retrieve data from a SPARQL 1.1 Graph Storegraphviz.php- GraphViz rendering examplehtml_tag_helpers.php- Rails Style html tag helpers to make the EasyRdf examples simplerhttpget.php- No RDF, just testEasyRdf\Http\Clientopen_graph_protocol.php- Extract Open Graph Protocol metadata from a webpageserialise.php- Basic serialisation examplesparql_queryform.php- Form to submit SPARQL queries and display the resultuk_postcode.php- Example of resolving UK postcodes using uk-postcodes.comwikidata_villages.php- Fetch and information about villages in Fife from Wikidata
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for further information.
For further information about extending / hack EasyRdf please read DEVELOPER.md.
Further mainainers are possible, please send an email to @k00ni.
Running Examples
The easiest way of trying out some of the examples is to use the PHP command to run a local web server on your computer.
php -S localhost:8080 -t examples
Then open the following URL in your browser: http://localhost:8080/
Why this fork? (written in late 2020)
EasyRdf was in maintenance mode since 2017 (link) and not actively maintained since. There were 6+ pull requests pending at that time with fixes and new features. Its sad to see another RDF PHP project die slowly, so I decided to clean house and give the code a new home (further info). A few months in late 2020 EasyRdf was actively improved (me being a co-maintainer for a while), but that stopped and decay began again. It was a frustating time, lets leave it at that.
In the end I decided to abandon my old fork and start fresh with latest EasyRdf improvements in this repository.
What can you expect as a user?
This fork (v1.*) aims to be a drop-in replacement for the easyrdf/easyrdf package, which means, you can use it without changing your code. But you should still read the notes of the latest release, to make sure nothing unexpected happens after an update.
What can you expect as an EasyRdf developer?
This repository is set up in a way to lower the maintenance overhead in comparison to the original version. Test related tools were partly replaced with more lightweight solutions. Furthermore this repository is held by an organization instead of a user, which allows more flexible maintenance.
Licensing
The EasyRdf library and tests are licensed under the BSD-3-Clause license. The examples are in the public domain, for more information see UNLICENSE.
sweetrdf/easyrdf 适用场景与选型建议
sweetrdf/easyrdf 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.45M 次下载、GitHub Stars 达 26, 最近一次更新时间为 2021 年 03 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rdfa」 「RDF」 「Semantic Web」 「Turtle」 「sparql」 「Linked Data」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sweetrdf/easyrdf 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sweetrdf/easyrdf 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sweetrdf/easyrdf 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP adapter for Create.js
Microdata, RDFa Lite & JSON-LD structured data reader
Schema.org library for PHP
This PHP library can easily parse xml files, especially RSS1.0, RSS2.0 and ATOM.
An extension to Semantic MediaWiki allowing to build breadcrumb links from an attributive property filter
Minimal CSS Framework for semantic HTML.
统计信息
- 总下载量: 1.45M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 26
- 点击次数: 30
- 依赖项目数: 14
- 推荐数: 1
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2021-03-03