Query Definition in RDF

97 views
Skip to first unread message

amandev

unread,
Oct 11, 2016, 8:43:07 AM10/11/16
to EasyRdf Discussion
Hello, 
I just started EasyRDF and I am trying to list the the individuals of class Image along with their properties and their values with the following code. But I believe I am doing it the wrong way, hoping to have some help here to have it fixed. I am using a local rdf file

<?php
require 'vendor/autoload.php'; 

$graph = new EasyRdf_Graph(); 
$graph->parseFile("atlOpenstack.rdf"); 

EasyRdf_Namespace::set('atl', 'http://www.semanticweb.org/ATL/ontologies/test#');

$sparql = new EasyRdf_Sparql_Client('http://www.semanticweb.org/ATL/ontologies/test#');

$result = $sparql->query("


SELECT ?individual ?property ?value
WHERE { 
?individual a atl:Image . 
?individual  ?property ?value .
filter ( ?property not in ( rdf:type ) ) .

 }");


 echo "<table border='1'>
    <thead>
        <th>#</th>
        <th>Individual</th>
        <th>Property</th>
<th>Value</th>
        
    </thead>";

    foreach( $result as $row ) { 
print "<tr>
<td>".++$id. "</td>
<td>". $row['individual']. "</td> 
<td>". $row['property']. "</td>
<td>". $row['value']. "</td>
</tr>";
   
    }
    echo "</table>" ;

Upon execution it gives the following two errors, which I am certain I have wrongly instantiated the $sparql, and I still dont know how to do that
 Fatal error: Uncaught exception 'EasyRdf_Exception' with message ' in C:\wamp64\www\ATLtest\vendor\easyrdf\easyrdf\lib\EasyRdf\Sparql\Client.php on line 290
( ! ) EasyRdf_Exception: HTTP request for SPARQL query failed: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"/> <title>404 - this page does not exist</title> <style> </style> </head> <body> <h1>404 - Not Found</h1> <p>You're browsing a static export of the semanticweb.org wiki. Dynamic page requests cannot be answered.</p> <p><a href="/">Back to start</a></p> </body> </html> in C:\wamp64\www\ATLtest\vendor\easyrdf\easyrdf\lib\EasyRdf\Sparql\Client.php on line 290

What is the correct way to code such a query
help=welcome!!
 

Nicholas Humfrey

unread,
Oct 11, 2016, 8:52:15 AM10/11/16
to eas...@googlegroups.com, amandev
Hello,

It looks like you are trying to query your own local dataset?

There isn't any support for running SPARQL queries locally in EasyRDF,
you can only query remote SPARQL endpoints.

For example if you were querying Wikidata:

$sparql = new
EasyRdf_Sparql_Client('https://query.wikidata.org/sparql');


If you are looking for a local Triplestore, to query your own data, you
could try Fuseki:
https://jena.apache.org/documentation/serving_data/


nick.
> FATAL ERROR: UNCAUGHT EXCEPTION &#39;EASYRDF_EXCEPTION&#39; WITH
> MESSAGE &#39; IN
> C:\WAMP64\WWW\ATLTEST\VENDOR\EASYRDF\EASYRDF\LIB\EASYRDF\SPARQL\CLIENT.PHP
> ON LINE _290_
>
> ( ! ) EASYRDF_EXCEPTION: HTTP REQUEST FOR SPARQL QUERY FAILED:
> <!DOCTYPE HTML> <HTML> <HEAD> <META CHARSET="UTF-8"/> <TITLE>404 -
> THIS PAGE DOES NOT EXIST</TITLE> <STYLE> </STYLE> </HEAD> <BODY>
> <H1>404 - NOT FOUND</H1> <P>YOU&#39;RE BROWSING A STATIC EXPORT OF THE
> SEMANTICWEB.ORG WIKI. DYNAMIC PAGE REQUESTS CANNOT BE ANSWERED.</P>
> <P><A HREF="/">BACK TO START</A></P> </BODY> </HTML> IN
> C:\WAMP64\WWW\ATLTEST\VENDOR\EASYRDF\EASYRDF\LIB\EASYRDF\SPARQL\CLIENT.PHP
> ON LINE _290_
>
> What is the correct way to code such a query
> help=welcome!!
>
> --
> You received this message because you are subscribed to the Google
> Groups "EasyRdf Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to easyrdf+u...@googlegroups.com.
> To post to this group, send email to eas...@googlegroups.com.
> Visit this group at https://groups.google.com/group/easyrdf.
> For more options, visit https://groups.google.com/d/optout.

amandev

unread,
Oct 11, 2016, 9:02:08 AM10/11/16
to EasyRdf Discussion, waqas...@gmail.com
Hello again, 

I was trying local rdf but it didnt click..Thanks for the heads up..
Hope to see this feature in easyRDF soon.
Reply all
Reply to author
Forward
0 new messages