I want to query the ODP data from Dmoz (which is an RDF document) using RDQL. Like this example: http://dmoz.org/rdf/content.example.txt
I want to pick up the url, title and description from each of the external page entities which look like this:
<ExternalPage about="http://store.yahoo.com/attivousa">
<d:Title>Attivo</d:Title>
<d:Description>Bikinis briefs from top designers.</d:Description>
</ExternalPage>
The url is an attribute of the ExternalPage tag ('about'). I don't know how to format my query to get all three items. Can anyone help?
Here is what I have:
<?php
include_once("class_rdql.php");
print("<h1>RDQL test</h1><br/>\n");
$query[0]='SELECT ?sal, ?x
FROM <content.rdf>
WHERE (?x, <d:Title>, ?y),
(?y, <d:Description>, ?sal)
USING d for <http://purl.org/dc/elements/1.0#>';
/*
$query[1]='SELECT ?sal, ?t, ?x
FROM <http://ilrt.org/discovery/2000/11/rss-query/jobs-rss.rdf>,
<http://ilrt.org/discovery/2000/11/rss-query/jobs.rss>
WHERE (?x, <job:advertises>, ?y),
(?y, <job:salary>, ?sal),
(?y, <job:title>, ?t)
AND (?sal >= 100000)
USING job for <http://ilrt.org/discovery/2000/11/rss-query/jobvocab.rdf#>';
*/
I want to query the ODP data from Dmoz (which is an RDF document) using RDQL. Like this example:
http://dmoz.org/rdf/content.example.txt
I want to pick up the url, title and description from each of the external page entities which look like this:
<ExternalPage about="http://store.yahoo.com/attivousa">
<d:Title>Attivo</d:Title>
<d:Description>Bikinis briefs from top designers.</d:Description>
</ExternalPage>
The url is an attribute of the ExternalPage tag ('about'). I don't know how to format my query to get all three items. Can anyone help?
Here is what I have:
<?php
include_once("class_rdql.php");
print("<h1>RDQL test</h1><br/>\n");
$query[0]='SELECT ?sal, ?x
FROM <content.rdf>
WHERE (?x, <d:Title>, ?y),
(?y, <d:Description>, ?sal)
USING d for <http://purl.org/dc/elements/1.0#>';
/*
$query[1]='SELECT ?sal, ?t, ?x
FROM <http://ilrt.org/discovery/2000/11/rss-query/jobs-rss.rdf>,
<http://ilrt.org/discovery/2000/11/rss-query/jobs.rss>
WHERE (?x, <job:advertises>, ?y),
(?y, <job:salary>, ?sal),
(?y, <job:title>, ?t)
AND (?sal >= 100000)
USING job for <http://ilrt.org/discovery/2000/11/rss-query/jobvocab.rdf#>';
*/
foreach($query as $a_query) {
$head=false;
$rows = RDQL_query_document::rdql_query_url($a_query);
print("<table border='1' width='80%'>");
print("<tr><td bgcolor='#aaaacc'>Query:</td></tr>");
$a_query=str_replace("<","<",$a_query);
$a_query=str_replace(">",">",$a_query);
print("<tr><td bgcolor='#ccccee'><pre>$a_query</pre></td></tr>");
print("</table>");
print("<b>Result:</b>");
print("<table border='1'width='80%'>");
foreach($rows as $row) {
if(!$head) {
print("<tr>");
foreach(array_keys($row) as $k) {
print("<td bgcolor='#bbbbbb'><b>$k</b></td>");
}
print("</tr>");
$head=true;
}
print("<tr>");
foreach($row as $key=>$val) {
print("<td bgcolor='#dddddd'>$val</td>");
}
print("</tr>");
}
print("</table>");
print("<br/>");
}
?>