ARQ - Frequently Asked Questions

java.lang.NoClassDefFoundError
The classpath is wrong. Include all the jar files in lib/. You need to name each one. See also "The CLASSPATH and Environment Variables"
java.lang.NoClassDefFoundError : Exception in thread "main"
The classpath is wrong. Include all the jar files in lib/ before running one of the command line applications.
java.lang.NoSuchFieldError: actualValueType

This is almost always due to using the wrong version of the Xerces library. Jena and ARQ make use of XML schema support that changed at Xerces 2.6.0 and is not compatible with earlier versions. At the time of writing Jena ships with Xerces 2.6.1.

In some situations your runtime environment may be picking up an earlier version of Xerces from an "endorsed" directory. You will need to either disable use of that endorsed library or replace it by a more up to date version of Xerces. This appears to happen with some distributions of Tomcat 5.* and certain configurations of JDK 1.4.1.

Query Debugging

Look at the data in N3 or Turtle or N-triples. This can give you a better sense of the graph than RDF/XML.

Use the command line tools and a sample of your data to develop a query, especially a complex one.

Break your query up into smaller sections.

How do I do test substrings of literals?

SPARQL provides regular expression matching which can be used to test for substrings and other forms that SQL's LIKE operator provides.

Example: find resource with an RDFS label contains the substring "orange", matching without respecting case of the string.

PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?x
WHERE {
  ?x rdfs:label ?v .
  FILTER regex(?v, "orange", "i")
}

The regular expression matching in ARQ is provided by java.util.regex.

Accented characters and characters outside of basic latin ~ SPARQL queries are assumed to be Unicode strings. If typing from a text editor, ensure it is working in UTF-8 and not the operating system native character set. UTF-8 is not the default character set under MS Windows.

ARQ supports \\u escape sequences in queries for the input of 16bit
codepoints.

ARQ does not support 32 bit codepoints (it would require a move to
Java 1.5, including all support libraries and checking the codebase
for char/codepoint inconsistencies and drop support for Java 1.4).

The same is true for data. XML files can be written in any
XML-supported character set if the right `?xml` processing
instruction is used. The default is UTF-8 or UTF-16.
XSD DateTime

Examples of correctly formatted XSD DateTime literals are: these two are actually the same point in time and will test equal in a filter:

  "2005-04-04T04:04:04Z"^^xsd:dateTime
  "2004-12-31T18:01:00-05:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>
  • The timezone is required.
  • The datatype must be given.
String Operations

ARQ provides many of the XPath/XQuery functions and operators including string operations. These include: fn:contains, fn:starts-with, fn:ends-with. See the library page for details of all function provided.

Note 1: For string operations taken from XQuery/XPath, character positions are numbered from 1, unlike Java where they are numbered from 0.

Note 2: fn:substring operation takes the length of the substring as the 3rd argument, unlike Java where it is the end index.

ARQ documentation index