问题
I've been having trouble accessing an ontology that we built here via the web. I've been trying to understand sparql and as far as I can tell there's no real PHP support for ontologies yet. I was wondering if I'm going about this right trying to build a java server app that queries the ontology for me that I just access? Or is there an easier better way? Can anyone help with their own knowledge or good references to read? I've been searching and reading for awhile now and can't find much of anything.
Thank you in advance for the help :)
回答1:
There's roughly two things that you need here. The first is a tool that allows you to publish the ontology on the web and make it accessible for SPARQL querying (= a SPARQL endpoint). This is typically done by installing a triplestore and adding your ontology to that triplestore.
There's various flavors of triplestores available, for some free and open source ones have a look at OpenRDF Sesame, Jena or 4Store. For a more comprehensive list of triplestore solutions and discussions of pros and cons of each, have a look around on answers.semanticweb.com.
Once you have your triplestore set up, you can query it from PHP using SPARQL. There's various PHP libraries that make life easier for you here. For example, there's phpSesame, a PHP client for remote access to Sesame (including SPARQL querying), or there is this more generic SPARQL library for PHP that should work with any spec-compliant SPARQL server.
来源:https://stackoverflow.com/questions/8712259/ontology-and-the-web