You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Dario Bonino <da...@gmail.com> on 2013/04/08 12:24:06 UTC

Using Jena on Android

Dear all,

Few months ago me and my research team were involved in a project using 
ontologies on Android-based mobile devices. We firstly tried the 
Androjena project (http://code.google.com/p/androjena/) but it's 
development is almost ceased and it supports only a subset of the Jena 
features. Therefore we tried to use the full Apache Jena project on 
Android. While the project is not directly working, we analyzed the 
issues and we came out with a fully working copy of Jena on Android.

We think that the process for getting Jena working on Android might be 
of interest for the development community of Jena. More specifically we 
would like to inform you about the issues preventing direct adoption of 
Jena in Android and the solution we applied, hoping that they might be 
integrated in the full Jena release in a near future.

You can find a Jena version working on Android (4.x) at:

http://elite.polito.it/jena-on-android

while in the following we describe the issue preventing direct adoption 
of Jena in Android.

The Jena framework defines some packages (mostly inherited from 
dependencies, Xerces, in particular) by using the namespace javax.* . 
Such a namespace is currently interpreted by the Dalvik cross-compiler 
as belonging to the "core" java library, thus not being "safe" to 
cross-compile. The result is that the code containing such packages is 
not cross-compiled unless the compiler is set in "core-library" mode 
which results in a compiled code that will probably cease working after 
system updates and that, as the cross-compiler warns, " will ultimately 
lead to pain, suffering, grief, and lamentation."

Actually the packages are not part of the java core library therefore a 
simple re-factoring solves the problem. In the specific case, we 
downloaded the last sources of xerces, refactored alljavax.*  packages 
tojavax2.* and re-packed the library, and everything worked perfectly. 
This, by the way, enables the full Jena framework on Android, with the 
ability for developers to just include the needed modules as it is 
currently done in typical Java applications.

Hoping to be of help in adding Android support in Jena

Best regards

Dario Bonino

-- 
Ing. Dario Bonino, Ph.D
Post-doc researcher @ PoliTo

e-m@il: dario.bonino@gmail.com / dario.bonino@polito.it
www: http://elite.polito.it/people/bonino
<foaf:Person>
	<foaf:firstName>Dario</foaf:firstName>
	<foaf:surname>Bonino</foaf:surname>
	<foaf:msnChatID>slide473@hotmail.com</foaf:msnChatID>
</foaf:Person>



Re: Using Jena on Android

Posted by Andy Seaborne <an...@apache.org>.
Dario,

Great to see this.

I'm not very familiar with Java on Android so forgive some naive questions.

Which java version is it closest to in language and runtime library 
support?  The web suggests Java6 - what is happening about Java 7 
features?  Java 8?

== javax

All the jena-core references I could find with a quick bit of searching 
to javax seem to be to javax.xml and all that is for RDF/XML processing 
in ARP, Jena's RDF/XML parser.

What is the interface to XML parsing on Android-Java if it's not
javax.xml?

== javax in ARQ

ARQ also uses javax.xml for dealing with XSD datatypes).  It also has 
some uses of javax.management has a small amount of underused JMX 
support.   It would make sense to factor that out in some way.

== xerces

There are two different uses of Xerces directly in Jena: XML parsing, 
and datatype support.  The latter hooks directly into Xerces internals 
(impl packages).

(And also some of Sun's runtime uses it's own copy of Xerces in 
com.sun.org.apache.xerces)

For the datatype support, I'm fairly sure the datatype support could 
swap to using Java's built support but it's not a trivial change (easy 
route - clone the classes from Xerces, with the added advantage that we 
are then not exposed to Xerces internal changes which has happened in 
the past but looks to be highly unlikely to happen again - they may be 
"impl" packages but a lot of projects use them!)

I don't know what there is anything in the remains of project Harmony.

	Andy

It's "Apache Jena", not "Jena", at least for the first mention on the 
web page.  href="http://jena.apache.org/"

Full details:
http://www.apache.org/foundation/marks/pmcs#naming


On 08/04/13 11:24, Dario Bonino wrote:
> Dear all,
>
> Few months ago me and my research team were involved in a project using
> ontologies on Android-based mobile devices. We firstly tried the
> Androjena project (http://code.google.com/p/androjena/) but it's
> development is almost ceased and it supports only a subset of the Jena
> features. Therefore we tried to use the full Apache Jena project on
> Android. While the project is not directly working, we analyzed the
> issues and we came out with a fully working copy of Jena on Android.
>
> We think that the process for getting Jena working on Android might be
> of interest for the development community of Jena. More specifically we
> would like to inform you about the issues preventing direct adoption of
> Jena in Android and the solution we applied, hoping that they might be
> integrated in the full Jena release in a near future.
>
> You can find a Jena version working on Android (4.x) at:
>
> http://elite.polito.it/jena-on-android
>
> while in the following we describe the issue preventing direct adoption
> of Jena in Android.
>
> The Jena framework defines some packages (mostly inherited from
> dependencies, Xerces, in particular) by using the namespace javax.* .
> Such a namespace is currently interpreted by the Dalvik cross-compiler
> as belonging to the "core" java library, thus not being "safe" to
> cross-compile. The result is that the code containing such packages is
> not cross-compiled unless the compiler is set in "core-library" mode
> which results in a compiled code that will probably cease working after
> system updates and that, as the cross-compiler warns, " will ultimately
> lead to pain, suffering, grief, and lamentation."
>
> Actually the packages are not part of the java core library therefore a
> simple re-factoring solves the problem. In the specific case, we
> downloaded the last sources of xerces, refactored alljavax.*  packages
> tojavax2.* and re-packed the library, and everything worked perfectly.
> This, by the way, enables the full Jena framework on Android, with the
> ability for developers to just include the needed modules as it is
> currently done in typical Java applications.
>
> Hoping to be of help in adding Android support in Jena
>
> Best regards
>
> Dario Bonino
>