-
Notifications
You must be signed in to change notification settings - Fork 7
Sample FAqT deployment
- Getting started
- 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 become part of 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.
If you are planning to configure and collect your own analyses (i.e., building your own FAqT Brick), then you might want to set that up and create a default FAqT Brick, which calls existing FAqT Services. After you're done with that, you can come back here to deploy a FAqT Service, which you can include in your FAqT Brick by tweaking its configuration.
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:
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
$ sudo kill -9 `cat /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/twistd.pid`
$ cd /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/
$ twistd -y /twc-lobd/twc-lobd-read-only/twc-lobd/services/conf/lobd.tac
- 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