=Paper= {{Paper |id=Vol-1080/owled2013_9 |storemode=property |title=Brain, a Library for the OWL2 EL profile |pdfUrl=https://ceur-ws.org/Vol-1080/owled2013_9.pdf |volume=Vol-1080 |dblpUrl=https://dblp.org/rec/conf/owled/CrosetOR13 }} ==Brain, a Library for the OWL2 EL profile== https://ceur-ws.org/Vol-1080/owled2013_9.pdf
       Brain, a library for the OWL2 EL profile

      Samuel Croset1 , John Overington1 , and Dietrich Rebholz-Schuhmann1

EMBL-EBI, Wellcome Trust Genome Campus, Hinxton, Cambridge CB10 1SD UK
                           croset@ebi.ac.uk



        Abstract. Brain is a Java library facilitating the interaction with OWL2
        EL ontologies. The library aims at bridging the gap between graphical
        user interfaces such as Protege and the OWL-API: It provides a se-
        ries of convenience methods to create and query knowledge bases using
        the Manchester syntax. The library is useful to develop web applica-
        tions and particularly suited for the biomedical domain. Brain relies
        on ELK for reasoning tasks. The open source project is available at
        https://github.com/loopasam/Brain.

        Keywords: OWL2 EL, library, Java, Manchester syntax


1     Introduction
1.1    OWL2 EL
The second version of the Web Ontology Language (OWL2) introduces a series of
profiles: OWL2 EL, RL and QL [4]. These profiles are subsets of the full OWL2
specification and have been designed to match the requirements of particular
case scenarios. Profiles are defined by the type of axioms and constructs they
support: For instance the EL profile, which has been inspired from biomedical
ontologies, does not allow disjunctions or cardinality restrictions among other
things. This limited expressivity however enables the implementation of fast
reasoning algorithms which can handle large amount of data as it is required by
the application domain. In this document we will present the core features of a
Java library, Brain, dedicated to support the OWL2 EL families and oriented
toward biomedical knowledge manipulation. Another description of the library is
being published at the time of writting in a biomedical journal. This manuscript
aims at publicising the work to the OWLED workshop 2013 audience.

1.2    Motivation
The biomedical domain is particularly interesting for the OWL community be-
cause of the richness and variety of the ontologies it contains. The majority of
resources such as the Gene Ontology [8] or SNOMED CT [11] are very large but
they are fortunately in line with the EL profile. Driven by the recent improve-
ments in the reasoning speed over big biomedical knowledge bases with reasoners
such as ELK, it becomes nowadays possible to build web applications or to per-
form biological analysis relying heavily on OWL queries performed against an
2

ontology of interest. The options available to undertake such tasks span from
graphical user interfaces (GUI) such as Protege [13] to application programming
interfaces as the OWL-API [9]. GUIs are wonderful to develop toy examples,
but they are not suited to handle very large ontologies as the ones faced in life
sciences, potentially containing millions of axioms. The OWL-API is solid solu-
tion to build applications but it could be daunting for new comers or users with
little experience in Java or OWL. OWLTools [5] is an intermediary option for the
biomedical domain as Tawny-OWL [12]. Both of these libraries provide an alter-
native programmatic environment to develop OWL ontologies using either Java
or Closure. These projects however do not address web application development
issues: Indeed in such a setting, when a reasoner is used to query an ontology
based on requests from users, a special care as to be put on the management of
concurrency. In order to ease the interaction with OWL2 EL ontologies we have
developed Brain, a facade on the top of the OWL-API. The library facilitates
the manipulation of EL ontologies, specially in a web server cocurrent environ-
ment. Brain is already successfully used in production as a back-end engine for
web applications such as the Virtual Fly Brain [7] or the Functional Therapeutic
Chemical Classification System [3].


2     Features
The rest of the document will present the core features of the library as well as
an example of axiom implementation. The main idea behind Brain is to prevent
ambiguous situations to happen while manipulating an ontology and to simplify
the interaction with biomedical knowledge bases. Brain is implemented following
a pattern facade: It wraps the interaction with the OWL-API and the ELK
reasoner [14] by providing some convenience methods. The wrapped softwares
yet remain accessible for any operation un-implemented by the facade classes.

2.1   Availability
The source code of the library is open and freely available [6] under an Apache
License 2. Brain binaries are also distributed on Maven central repository or
directly downloadable as a jar file including all the dependencies. The documen-
tation providing concrete examples can be accessed and edited [1].

2.2   Manchester syntax interaction
The interaction with Brain resolves only to the Manchester syntax [10] expressed
as Java strings. This notation is user friendly and already widely used inside
Protege. It allows to focus on the OWL axioms rather than on the programming
implementation. The advantage of working directly with strings as input rather
than with more complicated Java objects appears in a web application context:
HTTP messaging can indeed be easily parsed and interpreted in order to quickly
build an OWL end-point for instance. A list of OWL queries for instance is also
                                                                                 3

easier to maintain, read and understand when represented with the Manchester
syntax.


2.3   Unique ontology

One of the core design decision behind the library was to enforce the users to
work with only one ontology. This simplification helps to focus on one knowledge
base at the time and remove any ambiguity that could be present while dealing
with scattered entities. It is yet possible to import and load external ontologies
and entities, but Brain merge any new axioms into one single knowledge base.


2.4   Unique short form names

Brain also enforces OWL entities to have a unique short form name. This choice
was made in order to prevent ambiguity while using the Manchester syntax to
formulate OWL expressions. For instance the short forms of the OWL entities
http://example.org/Cat and http://semanticweb.org/Cat will be the same: Cat.
The string “Cat” is ambiguous in this case and could present problems later
on when this short form is used for a query. This issue is prevented by Brain
and an exception is thrown when a potentially dangerous situation such as this
one occurs. This choice is not exactly in line with some of the Semantic Web
philosophy, but it seems likely to work in the biomedical domain, where entity
identifiers are most of the time preceded by a unique prefix anyway. For example
the short form names of the Open Biomedical Ontology (OBO) classes all start
with a prefix uniquely identifying the biomedical resource. All Gene Ontology
concepts start with the prefix ”GO ”. Note that this design is not against the
unique name assumption: It is still possible for different names to refer to the
same entities.


2.5   Error handling driven

Brain enforces some constraints in order to keep the OWL ontology as robust
and straightforward as possible. A lot of different types of errors can be thrown
in order to alert the user that a problem exists in the underlying ontology. A
special care had also to be put when interacting with expressions entered as
strings. Problems encountered when creating or querying the ontology are made
explicit to the developer in order to preserve the consistency of the knowledge
base. Errors handling is also helpful to route requests and redirect users in a web
application scenario.


2.6   Queries

A common use-case for OWL ontologies is to run queries in order to retrieve
some implicit information. An OWL query is a standard OWL class expression
in the context of Brain. The ELK reasoner is handling the classification and query
4

tasks. The classification of the ontology is triggered only when absolutely needed
and transparent to the user (lazy initialization). Queries are also formulated
using the Manchester syntax and it is possible to use the label (rdfs:label) of
OWL entities to enter the query expression, as featured in Protege. Queries are
thread-safe: For instance the simultaneous queries of two users will be correctly
handled by Brain. This characteristic is important in a concurrent web server
setting.


2.7   Limitations

The methods present in the library are only fulfilling requirements from users.
However some important features are still missing: Individuals are not currently
supported for example. Despite not being oriented towards OWL individuals,
OWL2 EL ontologies are yet sometimes using them. This drawback will be ad-
dressed in a coming release.


3     Example of implementation

The easiest way to understand the interaction with Brain is probably by look-
ing at a concrete example. This section will present the implementation of a
biomedical axiom using the library. The features discussed before are illustrated
in Figure 1. The interested reader can find more examples on the wiki page [2].


4     Conclusion

Brain is a Java library leveraging the interaction with the OWL-API and the
ELK reasoner. The library is dedicated to OWL2 EL ontologies and provide an
interface to manipulate and query biomedical knowledge bases. The library has
been designed to build web applications and to perform new type of biomedi-
cal analysis relying heavily on an OWL reasoner. Some features will be added
in future releases, such as individual support. New functionalities are also cur-
rently implemented, such as the generation of scalable vector graphics (SVG)
representing the OWL class taxonomies from the underlying ontology. Brain is
already stably used in some real life biomedical applications and new use-cases
from the community will guide the further development of this library.


References
 1. Documentation Brain. https://github.com/loopasam/Brain/wiki, [Online; ac-
    cessed 07-March-2013]
 2. Examples Brain. https://github.com/loopasam/Brain/wiki/Examples, [Online;
    accessed 07-March-2013]
 3. Functional       Therapeutic       Chemical         Classification System.
    https://www.ebi.ac.uk/chembl/ftc, [Online; accessed 07-March-2013]
                                                                                        5

 4. OWL       2    Web      Ontology     Language      Profiles    (Second     Edition).
    http://www.w3.org/TR/owl2-profiles/, [Online; accessed 25-April-2013]
 5. OWLTools. http://code.google.com/p/owltools, [Online; accessed 07-March-2013]
 6. Source Code Brain. https://github.com/loopasam/Brain/, [Online; accessed 07-
    March-2013]
 7. Virtual Fly Brain. http://www.virtualflybrain.org/, [Online; accessed 07-March-
    2013]
 8. Ashburner, M., Ball, C.A., Blake, J.A., Botstein, D., Butler, H., Cherry, J.M.,
    Davis, A.P., Dolinski, K., Dwight, S.S., Eppig, J.T., Harris, M.A., Hill, D.P., Issel-
    Tarver, L., Kasarskis, A., Lewis, S., Matese, J.C., Richardson, J.E., Ringwald,
    M., Rubin, G.M., Sherlock, G.: Gene Ontology: tool for the unification of biology.
    Nature Genetics 25(1), 25–29 (2000), http://dx.doi.org/10.1038/75556
 9. Horridge, Bechhofer: The OWL API: A Java API for OWL Ontologies. Semantic
    Web Journal pp. 11–21 (2011)
10. Horridge, M., Drummond, N., Goodwin, J., Rector, A., Stevens, R., Wang,
    H.H.: The Manchester OWL Syntax. Syntax 216, 10–11 (2006), http://dblp.uni-
    trier.de/rec/bibtex/conf/owled/HorridgeDGRSW06
11. IHTSDO: SNOMED CT. http://www.ihtsdo.org/snomed-ct/, [Online; accessed
    07-March-2013]
12. Lord, P.: The Semantic Web takes Wing: Programming Ontologies with Tawny-
    OWL
13. NCBO: Protege. http://protege.stanford.edu/, [Online; accessed 07-March-2013]
14. Yevgeny Kazakov, Markus Krötzsch, František Simančı́k: Concurrent Classification
    of EL Ontologies. Proceedings of the 10th International Semantic Web Conference
    (ISWC’11) 7032 (2011)
6




//Creation of a fresh Brain instance.
//All the operations will be done on this object.
Brain brain = new Brain();
//Add some OWL classes to the ontology.
//Short forms or full URIs can be used, but
//the short forms have to be unique.
brain.addClass("Nucleus");
brain.addClass("http://example.org/Cell");
//Add an OWL object property to the ontology
brain.addObjectProperty("part-of");
//Declare a complex axiom (partial existential restriction).
//Note that OWL expressions using the
//Manchester syntax can be used directly for the axiom
//assertion. If the entities used in the expression were
//missing, an error will be thrown (not shown here).
brain.subClassOf("Nucleus", "part-of some Cell");
//Integrate the content of an external knowledge base
//with the current ontology.
brain.learn("http://example.org/bar.owl");
//Query the knowledge base for indirect subclasses
//with the help of the ELK reasoner.
//Note that the classification initialization is
//transparent to the user.
List subClasses =
                brain.getSubClasses("part-of some Cell", false);
//Free the resources used by the reasoner.
brain.sleep();
//Save the ontology as a file
//using the Manchester syntax.
brain.save("your/path/to/ontology.owl");


Fig. 1. Implementation example in Java of an axiom and some standard operations
using Brain; the axiom expressed in natural language: A nucleus is part of some cells.
Same axiom described in OWL using the Manchester syntax: Nucleus subClassOf part-
of some Cell.