Extracting knowledge from Ontology using Jena for Semantic Web Ayesha Ameen I.T Department Deccan College of Engineering and Technology Hyderabad A.P, India ameenayesha@gmail.com Khaleel Ur Rahman Khan Professor & Dean (Academics) ACE Engineering College Hyderabad, A.P, India khaleelrkhan@aceec.ac.in B.Padmaja Rani Head of Department CS JNTU Hyderabad, A.P, India padmaja_jntuh@yahoo.co.in Abstract Semantic Web extends the current web by standardizing the semantics. Purpose of Semantic Web is to make people share data and content among different applications. This is made possible by using ontologies which represents shared understanding of a domain. Semantic Web uses ontologies for representing knowledge in a uniform way that can be easily processed and shared among machine. This paper gives detail description of the role of ontologies in Semantic Web and tools required for constructing Semantic Web applications. An application is created which loads the ontology created in Protégé into Eclipse and displays the properties and classes of ontology. KeyWords Ontology, Protégé, Eclipse, Jena I. INTRODUCTION The extent of information available on web is huge answers to all questions are there on web but due to human readability problem we cannot read all the web pages that are returned as a result of a query. WWW consists of unstructured contents that are used by humans. Data on WWW is machine readable but not machine understandable. URL links the content on WWW. Links are used to refer only to location of resources. No formal logical constructs are present in WWW. Semantic Web enriches Web data, which is usually represented in HTML or other XML formats, by meta-data specifying the meaning of such data[1,2]. The semantic structure allows the algorithm to operate on certain semantic levels or choose appropriate levels of abstraction which improves the task of mining. Semantic Web incorporates intelligent reasoning capabilities. Semantic Web consists of statements. Statement can also contain logic and form building block of Semantic Web. Statements are linked together with a meaningful path that s form a semantic relationship among statements. Relationships describe associations, aggregations, restriction and definitions. Statements defining concepts and relationships form the ontology in Semantic Web. Semantic Web extends the WWW by incorporating meaning for richer and more meaningful interactions among users and machines. In this paper we first give an introduction to Semantic Web next we explain the role of ontology in Semantic Web.Tools used in programming Semantic Web are explained followed by an example which consists of creating an ontology in protégé and using eclipse to load an ontology by using jena libraries. II. ROLE OF ONTOLOGY IN SEMANTIC WEB Ontology is defined as explicit and formal specifications of conceptualization of domain of interest. There are two important points in the definition, first the conceptualization is formal and hence permits reasoning by a computer second ontology are designed for some particular domain of interest [3].Ontologies play a crucial role in Semantic Web. Ontologies represent the information in a uniform way which can be shared and processed by machine hence they form the backbone of Semantic Web. Ontologies describe a set of concepts and relationships between them in a machine process able form. Ontologies are constructed for domain representing shared and common understanding of domain which can be used by machines and people to communicate and support for exchange of semantics. It s worth to gain more insight in ontology. In the context of Semantic Web ontologies are useful for the organization and navigation of websites. They can also be used for improving the accuracy of web searches by exploiting the generalization and specialization information. Ontology consists of concepts, relations(properties),instances and axioms represented as (C,R,I,A) where C represents a set of concepts,r represents a set of relations,i represents a set of instances and A represents a set of axioms[4]. A. Ontology Language The use of Ontology language is to allow users to write explicit formal conceptualization of domain model [5]. The main requirements of an ontology language are Well defined syntax Efficient reasoning support A formal semantics Sufficient expressive power Convenience of expression The ontology language must have well defined syntax so that it can be easily processed by machine.the use of formal semantics not only allow us to describe the meaning of knowledge precisely but also allows us to reason about the knowledge. We must be able to reason about the class memberships, equivalence of classes, consistency, and classification. Reasoning support is very important for an ontology language because it allows us to check the consistency of ontology, check for unintended relationships between classes and for automatic classification of instances into classes. The Semantic Web domain uses various languages for representing ontologies including XML, RDF and OWL. 978-1-4799-3759-2/14/$31.00 2014 IEEE 1
1) Resource development framework (RDF) RDF and RDFS can be used for the representation of some of the ontological knowledge ex. subclass, sub property, domain and range and instances of classes but there are many features of ontology language that are not supported by RDF and RDFS[5] ex. The scope of properties in RDF is global we cannot declare the range restriction that applies only to some classes We cannot represent characteristics of properties like transitive, unique or inverse in RDF and RDFS. We cannot combine the classes by using Boolean operators like union, intersection and complement. Cardinality constraint and disjointness among classes cannot be expressed in RDF. 2) Web Ontology Language (OWL) OWL is widely used among the three languages because of its high expressive power and the fact that it is w3c standard ontology language for Semantic Web. OWL is built on the RDF which is essentially a data modeling language.owl is an extension of RDF schema. OWL uses the RDF meaning of classes and properties and also adds many language primitives which are needed to provide richer expressiveness required. OWL language provides mechanisms for creating all components of an ontology, concepts, relations, instance, and axioms. III. SEMANTIC WEB COMPONENTS AND TOOLS To understand the working of Semantic Web we must first have an insight into the components that form the basis of Semantic Web and tools that are used for building Semantic Web environment [6]. The components of Semantic Web are 1. Statement Statements consist of a subject, predicate and object that form a triple. Statements form foundation of Semantic Web. Statements relate to one another to constitute Semantic Web. 2. URI URI provides unique name to each component of statements to avoid naming conflicts across internet. 3. Language Statements are expressed according to Semantic Web language. Languages consist of keywords that provide instruction to the Semantic Web tools. There are Semantic Web languages to choose from depending on the degree of complexity and expressiveness. 4. Ontology Ontology is the information domain model of Semantic Web which consists of concepts, relationships and restrictions. There is much ontology present in every domain an application can create its own ontology or re use existing ontologies. 5. Instance Data Instance data is built on the ontology. It contains the detail of instances created on ontology; it need not be bind to a particular ontology The tools used for Semantic Web are categorized into four categories depending on the task they perform. 1. Build Construction tools are used to build the Semantic Web. They construct and integrate Semantic Web by creating or importing statements of ontology and instances. 2. Explore Interrogation tools help to navigate through Semantic Web. They are can be used to perform simple graph navigation to search. 3. Inference Semantic Web allows information to add information to it by inferences. Reasoners add inference to Semantic Web applications. An inference creates logical additions which populate the class structures by classifying and realizing. 4. Expand Rule engines consists of set of rules which are used to support inference beyond the description logic.rule engines enable merging of ontologies and other logical task. All above mentioned tools are packed into Semantic Web development. IV. SETTING UP SEMANTIC WEB ENVIRONMENT Semantic Web application must be web centric it must take advantage of current web scale, diversity and distribution by establishing appropriate standards for expressing information. Semantic Web must place data at its center as shown in Fig. 1. Semantics must be placed inside data; it must not be left for user interpretation or placed inside programming instructions. Semantic Web applications must share and access the data sources located on internet. Semantic Web applications must be dynamic enough to incorporate changes in the content and structure of information to deal with current needs and goals of the organization. A. Tools Fig. 1.Semantic Web applications The environment described in this paper is based on simple and free tools for simplicity [6] as shown in Fig.3. Environment consists of the 1. Java 1.6 SDK 2. Eclipse IDE 3. Protégé 4.0 Alpha Ontology Editor 4. Jena 2.5.6 Semantic Web Framework 5. Pellet 1.5.2 Reasoner Java 1.6 SDK is used for compiling and executing java code. Eclipse IDE is used for editing the code.protégé is used for creating, editing and combining ontologies. For manipulating ontologies programmatically we use Jena Semantic Web programming framework. 978-1-4799-3759-2/14/$31.00 2014 IEEE 2
1) Jena Semantic Web Framework Jena is a Java framework for the creation of applications for the Semantic Web. Provides interfaces and classes for creation and manipulation of RDF repositories. Jena is a Java API which can be used to create and manipulate RDF graphs. Jena also provides classes/interfaces for the management of OWL based ontologies. In Jena, a graph is called a model and is represented by the model interface. Jena contains libraries which allow interacting with semantic data. Apart from build in reasoners in Jena we also use pellet reasoner. properties menu item.getstartedsemweb Class must be created this sets the environment for Semantic Web application. Next step was to create Student ontology in Protégé and specify the default base. Class hierarchy was created for student ontology as shown in Fig. 5.RDF/XML ontology format was selected. Object and data properties to student ontology were added as shown in Fig. 6 and Fig. 7.Created ontology was stored in a folder. The code for including ontology in a java application was written in Eclipse as shown in Fig. 8. B. Algorithm Fig. 2.Semantic Web Environment Algorithm used for creating a simple Semantic Web Application is shown in the below Fig. 3 which consists of the following steps. 1. Create a new java project in Eclipse. 2. Load the Jena and Pellet libraries in Eclipse. 3. Create Ontology in Protégé. 4. Add classes and properties to ontology. 5. Save the ontology in a folder. 6. Create a class in Eclipse. 7. Open the saved ontology in Eclipse. Two development tools are used Eclipse for Java and Protégé. Fig. 4.Creating a new project Fig. 5.Student ontology created in Protégé Fig. 3. Steps for constructing Semantic Web Applications After installing Eclipse IDE and Protégé. New java project is created as GetStartedSemWeb as shown in Fig. 4. Second step is to add Jena, Pellet libraries by selecting project 978-1-4799-3759-2/14/$31.00 2014 IEEE 3
Fig. 7.Object properties of student ontology Fig. 6.Data properties of student ontology Fig. 8 Code for creating Semantic Web application based on ontology Code consists of all imports necessary for supporting Semantic Web applications as shown in Fig. 9. GetStartedSemWeb class is created next default namespace and a model to hold semantic data are declared. In the main method getsemweb object is created and a call is made to method loadontology. In loadontology method an ontology model is created by calling ModelFactory.createOntologyModel(). Next step is to open the saved ontology file. listclasses() method which returns an iterator over the classes present in the ontology is used to print URI of classes as shown in below Fig. 9 To display the local names of object properties and data properties listobjectproperties() and listdatatypeproperties() methods are used as shown in Fig. 10 and Fig. 11. Fig. 10. Code for retrieving object properties Fig. 9. Code for retrieving classes Fig. 11. Code for retrieving datatype properties 978-1-4799-3759-2/14/$31.00 2014 IEEE 4
After running the code we get an output as shown in Fig 12. First line in the output specifies that student ontology is added. Next URI of classes are displayed starting with the root of student ontology that is student class followed by the children of student class i.e. Personal, General and Academic. Object properties and datatype properties of student ontology are displayed. At last the root of the student ontology i.e Student class is displayed for the sake of clarity by using listhierarchyrootclasses() method. V. CONCLUSION & FUTURE WORK This paper starts with an introduction of Semantic Web and specifies the significance of ontologies in designing Semantic Web applications in the subsequent section. Tools used for designing Semantic Web applications were discussed along with the framework in detail. Procedure for creating simple Semantic Web application based on ontology using Jena is demonstrated. Ontology was created in protégé and loaded in eclipse, using Jena. Knowledge represented in the form of classes and properties was extracted using Jena methods. In future ontologies can be combined to develop many Semantic Web applications using the functionalities offered by Jena Semantic Web framework. REFERENCES [1] Berendt B.,. Hotho A, Mladenic D., Van Someren M., Spiliopoulou M. And Stumme G., Web Mining: From Web To Semantic Web. First European Web Mining Forum, Of Lnai. Springer, Berlin, Vol. 3209 23 42 2004. [2] Stumme, Gerd, Andreas Hotho, and Bettina Berendt. "Semantic web mining: State of the art and future directions." Web Fig. 12. Output after running the code semantics: Science, services and agents on the world wide web 4.2 (2006):pp 124-143. [3] Bhaskar Kapoor and Savite Sharma, A comparative study ontology building tools for Semantic Web application International Journal of web and Semantic Technology(IJWest)Vol1num 3 july 2010.DOI:10.5121/ijwest.2010.1301. [4] Staab, Steffen, and Rudi Studer. Handbook on ontologies. Springer, 2010. [5] Antoniou, Grigoris, and Frank Van Harmelen. A semantic web primer. MIT press, 2004. [6] Hebeler, John, Matthew Fisher, Ryan Blace, and Andrew Perez-Lopez.Semantic web programming. John Wiley & Sons, 2011. 978-1-4799-3759-2/14/$31.00 2014 IEEE 5