Compiling 4store on a Fedora 12 box

2009-12-14 13:40:16 +0000

I was attempting to install 4store on my fedora 12 box, and I found that I couldn’t run the tests which are shipped with 4store. I got the following output when attempting to run “make test” :

<br /> [root@blanket 4store]# make test<br /> (cd tests && make -w test)<br /> make[1]: Entering directory `/usr/local/src/4store/tests'<br /> (cd query && pwd && ./setup.sh --autorun)<br /> /usr/local/src/4store/tests/query<br /> 4store[9702]: backend-setup.c:176 erased files for KB query_test_mmt04r<br /> 4store[9702]: backend-setup.c:301 created RDF metadata for KB query_test_mmt04r<br /> ../../src/frontend/4s-import: error while loading shared libraries: librasqal.so.1: cannot open shared object file: No such file or directory<br /> Preparing for tests...<br /> ../../src/frontend/4s-delete-model: error while loading shared libraries: librasqal.so.1: cannot open shared object file: No such file or directory<br /> [FAIL] add-and-delete<br /> [FAIL] distinct-predicate<br /> [FAIL] foaf-all-limit<br /> [FAIL] foaf-bnode-vs-variable<br /> [FAIL] foaf-construct<br /> [FAIL] foaf-disjunctive-filter<br /> [FAIL] foaf-distinct<br /> [FAIL] foaf-graph-all<br /> [FAIL] foaf-graph-pred<br /> [FAIL] foaf-knows-name<br /> [FAIL] foaf-knows-name-sha1<br /> [FAIL] foaf-knows-sha1<br /> [FAIL] foaf-knows-sha1-xml<br /> [FAIL] foaf-multi-disjunctive-filter<br /> [FAIL] foaf-nested-optional<br /> [FAIL] foaf-nothing<br /> [FAIL] foaf-optional-order<br /> [FAIL] foaf-optional-pair<br /> [FAIL] foaf-optional-regex<br /> [FAIL] foaf-repeat-var<br /> [FAIL] graphs<br /> [PASS] integrity<br /> [FAIL] null-optional<br /> [FAIL] null-optional-double<br /> [FAIL] optimiser-disjunction<br /> [FAIL] select-bnodes<br /> [FAIL] select-order<br /> [FAIL] select-unused<br /> [FAIL] size<br /> [FAIL] tiger-broadway<br /> [FAIL] tiger-explosion<br /> [FAIL] tiger-fail-optional<br /> [FAIL] tiger-harold-ave<br /> [FAIL] tiger-landmarks<br /> [FAIL] tiger-mixed-optional<br /> [FAIL] tiger-reverse<br /> [FAIL] tiger-sugar-hill<br /> [FAIL] tiger-sugar-hill-filter<br /> [FAIL] tiger-typical<br /> [FAIL] tiger-water-names<br /> Tests completed: passed 1/40 (39 fails)<br /> make[1]: Leaving directory `/usr/local/src/4store/tests'<br />

This struck me as odd given that when I ran the “configure” script I got the following output :
<br /> [root@blanket 4store]# ./configure<br /> [OK ] pkg-config installed<br /> [OK ] raptor installed<br /> [OK ] rasqal installed<br /> [OK ] glib2 installed<br /> [OK ] libxml2 installed<br /> [OK ] pcre installed<br /> [OK ] ncurses installed<br /> [OK ] readline installed<br /> [OK ] z installed<br /> [OK ] avahi installed<br />

So these are the setup step which I had to perform in order to get 4store working and running the tests:

1. After compiling the code, used ldd to see which libs were missing
<br /> ldd src/frontend/4s-query<br /> [root@blanket 4store]# ldd !$2<br /> ldd src/frontend/4s-query<br /> linux-gate.so.1 => (0x00d9a000)<br /> librasqal.so.1 => not found<br /> libraptor.so.1 => /usr/lib/libraptor.so.1 (0x00678000)<br /> libxml2.so.2 => /usr/lib/libxml2.so.2 (0x04f2f000)<br /> libavahi-common.so.3 => /usr/lib/libavahi-common.so.3 (0x051d0000)<br /> libavahi-client.so.3 => /usr/lib/libavahi-client.so.3 (0x051bd000)<br /> libavahi-glib.so.1 => /usr/lib/libavahi-glib.so.1 (0x004b8000)<br /> libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0x00da9000)<br /> libpcre.so.0 => /lib/libpcre.so.0 (0x00110000)<br /> ....<br />
**

  1. Fix my ld.so configuration. The issue was that I had to add the following line, which points to my librasqal.so.1, to the following empty file
    /etc/ld.so.conf.d/local.conf :**
    <br /> /usr/local/lib<br />

A big yay to working 4store :
<br /> [root@blanket 4store]# make test<br /> (cd tests && make -w test)<br /> make[1]: Entering directory `/usr/local/src/4store/tests'<br /> (cd query && pwd && ./setup.sh --autorun)<br /> /usr/local/src/4store/tests/query<br /> 4store[10887]: backend-setup.c:176 erased files for KB query_test_mmt04r<br /> 4store[10887]: backend-setup.c:301 created RDF metadata for KB query_test_mmt04r<br /> removing old data<br /> Reading <file:///usr/local/src/4store/tests/query/../../data/swh.xrdf><br /> into <http://example.com/swh.xrdf><br /> Pass 1, processed 63 triples (63)<br /> Reading <file:///usr/local/src/4store/tests/query/../../data/tiger/TGR06001.nt><br /> into <http://example.com/TGR06001.nt><br /> Pass 1, processed 764610 triples (764547)<br /> Reading <file:///usr/local/src/4store/tests/query/../../data/nasty.ttl><br /> into <http://example.com/nasty.ttl><br /> Pass 1, processed 764658 triples (48)<br /> Pass 2, processed 764658 triples, 26769 triples/s<br /> Updating index<br /> Index update took 17.133335 seconds<br /> Imported 764658 triples, average 19375 triples/s<br /> Preparing for tests...<br /> [PASS] add-and-delete<br /> [PASS] count<br /> [PASS] distinct-predicate<br /> [PASS] foaf-all-limit<br /> [PASS] foaf-bnode-vs-variable<br /> [PASS] foaf-construct<br /> [PASS] foaf-disjunctive-filter<br /> [PASS] foaf-distinct<br /> [PASS] foaf-graph-all<br /> [PASS] foaf-graph-pred<br /> [PASS] foaf-knows-name<br /> [PASS] foaf-knows-name-sha1<br /> [PASS] foaf-knows-sha1<br /> [PASS] foaf-knows-sha1-xml<br /> [PASS] foaf-multi-disjunctive-filter<br /> [PASS] foaf-nested-optional<br /> [PASS] foaf-nothing<br /> [PASS] foaf-optional-order<br /> [PASS] foaf-optional-pair<br /> [PASS] foaf-optional-regex<br /> [PASS] foaf-repeat-var<br /> [PASS] graphs<br /> [PASS] integrity<br /> [PASS] null-optional<br /> [PASS] null-optional-double<br /> [PASS] optimiser-disjunction<br /> [PASS] select-bnodes<br /> [PASS] select-order<br /> [PASS] select-unused<br /> [PASS] size<br /> [PASS] tiger-broadway<br /> [PASS] tiger-explosion<br /> [PASS] tiger-fail-optional<br /> [PASS] tiger-harold-ave<br /> [PASS] tiger-landmarks<br /> [PASS] tiger-mixed-optional<br /> [PASS] tiger-reverse<br /> [PASS] tiger-sugar-hill<br /> [PASS] tiger-sugar-hill-filter<br /> [PASS] tiger-typical<br /> [PASS] tiger-water-names<br /> [PASS] union-nobind<br /> Tests completed: passed 42/42 (0 fails)<br /> make[1]: Leaving directory `/usr/local/src/4store/tests'<br />

4store and Dan Hanley’s client libgs

2009-12-13 20:19:22 +0000

Find below step by step instructions on how to talk to a 4store KB via the SPARQL-Procotol in Java, using Dan Hanley’s 4store client libs.

First of all you need to have the following installed :
4store
A java compiler (i have Sun’s Java SDK 1.6.x installed on my laptop)
Maven (to compile Dan Hanley’s 4store client libs).

I have all of the code needed for this example placed on my site here : https://mmt.me.uk/blog/examples/4store-java-query-example/ feel free to grab and use it as you wish.

First of all, I should say that I have had to patch the 4store-client-library, as it seems to chomp all of the carriage returns at the end of the lines (“\n”). This is fine you are using the SPARQL-XML-RESULT format, by I am a tad lazy and much prefer working with the tsv format: tsv requires line breaks.

The git diff of my patch looks like so (and again yes it is a tad dirty) :
`
diff –git a/src/main/java/uk/co/magus/fourstore/client/Store.java b/src/main/java/uk/co/magus/fourstore/clie
index 6652874..097be43 100644
— a/src/main/java/uk/co/magus/fourstore/client/Store.java
+++ b/src/main/java/uk/co/magus/fourstore/client/Store.java
@@ -349,7 +349,7 @@ public class Store {
String response = “”;
String str;
while (null != ((str = in.readLine()))) {

  • response += str;
  • response += str+”\n”;
    }
    in.close();
    return response;
    ~
    ~
    `

This above patch allows me to make use of the TSV output as needed. The patch can be grabbed from here : https://mmt.me.uk/blog/examples/4store-java-query-example/patch.txt.

Ok, now that I have built the 4store-client.jar file with my patch using the instructions in the git repo. I create an example RDF file, and some example java code which will query the 4store KB. All the files can be found on my site https://mmt.me.uk/blog/examples/4store-java-query-example/.

These are the steps which I have taken to get this little demo up and running :
1. Create 4store KB called lame
<br /> 4s-backend-setup --node 0 --cluster 1 --segments 2 lame<br />

2. Start lame‘s backend (i.e. start the KB)
<br /> 4s-backend lame<br />

3. Import the example.rdf file into lame‘s backend (i.e. start the KB)
<br /> 4s-import lame example.rdf<br />

4. Start HTTPD for the KB named lame
<br /> 4s-httpd -s -1 lame<br />

And then I need to compile the exampleQuery code I knocked together
<br /> javac -cp 4store-client-1.0.jar exampleQuery.java<br />

Finally, I run the code like so :
<br /> java -cp 4store-client-1.0.jar:. exampleQuery<br />

Resulting in the following output:
<br /> Am about to query a sparql endpoint<br /> A user name is:"Bob"<br /> A user name is:"Alice"<br />

I hope this helps!

Private Browsing with Safari

2009-11-15 20:38:33 +0000

I use Firefox as my primary browser, both at home and at work. So I have setup my Safari browser, as my private browser – that is sans cache, history, cookies or anything of a similar nature. I noticed that the “Private Browsing” option in Safari, doesn’t do that good a job of not leaving files hanging around in one’s operating system, furthermore unless your careful, Spotlight will eventually end up indexing your browser history, cache, which may be less than ideal.

In order to have a zero cache safari instance on my laptop I have taken the following steps :

  • 1: Removed spotlight’s prying eyes, by excluding the following directories :
    • /Users//Library/Caches
    • /Users//Library/Safari
    • /Library/Caches
  • 2: Setup two cronjobs to constantly delete Safari cache-dir */10 * * * * find /Users/<USERDIR>/Library/Safari -type f -exec rm {} \; 2>&1 > /dev/null<br /> */10 * * * * find /Users/<USERDIR>/Library/Caches/Metadata/Safari/ -type f -exec rm {} \; 2>&1 > /dev/null </ul> </ul>

And finally, I have created a wrapper .app file which open’s Safari, and then enables “Private Browsing” mode, as I could not find a way to do this through editing the Safari.plist file. I followed the instructions posted on the MacWorld site, and they go a little something list so:

    1. One needs to enable the Enable Access for Assistive Devices option, which can be found in the Universal Access system preference.
    1. Open the AppleScript editor, and type in the following commands : <br /> tell application "Safari"<br /> &nbsp;&nbsp; activate<br /> end tell<br /> tell application "System Events"<br /> &nbsp;&nbsp; tell process "Safari"<br /> &nbsp;&nbsp;&nbsp; tell menu bar 1<br /> &nbsp;&nbsp;&nbsp;&nbsp; tell menu bar item "Safari"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tell menu "Safari"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; click menu item "Private Browsing"<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end tell<br /> &nbsp;&nbsp;&nbsp;&nbsp; end tell<br /> &nbsp;&nbsp;&nbsp; end tell<br /> &nbsp;&nbsp;end tell<br /> end tell<br /> </li>
      1. Save this shiny new AppleScript as an application (.app file), and I called mine “PrivateSafari.app”.
      1. I then grabbed the icon file from Safari, and added to the PrivateSafari, and then replace the old shortcut in my Dock, with one to “PrivateSafari.app”.</ul>

    It should be noted that I am well aware that the private browsing features in most of the modern web browsers have come under a certain amount of scrutiny recently, below are some links to articles for the interested reader :