0

It's my very first time building for the semantic web.

I'm not sure how to create a PHP webpage and connect it to an ontology which I have mapped to a relational database using the Ontop plugin for Protege.

Has the database become rdfstore?

I have tried using the EasyRdf library to connect the PHP to ontology, however it didn't work.

Here is the php code that I tried.

<?php
require 'vendor/autoload.php';
$foaf = new EasyRdf_Graph("http://localhost/proIT.owl");
$foaf->load();
$me = $foaf->primaryTopic();
echo "My name is: ".$me->get('foaf:name')."\n";
?>
Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58

1 Answers1

1

There are 2 main problems here:

(1) There is no way to access the mappings you have applied from the Protege Ontop plugin from EasyRDF in PHP. The Protege Ontop plugin enables SPARQL queries over your database from Protege, which is not accessible to EasyRDF. Based on the architecture of Ontop, you need to setup a SPARQL endpoint for Ontop which can be done using Sesame workbench. See Sesame SPARQL Enpoint Installation.

Ontop Architecture

(2) Now you need EasyRDF to access the SPARQL endpoint. In this regard your PHP code is incorrect in that it merely loads the .owl file rather than querying the SPARQL endpoint. See EasyRDF SPARQL query example for an example on how to do a SPARQL query using EasyRDF.

Lastly, as for your question whether the database has become an RDFstore, the answer is NO. Your database is not changed. Rather, the Ontop Protege plugin or the repository for Ontop you configure in Sesame Workbench, provides a SPARQL enabled access layer to your database. I.e., you will still be able to do typical SQL queries to your database through your SQL client.

Henriette Harmse
  • 4,167
  • 1
  • 13
  • 22
  • i had tried to use sesame {sparql} endpoint and did exactly like that tutorial however the quest did not show up. i tried to solved it by copy some files to the directory in sesame but did not work. how about use {arc2} library? do i still need a {rdf} store? i had tried to use {arc2} but i don't understand on 'store name' part. it created multiples table on my database and named it with the store name. – Ilda Pohan Jan 29 '18 at 11:16
  • hello, i am sorry to ask again. i have succeeded to install sesame SPARQL endpoint also have tried EasyRDF SPARQL query example above. it returned Fatal error: Class 'EasyRdf_Sparql_Client' not found. how to resolve it? – Ilda Pohan Jan 31 '18 at 21:56