Installation Guide
Tutorial - 9 March 2010
- Latest version: http://openstructs.org/structwsf/installation-guide
- Last update:
- $Date: 2010/03/09 12:32:43 $
- Revision: http://openstructs.org/structwsf/installation-guide
- Revision: 0.4f
- Author:
- Frédérick Giasson - Structured Dynamics
- Deepak Sahasrabudhe - Soma TV
- Editors:
- Frédérick Giasson - Structured Dynamics
- Michael Bergman - Structured Dynamics
- Software versions:
- structWSF - 1.0a5
- conStruct - 6.x-1.x-dev-5
Copyright © 2009-2010 by Structured Dynamics LLC; Soma TV.

This installation guide for structWSF & conStruct SCS by Structured Dynamics LLC is licensed under a Creative Commons Attribution-Share Alike 3.0. The structWSF & conStruct SCS software is separately available under the Apache License, Version 2.0.
About structWSF
structWSF is a platform-independent Web services framework for accessing and exposing structured RDF data. Its central organizing perspective is that of the dataset. These datasets contain instance records, with the structural relationships amongst the data and their attributes and concepts defined via ontologies (schema with accompanying vocabularies).
The structWSF middleware framework is generally RESTful in design and is based on HTTP and Web protocols and open standards. The initial structWSF framework comes packaged with a baseline set of about a dozen Web services in CRUD, browse, search and export and import. All Web services are exposed via APIs and SPARQL endpoints. Each request to an individual Web service returns an HTTP status and optionally a document of resultsets. Each results document can be serialized in many ways, and may be expressed as either RDF or pure XML.
In initial release, structWSF has direct interfaces to the Virtuoso RDF triple store (via ODBC, and later HTTP) and the Solr faceted, full-text search engine(via HTTP). However, structWSF has been designed to be fully platform-independent. Support for additional datastores and engines are planned. The design also allows other specialized systems to be included, such as analysis or advanced inference engines
About conStruct
conStruct SCS [1] is a structured content system built on the structWSF framework [2] that extends the basic Drupal content management framework. conStruct enables structured data and its controlling vocabularies (ontologies) to drive applications and user interfaces.
Users and groups can flexibly access and manage any or all datasets exposed by the system depending on roles and permissions. Report and presentation templates are easily defined, styled or modified based on the underlying datasets and structure. Collaboration networks can readily be established across multiple installations and non-Drupal endpoints. Powerful linked data integration can be included to embrace data anywhere on the Web.
conStruct provides Drupal-level CRUD, data display templating, faceted browsing, full-text search, and import and export over structured data stores based on RDF.
Table of Contents
- About structWSF
- About conStruct
- INTRODUCTION
- STEP 1: INSTALL LINUX UBUNTU AND ITS UPDATES
- STEP 2: INSTALL PROGRAM DEPENDENCIES
- STEP 3: INSTALL APACHE HTTP SERVER
- STEP 4: INSTALL AND PREPARE MySQL & phpMyAdmin
- STEP 5: INSTALL AND TEST VIRTUOSO SERVER
- STEP 6: INSTALL AND TEST APACHE SOLR
- STEP 7: INSTALL structWSF
- STEP 8: INSTALL ARC2
- STEP 9: INITIATE THE WEB SERVICES
- STEP 10: INSTALL DRUPAL
- STEP 11: INSTALL SMARTY TEMPLATE ENGINE AND YUI
- STEP 12: CONFIGURE DRUPAL
- STEP 13: TEST THE INSTALLATION
- APPENDIX: LISTING OF COMPONENTS
- APPENDIX: SECURITY CHECK LIST
- APPENDIX: AN AMAZON EC2/EBS ARCHITECTURE
- REFERENCES
INTRODUCTION
This guide is designed for the Ubuntu Linux distro (Server Edition) version 9.10 32bits. Also, this guide may not apply, or may need modifications, in specific areas related to other Linux packages (e.g., Debian, CentOS, Red Hat, etc.).
This installation guide is intentionally detailed - our purpose is to provide someone with limited technical skills with the actual commands necessary to create a working semantic processor. Some explanations have been provided with the intention of illuminating what the commands actually do.
This command set has been verified to work with Ubuntu 9.10. These commands will work on most Linux distributions based on Debian Linux (such as Ubuntu).
These directions include downloading and installation of some additional open-source packages that you may find useful during installation and beyond:
- PhpMyAdmin which allows you to create and manage MySql databases.
The following conventions are used in this document:
- Black text is used for information and directions.
- Brown text represents commands that should be copied and pasted in Terminal
- Green text is text to be cut and paste into a text editor (vim, vi, pico, etc.)
- Orange text represents responses from the computer
- Red Text represents text in a command that you may wish to change to reflect your own names
- Purple text represents something to notice.
STEP 1: INSTALL LINUX UBUNTU AND ITS UPDATES
Downoad and Install
- Ubuntu is the Linux operating system and associated packages used for hosting this version of the system
- For instructions on how to get and install Ubuntu Desktop Edition go to http://Ubuntu.com.
Refresh the Program Repository Access
When you have Ubuntu installed, you will have to update your Ubuntu installation with the latest program updates. The following command will update its list of all software available:
| sudo apt-get update |
Install Updates for Ubuntu
The following command will upgrade all software that have enhancement or security patches that can be applied:
| sudo apt-get upgrade |
Follow the steps that some of the upgraded software will prompt you to do in the terminal.
STEP 2: INSTALL PROGRAM DEPENDENCIES
Ubuntu is a version of the Linux operating system and associated packages used for hosting this version of the system.
Install System Dependencies
When Ubuntu Desktop has been installed and updated, you are ready install the system dependencies:
| sudo apt-get install curl gcc iodbc libssl-dev openssl unzip gawk vim |
Install PHP
Install PHP and a few connector modules.
- Copy / paste the following command into terminal:
| sudo apt-get install php5 php5-mysql php5-odbc php5-cli libapache2-mod-php5 php5-curl |
Configure PHP
Some default PHP configurations have to be changed in order to make it work properly.
- Gnome-commander is a fast and powerful file manager. It is strongly suggested to not start without it (or use an equivalent!):
| sudo vim /etc/php5/apache2/php.ini |
- Go to the line #462 (or thereabouts), and replace "magic_quotes_gpc = On" by:
| magic_quotes_gpc = Off |
STEP 3: INSTALL APACHE HTTP SERVER
Apache 2 is the Web server that provides the interface for external browsers to access Web pages for your structWSF and conStruct installation.
Install Apache
By default, Apache 2 is installed in Ubuntu Server. However, if it is not, you have to cut and paste the command below in Terminal:
| sudo apt-get install apache2 |
When the installation is complete, check if Apache is working properly by running this command:
| sudo curl http://localhost |
If you see some HTML text and read the text “It works!”, it means Apache is working correctly, and you can proceed to the next step.
If you need it, a good reference manual for Apache setup can be found at this Web site:
https://help.ubuntu.com/6.10/ubuntu/serverguide/C/httpd.html
Enable Clean URLs
The default “unclean” URLs that Drupal provides with question marks is annoying and interferes with search engines. To fix this problem, you should enable the mod-rewrite module in Apache 2.
First, check whether the rewrite module for your Apache is enabled:
| sudo ls /etc/apache2/mods-enabled/ |
If you see rewrite.load in the list, skip the next steps and go directly to Step 4.
If you don’t find rewrite.load, it means that the rewrite module is not enabled. Drupal’s clean URLs feature requires this module to be enabled.
Paste this command into Terminal:
| sudo a2enmod |
The command returns a lot of text providing a list of options available to enable, and ends with the question: Which module would you like to enable?
At the blinking cursor in Terminal, type in:
| rewrite |
Terminal will confirm rewrite installed and tell you to restart Apache. But there's more to do first.
Check again to confirm that rewrite is enabled. Copy the command below into Terminal:
| sudo ls /etc/apache2/mods-enabled/ |
This time you should see that the rewrite module (rewrite.load) is in the list.
You should then restart Apache:
| sudo /etc/init.d/apache2 restart |
Apache should now be installed and prepared for the software that will be served by it, including Drupal.
STEP 4: INSTALL AND PREPARE MySQL & phpMyAdmin
MySQL provides the database support for the Drupal portion of conStruct, and phpMyAdmin provides a user interface for managing MySQL.
Install MySQL
Copy the following command into Terminal:
| sudo apt-get install mysql-server |
You will be asked to provide a password for user: root. Note the password for future reference.
To configure MySQL, enter this command in Terminal to open /etc/php5/apache2/php.ini in your text editor:
| sudo vim /etc/php5/apache2/php.ini |
When php.ini opens, search for a line in php.ini that looks like:
| ; extension=mysql.so |
Uncomment the line by removing the # so that the line reads:
| extension=mysql.so |
Fnd the line (we're still in /etc/php5/apache2/php.ini):
| memory_limit = 16M ; Maximum amount of... |
And change 16M to 32M to increase memory limit to 32 megabytes:
| memory_limit = 32M ; |
Then, save and close the file.
You should then restart Apache:
| sudo /etc/init.d/apache2 restart |
Install phpMyAdmin
phpMyAdmin is a graphical user interface manager for MySQL. It is used to create and manage your MySQL databases.
To install it, copy the following command into Terminal:
| sudo apt-get install phpmyadmin |
You will be asked several questions:
- The usual install and password questions should be answered as you have previously.
- You will be asked a question about which server to use:
-
- The red marker should be on the first choice (apache2) ... leave it there and
- Use Tab to move cursor to “ok” and press enter.
- It is all right that the red marker moves away from apache2 in the process.
- You will be asked whether to use dbconfig-common; use tab to move cursor to yes and hit enter
- Lastly, phpMyAdmin needs an administrive account password – you may want to use the same password as your MySQL password.
Check phpMyAdmin Installation
Open http://mysite_address.com/phpmyadmin in a Web browser (Firefox or IE) by clicking on the line below (after replacing with your exact site name):
- If you get the phpMyAdmin welcome page, PHP and MySql are installed correctly.
- If you see error message “Cookies must be enabled past this point.”, reload the browser (by using the refresh button on the browser)
- If the error persists, check your work.
If you get any error after installing phpMyAdmin, you can always refers to the phpMyAdmin Ubuntu manual to make sure it is properly setuped.
Create Database and Test
Create a database that you will use later in this process for Drupal.
- Login using your MySQL user name (root) and password that you have set when installing MySQL server.
- You will be taken to a Web page with three columns. In the center column, the middle block has a textfield with the label "Create a Database".
- Type in your database name. In this example, I would use something like drupal.
- Click create and you are done.
- Note the name you have given the new database. Your username is "root" if you used the default settings during installation, and the password is the password you used to enter phpMyAdmin. Note these as you will need them later in the installation.
- Close the browser.
STEP 5: INSTALL AND TEST VIRTUOSO SERVER
The Virtuoso datastore is the host for the triple-store database and it indexes the RDF information used by structWSF. It also provides inferencing capabilities over that information.
Although you won't need the Virtuoso install manual if you are doing a default install, as described in these instructions, it can be helpful if you need to make configuration modifications for your installation. The manual can be found at:
Download Virtuoso
The first step is to go to the temporary folder where we will download and extract all Virtuoso files:
| cd /tmp |
Then we download Virtuoso 5.0.13:
| sudo wget http://downloads.sourceforge.net/project/virtuoso/virtuoso/5.0.13/virtuoso-opensource-5.0.13.tar.gz |
Note: structWSF has only been tested with the 5.0.X series. It should perfectly work with the new 6.0.X series, but it has never been tested by Structured Dynamics.
Extract and Install Virtuoso
Using the Terminal, extract compressed files in the current directory (/tmp/):
| sudo tar -xzvf virtuoso-opensource-5.0.13.tar.gz |
Configure Initial Virtuoso
Move Terminal to extracted virtuoso folder:
| cd virtuoso-opensource-5.0.13 |
Copy, paste and run each of the following lines one at a time in Terminal:
| CFLAGS="-O2" export CFLAGS sudo ./configure --enable-openssl --with-iodbc |
When it completes, Terminal will give you a message that looks like:
| Virtuoso Open Source Edition 5.0.13 configuration summary ============================================ Installation variables layout default prefix /usr/local/virtuoso-opensource exec_prefix ${prefix} Installation paths programs ${exec_prefix}/bin include files ${prefix}/include libraries ${exec_prefix}/lib manual pages ${datarootdir}/man vad packages ${datarootdir}/virtuoso/vad database ${prefix}/var/lib/virtuoso/db hosting ${exec_prefix}/lib/virtuoso/hosting Options BUILD_OPTS xml ssl ldap imsg pldebug pthreads |
Next, compile the Installation file (this will take about 30 min to 1 hour):
| sudo make |
Check the compiled program (this will take over an hour, but it can run unattended – it will abort on an error). If it completes successfully it will not report errors. It also appears to stop for long periods of time as it processes..., don't abort hastily... it is likely working away!:
| sudo make check |
You will get a report when it is done. If you get errors, you will need to review the log files to find the error. If you do, check out Tech Support for Virtuoso, at Open Link Software may be able to help.
If the make check reports no errors, proceed to install the program. This one only takes about a minute or so to execute. Copy paste and run the following command in Terminal:
| sudo make install |
When it completes successfully, you will get a report that ends like this :
| make[3]: Nothing to be done for `install-exec-am'. make[3]: Nothing to be done for `install-data-am'. make[3]: Leaving directory `virtuoso-opensource-5.0.13/appsrc' make[2]: Leaving directory `virtuoso-opensource-5.0.13/appsrc' make[1]: Leaving directory `virtuoso-opensource-5.0.13/appsrc' |
Set Up Virtuoso ODBC Connectors
Create the file /etc/odbc.ini by using the following command in Terminal to open a new file called /etc/odbc.ini with your text editor:
| sudo vim /etc/odbc.ini |
Copy and paste the text shown below into the open file /etc/odbc.ini:
| [ODBC Data Sources] structwsf-triples-store = OpenLink Virtuoso [structwsf-triples-store] |
Then, save and close file
Next, create the file /etc/odbcinst.ini by using the following command in Terminal to open a new file called /etc/odbcinst.ini:
| sudo vim /etc/odbcinst.ini |
Paste text shown below into /etc/odbcinst.ini:
| [ODBC Drivers] OpenLink Virtuoso = Installed OpenLink Virtuoso (Unicode) = Installed [OpenLink Virtuoso] Driver = /usr/local/virtuoso-opensource/lib/virtodbc_r.so [OpenLink Virtuoso (Unicode)] Driver = /usr/local/virtuoso-opensource/lib/virtodbcu_r.so |
Save and close the file.
Now, confirm that virtuoso.ini is where it should be by issuing the following command in Terminal:
| sudo ls /usr/local/virtuoso-opensource/var/lib/virtuoso/db/ |
“virtuoso.ini” should be listed in Terminal's response.
Start Virtuoso Server
The lines of text below form a single command. Copy, paste and run the command in Terminal:
| sudo /usr/local/virtuoso-opensource/bin/virtuoso-t -c /usr/local/virtuoso-opensource/var/lib/virtuoso/db/virtuoso.ini -f |
After 30 seconds or so, Terminal will show the server is online:
| 07:43:08 HTTP/WebDAV server online at 8890 07:43:08 Server online at 1111 (pid 8896) |
Leave the terminal open for the next installation tests.
Note: next time you run Virtuoso, you can remove the "-f" flag so that it runs in background (so that you don't have to leave a terminal open)
Test ODBC Connection
Open a second instance of Terminal while keeping the previous terminal open (to keep iODBC server running), and then paste the command shown below into the second Terminal. The other terminal must stay open to make this iODBC test work:
| sudo /usr/bin/iodbctest "DSN=structwsf-triples-store;UID=dba;PWD=dba" |
If it is working correctly, it will return:
| iODBC Demonstration program This program shows an interactive SQL processor Driver Manager: 03.52.0607.1008 Driver: 05.11.3039 OpenLink Virtuoso ODBC Driver (virtodbc.so) SQL> |
Close both instances of Terminal.
Open Virtuoso Conductor
Virtuoso Conductor is the administrative control interface for Virtuoso services. It primarily allows users to administer the server while giving access to many of the features that Virtuoso has to offer providing many conceptual demonstrations and introductions. For more information on Virtuoso A How-to guide, which also has a quick-start guide, is provided by the software's creators, OpenLink Software. It can be found at:
Point your Web browser to the link shown below:
If Virtuoso is working correctly, it will open Virtuoso Conductor.
Log in. the default login is:
Password: dba
Take some time to wander around the facilities provided by Virtuoso Conductor. You will find many capabilities built into the software - check out the OpenLink Software how to manual at the Web site cited above.
To get back to our installation, click on the "Interactive SQL (ISQL)" link at the top of the left sidebar.
Then copy, paste and run this SQL query in the iSQL window of your browser, open on Virtuoso Conductor (NOT in Terminal!):
|
create procedure exst (in st varchar) exec (st, null, null, vector (), 0, mdta, null, h); while (0 = exec_next (h, null, null, dta)) exec_close (h); |
Interactive SQL will report:
| The statement execution did not return a result set. |
Which is normal, but tells you the installation is recognized and running properly.
And then copy, paste and run this other SQL query in the iSQL window of your browser, open on Virtuoso Conductor. This will commit ("save") the procedure in Virtuoso:
|
exec('checkpoint'); |
Interactive SQL will report:
| The statement execution did not return a result set. |
Virtuoso Support
The Virtuoso support mailing list is located at:
also see:
http://sourceforge.net/mailarchive/forum.php?forum_name=virtuoso-users.
Create Startup Script
The next step is to create a startup script for Solr. From this script, you will be able to easily start, stop and restart the Solr server. First, let's create a new file for this script:
| sudo vim /etc/init.d/virtuoso |
Then, copy and paste this code in that new file:
|
#! /bin/sh ### BEGIN INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin test -x $DAEMON || exit 0 LOGDIR=/var/log/virtuoso-opensource # Include virtuoso-opensource defaults if available set -e running_pid() running() # No pidfile, probably no daemon present force_stop() { case "$1" in status) exit 0 |
Note: by default, Virtuoso is installed in the folder "/usr/local/virtuoso-opensource/", if you specified another location where to install virtuoso, you have to modify that path in the script above for these two variables: DAEMON and DBBASE.
Then, save and close the file, and let's change its permission so that we can run it:
| sudo chmod 744 /etc/init.d/virtuoso |
Now, let's test this new startup file:
|
sudo /etc/init.d/virtuoso stop sudo /etc/init.d/virtuoso start |
Make sure that Virtuoso is properly running by running this command:
| sudo ps -elf | grep virtuoso |
If Virtuoso is running, you should see this returned by the previous command:
|
1 S root 11007 1 0 80 0 - 219870 futex_ Jan19 ? 03:50:23 /usr/local/virtuoso-opensource/bin/virtuoso-t -c virtuoso +wait |
Note: if nothing appears, it is because the startup script is not properly running. Please check to make sure your paths are properly set.
Optionally, you can change the system so that Virtuoso starts and stops automatically at server boot and shutdown time:
| sudo update-rc.d virtuoso defaults |
STEP 6: INSTALL AND TEST APACHE SOLR
Solr provides the full-text and faceted search capabilities used by structWSF. We will install Solr to its default location, and we will use Jetty to run the Solr server.
Download
First, download Solr 1.4 from one of these sources http://www.apache.org/dyn/closer.cgi/lucene/solr/:
| sudo mkdir /usr/share/apachesolr/ |
| cd /usr/share/apachesolr/ |
| sudo wget http://apache.mirror.iweb.ca/lucene/solr/1.4.0/apache-solr-1.4.0.tgz |
Install and Configure
Install Solr on the server:
| sudo tar -xvf apache-solr-1.4.0.tgz |
| cd apache-solr-1.4.0 |
| sudo mv * ../ |
Confirm and Test for Use
To confirm that Solr-Jetty is working correctly, enter the following command into Terminal so that it will start the server application:
| cd /usr/share/apachesolr/example/ |
| sudo java -Xms64M -Xmx512M -jar start.jar |
It should return the following in Terminal:
|
... |
Change the "schema.xml" file to the one needed for structWSF:
- Download the new schema.xml file from (double click on this text to point your Web browser to the download site:
- Copy & paste the content of that file into the Solr instance using Terminal:
| sudo vim /usr/share/apachesolr/example/solr/conf/schema.xml |
Test the installation by pointing a Web browser to the Solr test page:
You will see a Solr welcome page if it is installed correctly.
Create Startup Script
The next step is to create a startup script for Solr. From this script, you will be able to easily start, stop and restart the Solr server. First, let's create a new file for this script:
| sudo vim /etc/init.d/solr |
Then, copy and paste this code in that new file:
|
#!/bin/bash JAVA="/usr/bin/java" EXEC="$JAVA $JAVA_OPTIONS" echo "ok - remember it may take a minute or two before Solr responds on requests" |
Then, save and close the file, and let's change its permission so that we can run it:
| sudo chmod 744 /etc/init.d/solr |
Now, let's test this new startup file:
| sudo /etc/init.d/solr restart |
Optionally, you can change the system so that Solr starts and stops automatically at server boot and shutdown time:
| sudo update-rc.d solr defaults |
STEP 7: INSTALL structWSF
structWSF is the platform-independent Web services framework that drives all of the user interface capabilities within conStruct. It is the pivotal middleware of the entire system.
Prepare and Download
Set Folder Permissions
- Make sure that the Web server instance has read and write access to the "/tmp/" folder of your system. (default 777 will work).
- If you want your Web server to have access to another temporary folder, then change the line 22 of the file '../structwsf/index.php' to point to that folder and make sure the folder has Permissions set to 777.
Download StructWSF
Click on the link below to point your Web browser to the download site:
Choose the file which has the most recent date and download to your server:
| sudo mkdir /usr/share/structwsf/ |
| cd /usr/share/structwsf/ |
| sudo wget http://structwsf.googlecode.com/files/structwsf-1.0a5.zip |
Install StructWSF
In Terminal, extract the structWSF package in the current directory:
| sudo unzip structwsf-1.0a5.zip |
Setup Access
We now want to make access to the structWSF instance via the URL http://mysite_address.com/ws/. We have to add one Apache configuration file to enable this access.
| sudo vim /etc/apache2/sites-available/structwsf |
|
Alias /ws /usr/share/structwsf <Directory /usr/share/structwsf/> |
Now we enable this new access:
| sudo ln -s /etc/apache2/sites-available/structwsf /etc/apache2/sites-enabled/structwsf |
Finally we restart Apache:
| sudo /etc/init.d/apache2 restart |
Add and Configure Database
Make sure that the folder specificed here is the one where you can find the data.ini and network.ini files:
| sudo vim /usr/share/structwsf/framework/WebService.php |
Then, make a backup of WebService.php by pasting this text into Terminal:
| cp WebService.php WebService.php.bak |
Check lines 34 and 37 (or thereabouts) for:
|
public static $data_ini = "/usr/share/structwsf/"; |
Now let's configure the access to the structWSF intance in the data.ini file:
| sudo vim /usr/share/structwsf/data.ini |
Change the "datasets" section of the file to specify the address used to access the structWSF instance:
|
[datasets] ; The base URI of the graph where the structWSF structure description get indexed ; DTD base URL where to resolve DTD used to share data |
Now let's configure the access to the structWSF intance in the network.ini file:
| sudo vim /usr/share/structwsf/network.ini |
Change the "network" section of the file to specify the address used to access the structWSF instance:
|
[network] ; Base URL used to access the structWSF instance |
Setup and Configure Server
StructWSF Ontological Structure Setup
First, we have to create a folder where all ontologies used by structWSF will be uploaded:
| sudo mkdir -p /data/ontologies/structure/ |
| sudo chmod 777 /data/ontologies/structure/ |
| sudo mkdir -p /data/ontologies/files/ |
Save all ontologies (serialized in XML) you want to use in structWSF, in the /data/ontologies/files/ folder. If none, just jump to the "Configure Logger" step bellow.
You can download this package of initial ontologies composed of FOAF, BIBO and SIOC: Initial Ontologies Package.
Configure Virtuoso Server Connection
Run the load_ontologies.php so that structWSF imports all ontologies from the /data/ontologies/files/ folder:
| cd /usr/share/structwsf/ontology/ |
| sudo php load_ontologies.php |
Note: make sure you have a running Virtuoso instance.
The script will output processing steps in the Terminal such as:
|
Processing ontology file A.xml |
Configure Logger
To configure the Logger, open Virtuoso in a Web browser by clicking on this link, which will open Virtuoso Conductor:
Log in. The default login is:
Password: dba
Click on the "Interactive SQL (ISQL)" link at the top of the left sidebar. Then copy, paste and run this SQL query in the iSQL window:
| create table "SD"."WSF"."ws_queries_log" ( "id" INTEGER IDENTITY, "requested_Web_service" VARCHAR, "requester_ip" VARCHAR, "request_parameters" VARCHAR, "requested_mime" VARCHAR, "request_datetime" DATETIME, "request_processing_time" DECIMAL, "request_http_response_status" VARCHAR, "requester_user_agent" VARCHAR, PRIMARY KEY ("id") ); create index sd_wsf_requested_Web_service_index on SD.WSF.ws_queries_log (requested_Web_service); create index sd_wsf_requester_ip_index on SD.WSF.ws_queries_log (requester_ip); create index sd_wsf_requested_mime_index on SD.WSF.ws_queries_log (requested_mime); create index sd_wsf_request_datetime_index on SD.WSF.ws_queries_log (request_datetime); create index sd_wsf_request_http_response_status_index on SD.WSF.ws_queries_log (request_http_response_status); create index sd_wsf_requester_user_agent_index on SD.WSF.ws_queries_log (requester_user_agent); |
Interactive SQL will report:
| The statement execution did not return a result set. The statement execution did not return a result set. The statement execution did not return a result set. The statement execution did not return a result set. The statement execution did not return a result set. The statement execution did not return a result set. The statement execution did not return a result set. |
STEP 8: INSTALL ARC2
The ARC2 php-rdf library is needed by the structWSF 'create' Web services for some offline RDF processing activities.
Download
Download and extract the ARC2 libraries from:
And choose the latest release (its a tar.gz file) and download it.
Or can use the following command lines instructions:
| cd /usr/share/structwsf/framework |
| sudo wget http://code.semsol.org/source/arc.tar.gz |
Install
To install ARC2, we have to untar the package in the "framework" folder, and rename it to "arc2":
| sudo tar -xvf arc.tar.gz |
| sudo mv arc arc2 |
STEP 9: INITIATE THE WEB SERVICES FRAMEWORK
Once installated, you are now ready to create the WSF framework, its internal structure and to initiate the WSF system.
First, using a Web browser, enter the link below to run a setup program with the parameters specified in the URL (of course, change mysite_address.com to your Web site's name):
This command creates a full access user.
Next, specify that user's IP and site name. As the local user, enter the link below in your Web broswer (change mysite_address.com to your Web site's name). It will run a setup program with the parameters specified in the URL:
To enable remote access for a full user, you need to issue a similar command, but with different parameters. For example, change the ip address shown to the IP address you wish to grant access and change mysite_address.com to your Web site's name. It will run a setup program with the parameters specified in the URL:
Now, create a new dataset using Terminal (NOTE: do not use your Web browser!). To do so, copy and paste the following lines into Terminal. Make sure you change mysite_address.com before you run the command:
| curl -H "Accept: text/xml" "http://mysite_address.com/ws/dataset/create/" -d "uri=http://mysite_address.com/test/&title=Test&description=test&creator=http://mysite_address.com/drupal/user/1/" -v |
Confirm Set-up
To confirm that the dataset was correctly created, copy and paste the following code into a Web brower. Remember to change mysite_address.com to the correct domain.
http://mysite_address.com:8890/sparql/?default-graph-uri=&query=select+*+from+%3Chttp%3A%2F%2Fmysite_address.com%2Fwsf%2Fdatasets%2F%3E+where+{%3Fs+%3Fp+%3Fo}&format=text%2Fhtml&debug=on
STEP 10: INSTALL DRUPAL
Drupal and selected add-in modules provide the user interface, user and group management, and overall content management system (CMS) hosting framework for a conStruct installation. They are the most visible portions of the system to users.
Besides Drupal itself and the conStruct modules, other key necessary modules include Organic Groups (OG), the Content Construction Kit (CCK) and Views.
Download & Install
Download the latest versions of the modules from Drupal Download site. You should select the Recommended Releases for Drupal 6 (usually the top-most green block in the Official releases section.
Download the latest modules from Drupal to your Desktop from each of the URLs below, one at a time:
| http://drupal.org/project/drupal http://drupal.org/project/construct http://drupal.org/project/og http://drupal.org/project/og_user_roles http://drupal.org/project/cck http://drupal.org/project/views |
First we have to download and install the Drupal package:
| sudo mkdir /var/www/drupal |
| cd /var/www/drupal |
|
sudo wget http://ftp.drupal.org/files/projects/drupal-6.15.tar.gz |
|
sudo tar -xvf drupal-6.15.tar.gz |
|
cd drupal-6.15 |
|
sudo mv * ../ |
Now let's fix the default Apache site folder:
|
sudo vim /etc/apache2/sites-available/default |
Change the file such as:
|
<VirtualHost *:80> DocumentRoot /var/www/drupal ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" </VirtualHost> |
Note: you have to change three things in this file: DocumentRoot, Directory and AllowOverride.
Then the next step is to create a ".htaccess" file for Drupal. First, let's open the .htaccess file in your Terminal with this command:
|
sudo vim /var/www/drupal/.htaccess |
Then, copy and paste the content of this file in the Vim (or other editor) window, save and close the file:
http://drupalcode.org/viewvc/drupal/drupal/.htaccess?revision=1.90.2.4&view=co
Finally, save the .htaccess file and restart the Apache server:
|
sudo /etc/init.d/apache2 restart |
Now let's download and install all needed modules by conStruct:
|
sudo mkdir /var/www/drupal/sites/all/modules |
|
cd /var/www/drupal/sites/all/modules |
|
sudo tar -xvf og-6.x-2.0.tar.gz sudo tar -xvf og_user_roles-6.x-4.0.tar.gz sudo tar -xvf cck-6.x-2.6.tar.gz sudo tar -xvf views-6.x-2.8.tar.gz sudo tar -xvf construct-6.x-1.x-dev.tar.gz |
If the package "construct-6.x-1.x-dev.tar.gz" as been untar in the folder "/construct" (check for the capital 'S'), then you should rename it to make it consistent with this installation manual to:
| sudo mv construct conStruct |
Setup
To setup Drupal first make a copy of default.settings.php file as settings.php. Copy both lines of the command and paste into Terminal:
| sudo cp /var/www/drupal/sites/default/default.settings.php /var/www/drupal/sites/default/settings.php |
Make the settings.php as writable:
| sudo chmod a+w /var/www/drupal/sites/default/settings.php |
Make the sites/default directory as writable:
| sudo chmod a+w /var/www/drupal/sites/default |
You then must configure Drupal's settings.php. To begin, open Drupal's /sites/default/settings.php file in a text editor:
| sudo vim /var/www/drupal/sites/default/settings.php |
Add the following line to the group of ini_set commands:
| ini_set("memory_limit","32M"); |
Copy the classes and properties structure files generated by sturctWSF into conStruct:
| sudo cp /data/ontologies/structure/classHierarchySerialized.srz /usr/share/drupal/sites/all/modules/conStruct/framework/ontologies/classHierarchySerialized.srz |
| sudo cp /data/ontologies/structure/propertyHierarchySerialized.srz /usr/share/drupal/sites/all/modules/conStruct/framework/ontologies/propertyHierarchySerialized.srz |
And, then, restart the Apache server to ensure the changes:
| sudo /etc/init.d/apache2 restart |
Starting Drupal for the First Time
You are now ready to go to http://mysite_address.com/ in a Web browser. You will see the Drupal install page. Click on Install Drupal in English. Enter database information -- our example entries are:
| Database Name: (assigned in MySQL installation Step 4) I used "drupal" username: root password: (assigned in step 4) |
Save the page and the Drupal install proceeds to Configure site. Before we deal with configuration, we'll deal with the warning at the top of the page. Put the Web browser aside without closing it.
In Terminal, remove write permissions to ./sites/default and ./sites/default/settings.php. Copy paste each command one line at a time into Terminal:
| sudo chmod a-w /var/www/drupal/sites/default/settings.php sudo chmod a-w /var/www/drupal/sites/default |
Now go back to the Web browser, which should still be on the configure site page.
Reload the configure site page (View-> Reload in Browser). The warning is replaced with a statement of the changes you have made. Enter site name and admin email address:
| Site name: the name (which will be visible on Web site's header in the default Drupal theme. site email : (your real email address) username: your SiteAdmin name (I used admin) Email address: SiteAdmin's email (your real email) password: your SiteAdmin password |
You should also enable Clean URLs. (If you don't do it now you can do it later).
To do so, navigate to the administration page for clean URLs (administer-> site configuration -> clean URLs) and enable them.
Leave further Drupal configuration until next steps are completed.
Other Drupal Modules
Other useful modules, such as WYSIWYG or Content Access or Pathauto or many of the other available Drupal modules might also be useful or desirable for your specific installation. However,as these are not essential for conStruct itself, they are not set out for download in these installation notes.
Please consult the Drupal or other third-party sites for information about these possible additions.
STEP 11: INSTALL SMARTY TEMPLATE ENGINE AND YUI
The Smarty component is used by conStruct for templated data displays, with the Yahoo! User Interface (YUI) JavaScript package also providing helpful UI support. (Note: this portion is likely due to be deprecated in next versions.)
Smarty Download and Install
To download and extract Smarty, use a Web browser to go to the site below:
Choose the Latest Stable Release and download to your desktop. Then, extract the folder from the Smarty-x.x.x .tar.gz with the following command (Note: the Smarty version number may be different for your download):
| sudo mkdir /var/www/drupal/sites/all/modules/conStruct/framework/smarty -p |
| cd /var/www/drupal/sites/all/modules/conStruct/framework/smarty |
| sudo wget http://www.smarty.net/do_download.php?download_file=Smarty-2.6.26.tar.gz |
Smarty installation simply requires placing the extracted files into the correct folder in Drupal's file structure. To install Smarty's library files, extract the downloded folder to the Drupal /sites/all/modules/construct/framework folder with the name smarty – don't forget to change the command to reflect the right name for your source file:
| sudo tar -xvf Smarty-2.6.26.tar.gz |
| cd Smarty-2.6.26 |
| sudo mv * ../ |
Use Terminal to make this directory with the command below:
| sudo mkdir /var/www/drupal/sites/all/modules/conStruct/templates/templates_c |
YUI Download and Install
To download and install YUI in Drupal's file structure, first use a Web browser to go to the site below:
http://developer.yahoo.com/yui/download/
This will begin the download. When download is complete, extract folder from the downloaded file with this command in Terminal:
| cd /var/www/drupal/sites/all/modules/conStruct/js/ |
| sudo wget http://developer.yahoo.com/yui/download/ |
Install YUI by unarchiving the package in the Drupal /sites/all/modules/construct/js folder:
| sudo unzip yui_2.8.0r4.zip |
STEP 12: CONFIGURE DRUPAL
Configure Modules
conStruct requires a number of Drupal modules to also be activated. To do so, point a Web browser to your new Drupal Web site (i.e., mysite_address.com) and log in as an administrator.
Navigate to Administer -> Site Building -> Modules.
Enable the following modules:
CCK: Content, content copy, content permissions, text
Organic Groups: Organic Groups, Organic Groups Access control, OG user roles, Organic Groups Views integration
Views: Views, Views UI
Save the configuration.
Note the messages from Drupal. One is likely a warning from Drupal to rebuild the content access permissions immediately .. we'll do that next, but do note the other messages. For example, you likely will see this message:
| Organic Groups and OG User Roles have been enabled. A readme file is referred to that you will be able to get later at http://somatv.ath.cx/sites/all/modules/og/README.txt |
Also, the request to run cron is not important just now.
Rebuild content access permissions now is important. - follow the instructions from Drupal using default settings.
Now go back to the Administer Modules page by navigating to: Administer -> Site Building -> Modules.
You are now ready to enable the 11 conStruct modules listed on this page:
conStruct: conStruct Core, Browse tool, Search tool, Dataset tool, Create tool, Update tool, Delete tool, Export tool, Import tool, Ontology tool, Resource tool, View tool
On saving, Drupal responds:
| The content type Dataset has been added. The field WSF address (field_wsf) was added to the content type Dataset. The field Existing Dataset URI (field_existing_dataset_uri) was added to the content type Dataset. The configuration options have been saved. |
Check the 11 ConStruct modules description statements (Administer -> Site Building -> Modules). All of the requirements should be enabled.
Set User Roles and Permissions
Now that the modules are enabled and registered to the system, you are ready to create conStruct user roles. Navigate to Roles - (Administer -> User Management -> Roles).
At minimum, we suggest you reate the following Roles:
- “admin” - the admin role is to be assigned to the users that will administer a conStruct/structWSF instance. These users will have full access to the datasets available on the node.
- "contributor": the contributor role is to be assigned to the users that need to contribute data to the conStruct node. These users normally just create and update data on a conStruct node.
- "owner/curator": The owner/curator users have full data management rights on the datasets they each "own" or "curate". However, they do not have access to the administrative features of the system.
(As you get familiar with the system, you may add roles with differing permissions at will.)
Once roles have been defined, you are now ready to grant User Role Permissions. To do so, go to Administer -> User Management -> Permissions.
As a baseline configuration, we suggest these permissions by role:
admin – check all checkboxes to enable everything for administrator and save
contributor: check off the following:
- block module - none
- comment module – access, post
- conStruct module - access
- content module - none
- content_permissions module – none
- filter module – none
- menu module - none
- node module – access content, create dataset content, delete own dataset content, edit own dataset content, view revisions
- og module - none
- og_user_roles module - none
- path module - none
- structBrowse module - access conStruct browse,
- structCreate module - access conStruct create,
- structDataset module - access conStruct dataset
- structDelete module – access conStruct delete
- structExport module – access conStruct export
- structImport module - access conStruct import
- structResource module - access conStruct resource
- structSearch module - access conStruct search
- structUpdate module - access conStruct update
- structView module - access conStruct view
- system module – none
- taxonomy module – none
- user module – none
- views module – none
owner/curator: check off the following:
- block module - none
- comment module – access, post
- conStruct module - access
- content module - none
- content_permissions module – none
- filter module – none
- menu module - none
- node module – access content, create dataset content, create page content, create story content, delete own dataset content, delete own page content, delete own story content, edit own dataset content, edit own page content, edit own story content, view revisions
- og module - none
- og_user_roles module - none
- structBrowse module - access conStruct browse, administer conStruct browse
- structCreate module - access conStruct create, administer conStruct create
- structDataset module - access conStruct dataset, administer conStruct dataset
- structDelete module – access conStruct delete, administer conStruct delete
- structExport module – access conStruct export, administer conStruct export
- structImport module - access conStruct import, administer conStruct import
- structResource module - access conStruct resource, administer conStruct resource
- structSearch module - access conStruct search, administer conStruct search
- structUpdate module - access conStruct update, administer conStruct update
- structView module - access conStruct view, administer conStruct view
- system module – none
- taxonomy module – none
- user module – none
- views module - access all views
anonymous user: check off the following:
- block module - none
- comment module – none
- conStruct module - access
- content module - none
- content_permissions module – none
- filter module – none
- menu module - none
- node module – access content
- og module - none
- og_user_roles module - none
- structBrowse module - access conStruct browse
- structCreate module - none
- structDataset module - none
- structDelete module – none
- structExport module – access conStruct export (if you want anonymous users downloading datasets from your system)
- structImport module - none
- structResource module - access conStruct resource
- structSearch module - access conStruct search
- structUpdate module - none
- structView module - access conStruct view
- system module – none
- taxonomy module – none
- user module – none
- views module - access all views
Configure Modules Blocks
The final step is to manage and display the links to the tools pages, in the layout of the Drupal page. Each conStruct module creates a Drupal "block". A block is a visual cluster in a Drupal user interface. To setup and display these blocks, you have to go to (Administer -> Site Building -> Blocks ). In the bottom of this page, you will see a "disabled" section, where all the conStruct blocks will appear.
Drag-and-drop all the conStruct blocks in the "Right sidebar" section of this page. Once you dragged all the blocks in that section, click the "Save blocks" button at the bottom of the page.
You will see all the tools appearing in the right sidebar of the page. You will notice that this is not that pretty. What you can do from here, is click on the "configure" link beside each conStruct block to rename their title (or remove it entirely by typing "<none>" in the title field. You can also re-order them as best fit your needs, or you can simply remove them you don't want to display on your page.
STEP 13: TEST THE INSTALLATION
The ultimate test is to be able to import a file describing record instance in RDF on the server, and be search, browse, view and export records that have been imported. Once we have been able to do these steps, we will be able to confirm that the structWSF and the conStruct instances are fully operational on the server.
Import Records
The first step is to import a set of records on the server. On your desktop computer, copy and paste the RDF/XML code below in a text editor, and save the file as structwsf_test.xml:
|
<?xml version="1.0" encoding="UTF-8"?> <rdf:Description rdf:about="http://purl.org/ontology/swt/construct_scs"> <rdf:Description rdf:about="http://purl.org/ontology/swt/structwsf"> <rdf:Description rdf:about="http://purl.org/ontology/swt/virtuoso"> </rdf:RDF> |
Then, log into Drupal with your administrator account, and click on the "import" link on the right sidebar of your Drupal installation.
Note: you won't be able to go to that page if the "Clean URLs" option is not enabled on your Drupal installation. Make sure it is enabled here: (Administer -> Site configuration -> Clean URLs)
Now, let's import that file into the system:
- Dataset file to import: Select the file you created above, from you Desktop
- Content type: Select "RDF+XML "
- Dataset name: Write "Test"
- Dataset description: Write "Test"
- Save dataset on this network: Select "http://localhost/ws/"
Finally click on the "Import Dataset" button.
If the importation went fine, you should be redirected to the "Browse tool", and see the three records that have been imported from the test file.
Note: results are not skinned with the default installation, so the results can appear crude at a first glance.
View Records
Once you see the files in the Browse tool, it means that everything got properly imported in the system. Next, you can click on one of the results to see its complete description.
At that point, you are using the default template to visualize all the information available for the given record.
Search Records
Next you can search the records using the Search tool. Click on the "search" link in the right sidebar. Then search for the "rdf" keyword. You will get results where the keyword "rdf" is found. This test ensures that the search capabilities of Solr are working.
Delete Dataset
Finally let's delete the dataset we imported. Click on the "Dataset" link in the right-sidebar. Then click on the "remove linked dataset" link for the "Test" dataset. You will be requested to confirm the deletion of the dataset. You simply have to click on the "delete group" button to delete the dataset.
Finally you will get a confirmation that the dataset has been deleted. If you try to browse or search datasets, you won't see any since the only one that was in the system as just been deleted.
If you have been able to perform all these steps without any error messages, it means that you fully and properly configured your server with structWSF and conStruct.
APPENDIX: LISTING OF COMPONENTS
This is a list of all the programs used in this installation and their version numbers:
| step | Type | Program Name | version | source |
|---|---|---|---|---|
| 1 | os | Ubuntu Server | 9.10 32 bit | http://ubuntu.com/getubuntu/download |
| 2 | dependency | autoconf | apt-get install | |
| 2 | curl | |||
| 2 | gawk | |||
| 2 | iodbc | |||
| 2 | libssl-dev | |||
| 2 | openssl | |||
| 2 | unzip | |||
| 2 | php5 | |||
| 2 | php5-mysql | |||
| 2 | php5-odbc | |||
| 2 | php5-cli | |||
| 2 | libapache2-mod-php5 | |||
| 2 | php5-curl | |||
| 2 | vim | |||
| 3 | apache2 | |||
| 4 | mysql-server | |||
| 4 | phpmyadmin | |||
| 6 | virtuoso | |||
| 7 | solr | |||
| 8 | structwsf | |||
| 8 | solr_schema.xml | |||
| 9 | arc2 | |||
| 10 | drupal (core module) | |||
| 10 | drupal construct | |||
| 10 | drupal og | |||
| 10 | drupal og_user_roles | |||
| 10 | drupal cck | |||
| 10 | drupal views | |||
| 11 | smarty | |||
| 11 | yui |
APPENDIX: SECURITY CHECK LIST
Before making a structWSF instance accessible on the Web, you should think about performing some security checks to make sure your server is not at risk. This is not a Linux server security guide, but simply points to some useful checks before making your system accessible on the Web. Please read more detailed papers or Web sites that talk about other things you should do to create a secure Linux server.
- Make sure all software is up-to-date by running these two commands: (1) apt-get update, (2) apt-get upgrade
- Change all default passwords for these software packages:
- MySQL
- Virtuoso
- Ubuntu
- Make sure that people cannot connect to the SSH server by using the root user account
- Use public/private (preferably with a passphrase) keys to connect to the SSH server, and disable connection using password
- Using the firewall, block all ports on the server. Then open the port 80 and 22 to everybody, and ports 8890 (Virtuoso) and 8983 (Solr) to the localhost only (and/or people you want them to have access to these user interfaces).
APPENDIX: AN AMAZON EC2/EBS ARCHITECTURE
At Structured Dynamics, we have developed and use a server architecture that leverages Amazon computer-in-the-clouds services such as: EC2, EBS, Elastic IP in the Cloud. Such an architecture is giving us the flexibility to easily maintain and upgrade server instances, to instantly create new structWSF instances in one click (without performing all these steps everytime), etc.
You can contact us for more information about these EC2 AMIs and EBS Volumes that we developed for this purpose. Here is an overview of the architecture that is in place:

There is a clear seperation of concerns between three major things:
- Software & libraries
- Configuration files
- Data files.
We chose to put all software and libraries needed to create a stand-alone structWSF instance in an EC2 AMI. This means that all needed software to run a structWSF instance is present on the Virtuoso server running Ubuntu server.
Then we chose to put all configuration and data files on a EBS volume that we attach, and mount, on the EC2 instance. You can think about a EBS volume as a physical hard drive: it can be mounted on a server instance, but it can't be shared between multiple instances.
By splitting the software & libraries, configuration and data files, we make sure that we can easily upgrade a structWSF server in production with the latest version of structWSF (its code base and all related software such as Virtuoso, Solr, etc). Since the configuration and data files are not on the EC2 instance, we can easily create a new EC2 instance by using the latest structWSF AMI we produced, and then to mount the configuration and data files EBS volume on the new (and upgraded) structWSF instance. That way, in a few clicks, we can fully upgrade a server in production without fear of disturbing the configuration or data files.
Additionally, we can easily create backups of configuration and data files at different intervals by using Amazon's Snapshot technology.
Finally, we chose to put all related software and configuration files needed to run a conStruct instance in another, seperate, EBS volume. That way, we have a clean structWSF AMI instance that can be upgraded at any time, and we can plug (mount) a conStruct instance (EBS instance) into a structWSF server at any time. This means that we can easily have structWSF instances with or without a conStruct instance. The same strategy can easily be used to create plugin pacakges that can be mounted and unmounted to any structWSF instance at any time, depending on the needs.
All this makes structWSF server instances maintenance easier, simpler and faster.