This video shows the activity in the constuct development repository from July 2005 to Jan 2009, frames were generated using the codeswarm system, and the video was rendered using the Virtual Dub application.
There’s been a lot of development on Construct over the last few months which will result in a couple of releases before the end of the year. The most recent update, (v0.8a) saw a restructuring of the data store around named graphs, and major improvements to performance (both in speed and memory consumption) throughout the framework. We are aiming for a final release of version 0.8 in late October, with remaining work focused on improving the installation procedure. Once complete, the next release (v0.9) will see the codebase becoming fully OSGi compliant in addition to improving support for cross-subnet communication.
Since the construct codebase is maintained by a large group of collaborators we need to use best practices in code development. Most of our collaborators use the Eclipse IDE, which makes integration of popular software engineering tools fairly straightforward. This post contains a list of Eclipse Plugins that we use in the Construct team to maintain our codebase. The most important tool in our kit is Subversion, as it helps us to keep in synch with each other. We recommend you use either the Subversive plugin or the Subclipse plugin. Either works fine, it’s a matter of personal preference.
Once you have Subversion set up properly you can update the construct codebase as a new project in your Eclipse workspace. It is important that you do this as a new project, since we commit our project settings, which include the plugin settings for our static checkers - the main point of this blog post
So, without further ado, here are the list of static checkers we use on the eclipse codebase:
-
Eclipse Checkstyle Plugin (update site: http://eclipse-cs.sourceforge.net/update): This is a plugin that enforces coding styles. The Construct codebase uses its own style (more of this later).
-
PMD (update site: http://pmd.sf.net/eclipse): scans Java source code and looks for potential problems.
-
FindBugs plugin (update site: http://findbugs.cs.umd.edu/eclipse/): uses static analysis to look for bugs in Java code.
-
Metrics (update site: http://metrics.sourceforge.net/update): calculates a number of metrics for your Java code.
-
EclEmma (update site: http://update.eclemma.org/): Java Code Coverage Software.
If these plugins are not installed you will not have the benefit of the settings files that are part of the construct codebase (these are all in the root directory of the project). The checkstyle documents are in the .checkstyle file and the checkstyle directory. The PMD configuration is in .pmd and .ruleset and the FindBugs configuration is in .fbprefs. If you updated these files from the subversion repository then your plugins should all be set up correctly.
Unfortunately, the Construct checkstyle setup is not the same as any of the built-in Eclipse code formatters so if you format your code using the built-in formatters (using Ctrl+Shift+F in Windows or CMD+Shift+F in OSX) your code will throw up many checkstyle errors and warnings. To overcome this we have created a new formatter for Eclipse. This setup is part of the .settings/org.eclipse.jdt.core.prefs file, but if you’d rather not overwrite your personal eclipse project preferences there is also an exported formatter in the checkstyle directory called construct_eclipse_formatter.xml.
Our setup is certainly not perfect, and we’d appreciate any suggestions you might have to improve it (are there other static checkers we should be using?). This document is likely to change over the coming weeks as we tweak our setup in the lead up to the next release of construct. This release will eliminate all PMD and FindBugs bugs and will comply as much as possible with our checkstyle specifications.
The alpha release of version 0.8 of Construct is now available from the download page. This distribution includes a DataGrabber component for loading RDF/XML files on startup, improved I/O performance, a reworked gossiping layer (not compatible with previous versions of Construct), and experimental support for Pellet. The full release for 0.8 is due in Q4 2008. See the CHANGELOG.txt enclosed in the distribution for full details.
Spurred by my belief in the Construct Infrastructure I took my official t-shirt with me in my backpack. In my role as Construct evangalist I’ll document the far reaching effects we’re having through a few photos. First is Rio de Janero in Brazil:
Provided my bag doesn’t get stolen there will be more to follow.
Part 2
And here it is. On Monday (8/9) I deployed Construct 0.8a to Machu Picchu in Peru. The Inkas love it. When I left the Inka chief was in deep discussion about named graph support and php-based web mashups over a hot cup of coca tea:

All messages that are exchanged between Construct services and applications take the following format: [3 bytes][10 bytes][payload]
- The first 3 bytes correspond to the message type identifier (see below).
The next 10 bytes correspond to the length of the message payload in bytes. For example, a message with a 64 byte payload would be written as 0000000064.
- Finally, the message payload consists of a number of bytes indicated by the previous part of the message. The contents of the payload are protocol specific.
The message identifier codes used are as follows:
| The protocol identifier for querying | QUERY | 200 |
| The protocol identifier used for responding to queries | QUERY_RESPONSE | 210 |
| The protocol identifier used for sending rdf statements to the data port | RDF_ADD | 100 |
| The protocol identifier used for responding to an add rdf statements request | RDF_ADD_RESPONSE | 110 |
| The protocol identifier used for sending a service descriptor | SERVICE_DESCRIPTOR_RESPONSE | 310 |
When most service send a response to the client, the payload also takes the form of a code:
| The operation succeeded | OK | 600 |
| An error occured during the operation | ERROR | 610 |
| The service code was unrecognised | UNKNOWN | 650 |
Working with the discovery service
Open a connection to the host/port given in the bonjour resolution (there is no need to send any data). You will be sent an XML descriptor file of the form -
-
<services>
-
<servicecomponentdescriptor>
-
<name>Construct DataPort</name>
-
<description>Raw data port: Connect via a socket and send N-TRIPLE RDF strings. Response string will be ok or error if it fails.</description>
-
<host>erdinger</host>
-
<port>3528</port>
-
<misc>See example applications.</misc>
-
</servicecomponentdescriptor>
-
<servicecomponentdescriptor>
-
<name>Construct QueryService</name>
-
<description>The query service: Connect via a socket and send SPARQL queries. Response string will be a SPARQL result set in RDF.</description>
-
<host>erdinger</host>
-
<port>3531</port>
-
<misc>See example applications.</misc>
-
</servicecomponentdescriptor>
-
</services>
This provides you with all the information required to open a connection to the data port or query service directly.
Working with the data port
Use the protocol described above. This is an example of adding a single line:
-
1000000000043<http://hello> <http://construct> "world" .
NOTE: The data RDF Triple must have the trailing full stop . Example responses might be:
-
1100000000003600(OK) -
1100000000003610(ERROR) -
1100000000003650(UNKNOWN)
Working with the query service
The point of contact for application developers to Construct is the Query Service. It takes a SPARQL query as an input. This query is run on the data store (a list of RDF triples). If the query is valid and answerable, a string of data will be returned. This section will try to help you write a SPARQL query, and make sense of the returned information.
Writing a SPARQL query
The presence of a query service implies that there must be something to query. The data in Construct is stored in the data store. All the data is represented in RDF triples. Here’s a few examples of these: For readability, we will replace the URIs with the prefixes “sighting:” and “person:”. NOTE: The prefixes in the query(below) is valid SPARQL syntax.
-
PREFIX: sighting:http://srg.ucd.ie/construct/sighting#
-
PREFIX: person:http://www.pervasive-ontologies.org/ontologies/context/person.owl#
-
<sighting:Waldo109> <sighting:person> <person:Waldo>
-
<sighting:Waldo109> <sighing:computer> <http://srg.cs.ucd.ie/construct/computer/waldo.ucd.ie>
-
<sighting:Waldo109> <sighting:time> <2006-10-04T13:17:59Z>
-
<sighitng:Waldo109> <sightingstatus> <Active>
These four statements represent a sighting from a computer activity sensor.
The Query
To retrieve information from construct, a query must be written in the SPARQL format. This has a similar “Select X From Y Where Z” form to an SQL query. Here is an example query which relates to the RDF Triples above. It finds all the times of sightings of Waldo(note the time triple above).
-
String personQuery = “PREFIX sighting:<http://srg.ucd.ie/construct/sighting#> “
-
+ “PREFIX user:<http://www.pervasive-ontologies.org/ontologies/context/person.owl#> “
-
+ “SELECT ?time “
-
+ “WHERE {”
-
+ “?sighting sighting:person user:Waldo . “
-
+ “?sighting sighting:status sighting:Active . “
-
+ “?sighting sighting:time ?time”
-
+ “}”;
For a more comprehensive tutorial on SPARQL, visit the website at: http://www.w3.org/TR/rdf-sparql-query/
In order to send a query to the query service we must use the protocol described above. Below is an example.
-
200[payload length][SPARQL QUERY]
The Response
You will be sent back a string of the form
-
210[payload length][SPARQL result set in RDF form] - OR
2100000000003610(if an error occured)
This String is a SPARQL ResultSet. This is a valid RDF string, represented in N-TRIPLE format. This means that way in which it is processed is dependent on the RDF parsing capabilities of the language used. For example, in java, a new Jena model (or indeed a ResultSet object) can be created from it, and it can be then easily traversed.
Steve, an original member of the Construct Dev team, left the Systems Research Group last week. He’s off to get hitched and travel the world - so we won’t hold it against him!
As part of his leaving presents we made up this rather fetching (even if we do say so ourselves) T-Shirt, so that he can spread the word of Construct to the world.
Good luck Steve - Bon Voyage!
The 2nd International Workshop on Ubiquitous Systems Evalution (USE ‘08) will take place in Seoul, South Korea on 21st September, 2008. The workshop is being organised by Construct developers Graeme Stevenson and Steve Neely of University College Dublin, and by Christian Kray of Newcastle University.
Following on from last year’s workshop in Innsbruck, USE ‘08 aims to bring together practitioners from a wide range of disciplines to discuss best practice and challenges in the evaluation of ubiquitous systems. Recognised evaluation strategies are essential in order that the contribution of new techniques can be quantified objectively. Experience has shown that evaluating ubiquitous systems is extremely difficult; approaches tend to be subjective, piecemeal or both. Individual approaches to evaluation risk being incomplete and comparisons between systems can be difficult.
The submission deadline for USE ‘08 is July 07, 2008. Please visit http://www.useworkshop.org for further details.
The next release of Construct contains named graphs. These allow you to store information that describes your RDF statements. I’ll give a simple run through of how to query Construct using named graphs (if you want more detail check out the w3c recommendation ).
When querying named graphs in Construct using SPARQL and the QueryService you need to add the GRAPH keyword to pattern match against graphs in the dataset. Lets start with the easiest example, selecting all the graphs and all the statements…
-
SELECT * WHERE { GRAPH ?graph { ?s ?p ?o } }
So now your resultset is going to be able to return four pieces of info for every statement.
Graphs in Construct probably don’t confer too much useful information on their own however, as they are just unique ids, created by the data store.
It is useful though to know what graph(s) a statement or set of statements appears in. You could use something like this…
-
SELECT DISTINCT ?graph WHERE { GRAPH ?graph { <http://construct-infrastructure.org/subject> ?p ?o } }
Now you’ve got the graph(s) that your statement(s) appears in, suppose you wanted to find all the metadata associated with those statements. All you have to do is add the following query…
-
SELECT ?p ?o FROM NAMED <$GRAPH_URI> WHERE { GRAPH ?graph { ?graph ?p ?o } }
where $GRAPH_URI corresponds to the name of the graph(s) returned by the previous query. Now you’ve got all the metadata associated with your statement(s). This is only a small example of what kind of SPARQL queries can get the most out of the new data storage technique - all that’s left is to have a go!
Every time Ubuntu’s Synaptic Package Manager updates the Avahi layer for Bonjour support it stomps on my Apple Bonjour install and breaks my Construct install. My guess is that the update puts Avahi first in the list of Bonjours to run when Construct starts. So I get this error:
*** WARNING *** The programme ‘java’ uses the Apple Bonjour compatiblity layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see
*** WARNING *** The programme ‘java’ called ‘DNSServiceQueryRecord()’ which is not supported (or only supported partially) in the Apple Bonjour compatiblity layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see
One way to address this is just to turn off the Avahi warning. Set an environmental variable list this export AVAHI_COMPAT_NOWARN=1 This isn’t a fix though it is just hiding the warning.
The best I have figured out so far is just to reinstall Bonjour:
Instructions for Installing Apple’s Bonjour on *nix
- Download the latest version of the Bonjour source code here.
- Decompress the downloaded archive
- cd to the mDNSPosix directory below the mDNSResponder-xxx directory (where xxx is the Bonjour version number).
- Edit
Makefileand change lineJDK = /usr/jdkto make it point at your Java installation (e.g., /usr/lib/jvm/java-6-sun) - Type
sudo make os=linux Java
- Type
sudo make os=linux install— if you have problems with this, see below. Most likely you will need to install a specific version of gcc
- Copy the java specific files to your jre lib’s ext directory (
cp build/prod/* /path/to/jre/lib/ext/) - Open up
/etc/nsswitch.confand ensure that the ‘mdns’ switch appears on the “hosts:” line. My “hosts:” line looks like this:
hosts: files dns mdns
Remember, whenever you use a new jre, make sure to include dns_sd.jar (Bonjour JAR file) in your jre/lib/ext directory
Problems with the install
Problems with stdlib.h
Lorcan had some problems with this install on Ubuntu (Edgy). He says: when running sudo make os=linux Java I got a lot of errors, starting with ../mDNSShared/dnssd_clientlib.c:71:20: error: stdlib.h: No such file or directory.
I installed the libc6-dev package. When I tried again everything worked fine
Problems with __stack_chk_fail_local
I had some major problems with this install on Ubuntu (Edgy), specifically when using gcc4.1 (to find out which version of gcc you are using type gcc --version).
lorcan@comp:~/Desktop/mDNSResponder-107.6/mDNSPosix$ sudo make os=linux install
Stopping Apple Darwin Multicast DNS / DNS Service Discovery daemon: mdnsd.
cp build/prod/mdnsd /usr/sbin/mdnsd
/usr/sbin/mdnsd installed
cp mdnsd.sh /etc/init.d/mdns
chmod ugo+x /etc/init.d/mdns
/etc/init.d/mdns start
Starting Apple Darwin Multicast DNS / DNS Service Discovery daemon: mdnsd.
ln -s -f /etc/init.d/mdns /etc/rc2.d/S52mdns
ln -s -f /etc/init.d/mdns /etc/rc3.d/S52mdns
ln -s -f /etc/init.d/mdns /etc/rc4.d/S52mdns
ln -s -f /etc/init.d/mdns /etc/rc5.d/S52mdns
ln -s -f /etc/init.d/mdns /etc/rc0.d/K16mdns
ln -s -f /etc/init.d/mdns /etc/rc6.d/K16mdns
/etc/init.d/mdns installed
cp build/prod/libdns_sd.so /usr/lib/libdns_sd.so.1
ln -s -f /usr/lib/libdns_sd.so.1 /usr/lib/libdns_sd.so
/usr/lib/libdns_sd.so.1 /usr/include/dns_sd.h installed
/usr/share/man/man8/mdnsd.8 installed
make[1]: Entering directory `/home/lorcan/Desktop/mDNSResponder-107.6/Clients’
mkdir build
cc dns-sd.c -L../mDNSPosix/build/prod/ -ldns_sd -I../mDNSShared -o build/dns-sd
/usr/bin/ld: build/dns-sd: hidden symbol `__stack_chk_fail_local’ in /usr/lib/libc_nonshared.a(stack_chk_fail_local.oS) is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status
make[1]: *** [build/dns-sd] Error 1
make[1]: Leaving directory `/home/lorcan/Desktop/mDNSResponder-107.6/Clients’
make: *** [../Clients/build/dns-sd] Error 2
Solution:
If the version of gcc is not 4.0.x Follow these instructions (EXACTLY!!!) to correct the problem:
- Ensure that gcc version 4.0.x is installed. This is a little tricky as the synaptic package manager stopped supporting this version of gcc since edgy. You’ll have to download the following packages: gcc-4.0-base, cpp-4.0 , gcc-4.0
- Open the terminal and cd to where you saved the package.
- Do the following for each of the three packages: dpkg -i PACKAGE.deb Install them in the same order the are above. gcc base first, then cpp, then gcc — This should put gcc-4.0 into your /usr/bin directory.
-
cd /usr/bin -
sudo mv gcc gcc-backup -
sudo ln -s gcc-4.0 gcc
Now completely rerun the instructions above (at the top of this page) to install Bonjour (you must completely rerun them from step 2). When installation is complete continue these instructions.
-
sudo cd /usr/bin -
sudo rm gcc -
sudo mv gcc-backup gcc
Now gcc should point to the original version of gcc (i.e. that version that you were using before you installed Bonjour).
![[del.icio.us]](http://www.construct-infrastructure.org/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://www.construct-infrastructure.org/wp-content/plugins/bookmarkify/digg.png)
![[Google]](http://www.construct-infrastructure.org/wp-content/plugins/bookmarkify/google.png)
![[StumbleUpon]](http://www.construct-infrastructure.org/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Windows Live]](http://www.construct-infrastructure.org/wp-content/plugins/bookmarkify/windowslive.png)
![[Yahoo!]](http://www.construct-infrastructure.org/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://www.construct-infrastructure.org/wp-content/plugins/bookmarkify/email.png)
