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:
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.
This tutorial shows how to insert RDF from a file (joebloggs_foaf.rdf) into Construct. It then shows how to send a SPARQL query to query this data from Construct. The resulting QueryResults object is printed in N3 format.
from construct.proxyimport proxy
from construct.constructserviceimport ServiceError
_:A6a94e801X3aX118515eda06X3aXX2dX7ffc <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2001/sw/DataAccess/tests/result-set#ResultSet> .
This post is the final part of a python and Construct tutorial. Part 1 is here and part 2 is here.
<http://www.example.com/~joebloggs> <http://xmlns.com/foaf/0.1/family_name> “Bloggs”.
This post is the second part of a tutorial on construct and python. Back to Part 1 of this tutorial or on to Part 3.
This post will show how to connect to a Construct Data Port and submit RDF data.
If an instance of Construct is available, this code will insert two pieces of RDF in N3 format. The first of these is good RDF, the second of these is not. The script is below, and example output beneath that again.
#Import the python construct proxy.
from construct.proxyimport proxy
from construct.constructserviceimport ServiceError
print“Response to bad RDF: “ + str(insertBadResponse)
# response should be “None”
except ServiceError, e:
print e.value
# Close the proxy.
proxy.close()
If this code has executed correctly (i.e., if an instance of Construct is discovered) the following will be printed:
Executing Script
Response to good RDF: 1
Response to bad RDF: None
If the Construct proxy is not found the following will be printed:
Executing Script
Error - unable to contact an instance node of Construct (using address localhost:3826). Is the Construct Proxy running at that address?
and if no instance of Construct is discovered the following will be printed:
Executing Script
Error: No instance of Construct found. Please ensure you are within Zeroconf range of a running instance of Construct
This post is the first part of a tutorial on construct and python. Part 2 of this tutorial is here and part 3 is here