A new EasyRdf\\Graph object is created and then the contents of my FOAF profile is loaded from the web. An EasyRdf\\Resource for the primary topic of the document (me, Nicholas Humfrey) is returned and then used to display my name.
This example creates a new SPARQL client, pointing at the dbpedia.org endpoint. It then makes a SELECT query that returns all of the countries in DBpedia along with an english label.
Note how the namespace prefix declarations are automatically added to the query.
The source RDF data can either be fetched from the web or typed into the Input box.
The first thing that this script does is make a list the names of the supported input and output formats. These options are then displayed on the HTML form.
The input data is loaded or parsed into an EasyRdf\\Graph. That graph is than outputted again in the desired output format.
Data from the chosen URI is loaded into an EasyRdf\\Graph object. Then the graph is dumped and printed to the page using the $graph->dump() method.
The call to preg_replace() replaces links in the page with links back to this dump script.
The example starts by loading the requested FOAF document from the web. It then tries to work out if the URI given was for the person or the document about the person.
If a person is found, then the person's name, homepage and description are shown, along with a list of the person's friends.
This example is similar in concept to Leigh Dodds' FOAF-a-Matic. The fields in the HTML form are inserted into an empty EasyRdf\\Graph and then serialised to the chosen format.
Triple data is inserted and retrieved directly from a graph object, where it is stored internally as an associative array.
This example adds a triple containing the current time into a local graph store. It then fetches the whole graph out and displays the contents.
Note that you will need a graph store, for example RedStore, running on your local machine in order to test this example.
This example demonstrates converting an EasyRdf\\Graph into the GraphViz graph file language. Using the 'Use Labels' option, you can have resource URIs replaced with text based labels and using 'Only Labelled' option, only the resources and properties with a label will be displayed.
Rending a graph to an image will only work if you have the GraphViz 'dot' command installed.
This example does nothing but test EasyRdf's build in HTTP client. It demonstrates setting Accept headers and displays the response headers and body.
Fetches and parses an HTML, reading the Open Graph Protocol data from the page. Open Graph Protocol uses a subset of RDFa.
The example demonstrates fetching an RSS 1.0 feed from the web and then parsing as RDF/XML. The channel is found by getting the first object of type rss:channel (a file should only contain a single RSS channel).
In RSS 1.0, the list of items in the feed are listed by relating the rss:channel to the rss:items using an rdf:Seq. In EasyRdf this maps into an EasyRdf\\Container object, which can be iterated over using a foreach() loop.
Note that this example only works with RSS 1.0 and no other version (0.90, 1.1 and 2.0) as they are not RDF.
This example create a simple FOAF graph in memory and then serialises it to the page in the format of choice.
This example presents a form that you can enter the URI of a a SPARQL endpoint and a SPARQL query into. The results are displayed using a call to dump() on what will be either a EasyRdf\\Sparql\\Result or EasyRdf\\Graph object.
A list of registered namespaces is displayed above the query box - any of these namespaces can be used in the query and PREFIX statements will automatically be added to the start of the query string.
Another basic example that demonstrates registering namespaces, loading RDF data from the web and then directly displaying literals from the graph on the page.
This example demonstrates fetching information about villages in Fife from Wikidata. The list of villages is fetched by running a SPARQL query.
If you click on an village, then it fetched by getting the Turtle formatted RDF from Wikidata for that village. It then parses the result and displays a page about that village with a title, synopsis and Open Street Map.
This example demonstrates using Zend_Http_Client and Zend_Loader_Autoloader with EasyRdf.
It creates a simple graph in memory, saves it to a local graphstore and then fetches the data back using a SPARQL SELECT query. Zend's curl HTTP client adaptor is used to perform the HTTP requests.