|
UsingOntoWikiWithVirtuoso
Tutorial on Setting up OntoWiki with Virtuoso
Using OntoWiki with VirtuosoThis guide explains the necessary steps to use OntoWiki with OpenLink Virtuoso. OverviewThis is the basic procedure. For details see below.
Compiling VirtuosoFor some OS, e.g. Windows, binaries exist. If you have to compile it, it is recommended to give a <prefix>, which will be the path where Virtuoso will be installed. Ubuntu recommendation: use ./configure --prefix=/opt/virtuoso. Virtuoso also comes along with a good README with further instructions. Ubuntu Tipp: configuring with the libreadline library allows for better characters passing to isql command line client '--with-readline=path/to/libreadline' (use apt-get install libreadline5-dev and '--with-readline=/usr/lib/libreadline.so'). Also, if you want to activate virtuosos php ability, e.g. for the vad package use --with-php5=/usr/bin/php5. sudo ./configure --prefix=/opt/virtuoso-opensource-version --with-readline=/usr/lib/libreadline.so --with-php5=/usr/bin/php5 Note for Debian/Ubuntu: You can download a deb-packgage here: http://docs.ontowiki.net/virtuoso/ (nethertheless, you have to configure the DirsAllowed variable) Compiling Virtuoso requires the following build tools be installed.
Ubuntu: apt-get install autoconf automake libtool flex bison gperf gawk m4 make openssl libssl-dev Having these tools, compiling and installing Virtuoso is just a matter of configure/make/make install. Configuring VirtuosoVirtuoso keeps all the files for a database in a folder along with a configuration file. An example configuration file which we will use as a base for our configuration is provided with the default database. To create a Virtuoso database for OntoWiki perform the following steps:
Setting up ODBCDatabase connection to Virtuoso happens through ODBC. ODBC is configured by two files, odbc.ini and odbcinst.ini. On Linux systems they can be found under /etc, on Mac OS X systems under /Library/ODBC. In case they don't exist, create them.
[virtuoso-odbc] Driver = <prefix>/lib/virtodbc.so [ODBC Data Sources] VOS = Virtuoso [VOS] Driver = virtuoso-odbc Description = Virtuoso Open-Source Edition ServerName = localhost:1111 Now make sure, PHP can connect to Virtuoso via ODBC. On some Linux systems you may have to install the ODBC package for PHP (php5-odbc). To test the connection, create a file called odbctest.php in you webroot with the following PHP code in it: <?php
$conn = odbc_connect('VOS', 'dba', 'dba');
$query = 'SELECT DISTINCT ?g WHERE {GRAPH ?g {?s ?p ?o.}}';
$result = odbc_exec($conn, 'CALL DB.DBA.SPARQL_EVAL(\'' . $query . '\', NULL, 0)');
?>
<ul>
<?php while (odbc_fetch_row($result)): ?>
<li><?php echo odbc_result($result, 1) ?></li>
<?php endwhile; ?>
</ul>Execute it by clicking on this link: http://localhost/odbctest.php http://localhost/odbctest.php. You should see a list of graphs stored in your Virtuoso RDF store. On a vanilla Virtuoso installation this list should include the following two graphs: If you see this list and no error messages along the way, go ahead configuring OntoWiki. Configuring OntoWikiPerform the following steps to set up OntoWiki:
store.backend = virtuoso store.virtuoso.dsn = VOS store.virtuoso.username = dba store.virtuoso.password = dba FAQ
Platform-specific NotesGNU/LinuxTo start Virtuoso, switch to <prefix>/bin and run: ./virtuoso-t -f -c /opt/virtuoso/var/lib/virtuoso/ontowiki/virtuoso.ini (Virtuoso runs in foreground using the created OntoWiki specific configuration file.) Cave: Run Virtuoso with enough rights. When importing knowledge bases from file, they are first copied to tmp. Virtuoso needs a sufficiently high user like root or www-data to read it (besides adding the tmp dir to DirsAllowed). Otherwise you will get the error: Error importing knowledge base: Graph '<http://inserttesst.org>' could not be imported: Error importing statements: SQL Error: [unixODBC][OpenLink][Virtuoso iODBC Driver][Virtuoso Server]FA012: Can't open file '/tmp/phpWH20k0', error (13) : Permission denied (37000) CALL DB.DBA.RDF_LOAD_RDFXML(FILE_TO_STRING_OUTPUT('/tmp/phpWH20k0'), '', 'http://inserttesst.org') Debian GNU/LinuxIf you install Virtuoso from the .deb-Package you have to change in '/etc/init.d/virtuoso-opensource' the line DBBASE=/var/lib/virtuoso/db to DBBASE=/var/lib/virtuoso/ontowiki while virtuoso is not running. Mac OS XTo auto-start Virtuoso on Mac OS X 10.5 use a config file for the launchd service. It should be placed under /Library/LaunchDaemons. The following is an example file, replace the paths with your settings where necessary. macbook-pro:~ norman$ cat ~/Library/LaunchDaemons/com.openlinksw.virtuoso.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>UserName</key> <string>root</string> <key>GroupName</key> <string>wheel</string> <key>RunAtLoad</key> <true/> <key>Label</key> <string>com.openlinksw.virtuoso</string> <key>OnDemand</key> <false/> <key>ProgramArguments</key> <array> <string>/usr/local/bin/virtuoso-t</string> <string>-f</string> <string>-c</string> <string>/usr/local/var/lib/virtuoso/ontowiki/virtuoso.ini</string> </array> </dict> </plist> WindowsFollow these instructions in order to set up Virtuoso as an ODBC data source on Windows. |
Sign in to add a comment
>> SQL Error: unixODBCOpenLinkiODBC DriverServerFA011: Access to /var/www/ontowiki/libraries/Erfurt/include/SysOntLocal?.rdf is denied due to access control in ini file (37000) Solution: do Configuring Virtuoso Step 4
It seems that this file is not copied to /tmp first, so the path /var/www/ontowiki/libraries/Erfurt/include/ needs to be added to DirsAllowed? too. (I got the error despite having /tmp specified).
I met the error "access to %file% is denied due to access control in ini file (42000)" while trying to upload a file for creating a new knowledge base.
There is a bug in \libraries\Erfurt\Store\Adapter\Virtuoso.php at line 1091, since, at least in Windows, the slash "\" characters in the file name are not escaped and Virtuoso cannot recognize the correct path, giving such error. The solution id to change the line 1091 in virtuoso.php with:
str_replace("\\","\\\\",$file),
Hope this help, because it made me crazy :S