-
Notifications
You must be signed in to change notification settings - Fork 7
Sample FAqT deployment
- Getting started
- Installing DataFAQs
- If you're not ready to make and deploy your own FAqT Service, then try using the default FAqT evaluation services when making your own FAqT Brick.
- FAqT Services use the SADI Semantic Web Services framework, so it would be good to be familiar with that.
- FAqT Service walks through how to create a FAqT evaluation service, which we'll deploy during this page.
We'll deploy the FAqT evaluation services in the github repository from a public web server using twistd. Once deployed, they can be listed at the SADI registry and contribute to future [evaluation epochs](FAqT Brick).
When [developing an example](SADI Semantic Web Services framework) FAqT Service in python, we deployed it temporarily by invoking the script from the command line, which put it on localhost on port 9090. Although this is really convenient for development, it is not suitable for long-term public deployment. This page describes how to make a finished SADI service implementation available on the web for others to use.
As an example, we'll show how we deployed services/sadi/contextual-inverse-functional/contextual-inverse-functional.rpy on one of TWC's machines, http://sparql.tw.rpi.edu.
(note, mod_python
is now the preferred way to deploy FAqT Services instead of twistd; see the section below)
Step 1: First, we'll get DataFAQs' source code, putting it in /opt
:
cd /opt
sudo git clone git://github.com/timrdf/DataFAQs.git
Twisted provides an "application container" (in J2EE speak) functionality for a directory of python scripts.
LOBD uses this Twisted configuration to provide an "application container" for the SADI services in LOBD:
from twisted.application import internet, service
from twisted.web import static, server, script
root = static.File("/twc-lobd/twc-lobd-read-only/twc-lobd/services")
root.ignoreExt(".rpy")
root.processors = {'.rpy': script.ResourceScript}
application = service.Application('web')
sc = service.IServiceCollection(application)
site = server.Site(root)
i = internet.TCPServer(8080, site)
i.setServiceParent(sc)
Step 2: The above configuration is used to start Twisted like this:
cd /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf
sudo kill -9 `sudo cat twistd.pid`
export X_CKAN_API_Key=
twistd -y /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/lobd.tac
which exposes the following local script onto the web at the following URL:
/twc-lobd/twc-lobd-read-only/twc-lobd/services/sadi/services/frbr/frbrget.rpy is available on the web at
http://sparql.tw.rpi.edu/services/frbr/frbrget
Step 3: Until we can setup on our own, we'll save some time and deploy within that by linking our directory of services into the one Twisted is already looking for:
sudo ln -s /opt/DataFAQs/services/sadi/ /twc-lobd/twc-lobd-read-only/twc-lobd/services/sadi/services/datafaqs
This will expose the service available on the web at:
/opt/DataFAQs/services/sadi/contextual-inverse-functional/contextual-inverse-functional.rpy
http://sparql.tw.rpi.edu/services/datafaqs/contextual-inverse-functional/contextual-inverse-functional
Step 4: Use it! We can use the same curl commands as when we were [developing the SADI service](SADI Semantic Web Services framework):
curl -LO https://raw.github.com/timrdf/DataFAQs/master/services/sadi/contextual-inverse-functional/sample-inputs/myPa.ttl
curl -H "Content-Type: text/turtle" -d @myPa.ttl http://sparql.tw.rpi.edu/services/datafaqs/contextual-inverse-functional/contextual-inverse-functional
Step 5: Restart twisted
export X_CKAN_API_Key=
sudo kill -9 `sudo cat /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/twistd.pid`
cd /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/
sudo twistd -y /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/lobd.tac
Step 1: Install sadi.py (DataFAQs keeps a [compiled-from-source](SADI Semantic Web Services framework) of sadi.py that might be ahead of their releases)
cd /opt/DataFAQs/lib/sadi.python
python --version
sudo easy_install sadi-0.1.5-py2.7.egg
Step 2: Install CKAN's api client
Some of the provided DataFAQs FAqT services use the ckanclient.
sudo easy_install http://pypi.python.org/packages/source/c/ckanclient/ckanclient-0.9.tar.gz#md5=cb6d09eb2e60a01bce60c82c6c3a0c85
Step 3: Install mod_python:
sudo apt-get install libapache2-mod-python
sudo a2enmod python
Add: /opt/DataFAQs/services/sadi/.htaccess
to include:
SetHandler mod_python
PythonHandler sadi
SetEnv X_CKAN_API_Key 9a....
Your X_CKAN_API_Key
comes from your user home page, e.g. http://thedatahub.org/user/timrdf
Step 4: Tie FAqT Service implementations into /var/www
sudo mkdir /var/www/services
sudo cd /var/www/services
sudo ln -s /opt/DataFAQs/services/sadi .
Step 5: Make sure /var/www has FollowSymLinks and AllowOverride All
sudo vi /etc/apache2/sites-enabled/000-default
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Step 6: Restart apache:
sudo service apache2 restart
Step 7: Try it out!
DATAFAQS_BASE_URI``/services/sadi/faqt/sparql-service-description/named-graphs
such as
or
- http://sparql.tw.rpi.edu/services/datafaqs/faqt/void-triples
- http://sparql.tw.rpi.edu/services/datafaqs/faqt/internet-domain
Once deployed, services can be registered at http://sadiframework.org/registry/register/. Paste the URI of your deployed service into the text box and press the ... and click here to register it button. The registry dereferences the service URI to get its RDF description, dereferences its input and output class URIs, and stores the descriptions into http://biordf.net/sparql's graph http://sadiframework.org/registry/
. After registering your service, it will be listed at http://sadiframework.org/registry/services. to get the list yourself, use a query such as:
# query http://biordf.net/sparql endpoint
SELECT DISTINCT ?service
FROM <http://sadiframework.org/registry/>
WHERE {
?service a <http://www.mygrid.org.uk/mygrid-moby-service#serviceDescription>
}
- Prototype deployment details to set up a FAqT Brick and FAqT Brick Explorer
- DataFAQs environment variables for some deployment configurations