Source for file custom_rdql_test.php
Documentation is available at custom_rdql_test.php
// ----------------------------------------------------------------------------------
// PHP Script: custom_rdql_test.php
// ----------------------------------------------------------------------------------
* This is an online demo of RAP's RDQL engine.
* Input an RDQL query string and the engine will query the document
* specified in the source clause.
* @author Radoslaw Oldakowski <radol@gmx.de>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>RAP's RDQL-Engine online demo</TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<LINK href="phpdoc.css" rel=stylesheet type=text/css>
<TD align=left vAlign=top>
<A href="http://www.w3.org/RDF/" target=_blank>
<IMG alt="RDF Logo" border=0 height=40 src="rdf_metadata_button.gif" width=95>
<A href="http://www.php.net/" target=_blank>
<IMG alt="PHP Logo" border=0 height=64 src="php_logo.gif" width=120>
<H3>RDF API for PHP V0.8</H3>
<H1>RDQL-Engine Online Demo</H1><BR>
<P>This is an online demo of <A href="http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html">
RAP - RDF API for PHP V0.8</A>.<br>
// Test if the form is submitted or the query_string is too long
if (!isset ($_POST['submit']) OR (strlen($_POST['query_string']) > 1000 )) {
// Show error message if the rdf is too long
if ((isset ($_POST['submit']) AND (strlen($_POST['query_string']) > 1000 ))) {
echo "<center><a href='" . $_SERVER['SCRIPT_NAME'] . "'><h2>Go back to input form.</h2></a></center>";
echo "<center><p class='rdql_comment'>We're sorry, but your RDQL query is bigger than the allowed size of 1000 characters</p></center>";
<form method="post" action=" <?php echo $_SERVER['SCRIPT_NAME'];
Paste an <a href="http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/rdql_grammar.htm">RDQL</a> query string into the text field below.
In the FROM clause you can indicate an URL or a path for local RDF document to be queried.
<H3>Please paste your RDQL query here:</H3>
<P><TEXTAREA cols=80 name=query_string rows=15>
/* Find the name of the creator of <http://www.w3.org/Home/Lassila> */
/* ---------------------------------------------------------------- */
WHERE (?x, <desc:Creator>, ?z)
AND ?x eq <http://www.w3.org/Home/Lassila>
USING desc FOR <http://description.org/schema/>
ex FOR <http://example.org/stuff/1.0/>
<H3>Please choose the output format:</H3>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<INPUT id="show_input" name="show_input"
<TD><STRONG>Show the source model</STRONG> (only if it contains
fewer than 100 statements)</TD>
<P><INPUT name=submit type=submit value="submit me!">
// Process the query if submitted
require_once 'RDF/Model/Memory.php';
require_once 'RDF/RDQL.php';
echo "<center><a href='" . $_SERVER['SCRIPT_NAME'] . "'>
<h2>Go back to input form.</h2></a></center>";
if (isset ($_POST['query_string'])) {
$parsed = & $parser->parseQuery ($queryString);
// If more than one source file provided show an error message
if (count($parsed['sources']) > 1 ) {
echo "<center><p class='rdql_comment'>We're sorry, but this Online Demo allows you to query only one document</p></center>";
// Load the input model into memory
$Model_Memory = & new RDF_Model_Memory ();
$Model_Memory->load ($parsed['sources'][0 ]);
$queryResult = $engine->queryModel ($Model_Memory, $parsed, true );
echo "<br><h3>Your query: </h3>";
echo "<table width='100%' bgcolor=#e7e7ef><tr><td>";
echo "</td></tr></table><br>";
echo "<br><h3>Query result: </h3>";
$engine->writeQueryResultAsHtmlTable ($queryResult);
// Show the input model if option chosen
if (isset ($_POST['show_input']) && $_POST['show_input'] == "1") {
echo "<br><br><h3>Source model: </h3>";
$Model_Memory->writeAsHtmlTable ();
<p>Please send bug reports and other comments to <a href="mailto:radol@gmx.de">Radek Oldakowski</a>.<br></p>
Documentation generated on Mon, 11 Mar 2019 15:39:49 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|