Wednesday, 3 June 2015

Protege Publish and SPARQL

Part V : Protege Tutorial (cont)

F. Publish and SPARQL.

As we do not have the specified host for our Ontology so, we decided just to watch the video for the publishing and run a simple SPARQL. So here are the following videos from Dr. Noureddin Sadawi






G. What we learn from Protege.

We learn ways to add the classes, subclasses, properties, individual and many more and create the connection between the classes, subclasses, properties, individual and so on. Then using the hosted site you can see the XML viewed after publishing the Ontology in the web. Also how to download the Jena Fuseki Server and run a simple SPARQL. 




Part IV : Protege Tutorial (cont)

E. Adding Individuals.
1.  Create new individual for the classes.


Figure 1 Add new individual

2 . Key in as many individual that fit your ontology then key in the possible description for each individuals



Figure 2 Add description according to the individuals

3. Key in the object property assertions and data property assertions that fits that individuals 


Figure 3: Add data property assertions


Figure 4: Add object property assertions

Monday, 1 June 2015

Part III : Protege Tutorial (cont)

C. Adding Object Properties.

 1. Save the previous file. We named our file as Ontology IRI.

Figure 1 : Saving file

2. Open the object properties.

Figure 2. Object Properties pop up

3. Create a sub-properties, named as teaches and studies as in Figure 3.

Figure 3 : teaches and studies sub-properties created

4. Then, set the domain for the studies is the student and the range is the module.
 
5. Meanwhile, the domain teaches is teacher and the range is module.


D. Adding Data Properties
 
1. Data properties is used to add details to the classes. Add data properties such as first name or anything.
 
Figure 4 : add data properties

2. Add data properties student_id, domain set is lecturer and the range is an integer.
 
3. Next,  data properties staff_id, domain set is student and the range is an integer.

4. After that, last_name and first_name domain is a person class and the range is string.

Figure 5 : completed setting

5. Then, test it by starting the reasoner to see whether there is any error.

Figure 6 : Reasoner started


6. If the reasoner did not show any error, yo can stop the reasoner.

Figure 7 : Reasoner stopped


 
 
 





Part II : Using Protege


 Open the protege software to start using it. Figure 1 shows the interface of protege.


Figure 1 : Protege interface
 
 
 
Part III : Protege tutorial
 
This protege tutorial are based on a series of video by Dr. Noureddin Sadawi.
 
A. Introduction to Ontology 

1. Figure 2 shows an ontology of Person where its subclasses are Student and Lecturer.
   
   Student  studies  Module
   Lecturer  teaches  Module

Figure 2 : Person subclasses

Figure 3 : Module subclasses

2. Figure 3 shows other example of ontology where both CSModule and MathModule are subclasses of Module.

B. Creating Ontology Class
 
 1. Click on classes tab to create class.

Figure 4 : Classes tab selected

2. Add a new class. We add a new class named Person.

Figure 5 : Person class added

3. Next, add another two classes named Student and Lecturer under Person class.

Figure 6 : Student class added

Figure 7 : Lecturer class added

4. Repeat the process of adding class with a new Module class. Then, add two new class under Module named CSModule and MathModule.

Figure 8 :  Created Person and Module class with their subclasses

5. Click on any of the module and click Disjoint with at the description

Figure 9 : Disjoint with option

6. Click ctrl and click on MathModule, Lecturer, and Student to be Disjoint with.

Figure 10 :Disjoint of MathModule, Lecturer and Student

Reason for the Disjoint:
-To avoid overlapping between classes, ie subclass, or an instances or an individual can only be an instances of one class so we can avoid multiple inheritances.








Protege Installation

Part I : Installing Protege

1. Download Protege software in this link
http://protege.stanford.edu/download/protege/4.3/installanywhere/Web_Installers/

You will be directed to a page as shown in figure 1 below.


Figure 1 : Download page


2. Next, open folder containing the installer. Double click on the installer and click Run on the popup windows.

Figure 2 : Protege installer 


3. An installation wizard will appear with a complete step by step installation process.

   (a) Click Next in the Introduction.

 Figure 3 : Introduction step

   (b) Choose the installation folder. Its best to choose the default folder which is "C:\\Program\Program Files\Protege_4.3". Click Next.

Figure 4 : Choose installation folder

   (c) Choose where to place shortcut folder. We choose to place it on the desktop and click Next.

Figure 5 : Choose shortcut folder location

   (d) Next, choose Java Virtual Machine that is suitable and click Next.

Figure 6: Choose Java Virtual Machine

   (e) A pre-installation summary will be shown, click Install so it can start installing.

Figure 7 : Pre-installation summary

   (f) Installing protege.

Figure 8 :  Installation start

   (g) Installation complete.

Figure 9 : Installation completed

4. Now, you can start using protege to make and edit an ontology.

Friday, 15 May 2015

Laboratory 3 : RDF

LAB EXERCISE :
    Give an RDF Description that states the following:
  1. Resource http://www.haneena.com/~haneena/homepage is a homepage and it is owned by Haneena                                                                                                                             Answer:
                 <?xml version="1.0"?>
                 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:dc="http://purl.org/dc/elements/1.1/">
                 <rdf:Description rdf:about="http://www.haneena.com/~haneena/hompage">
                 <dc:owner>haneena</dc:owner>
                 <dc:page>Homepage</dc:page>
                </rdf:Description>
                 </rdf:RDF>


  2. Resource <"http://www.haneena.com/haneena-ns/#T-999"> is a course named C-programming and is lectured by Adib Razi at Room BT1                                                                                     Answer:                                                                                                                                   <?xml version="1.0"?>
                    <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"      
                    xmlns:dc="http://purl.org/dc/elements/1.1/">
                   <rdf:Description rdf:about="http://www.haneena.com/haneena-ns/#T-999">
                         <dc:course>C-programming</dc:course>
                         <dc:lecturer>Adib Razi</dc:lecturer>
                         <dc:classroom>BT1</dc:classroom>
                   </rdf:Description>
     </rdf:RDF>                                                                                                                                          
                    
  3. By using container element rdf:Bag, give an RDF description that states the following: Faizah and Din own the car ABZ-88
  4. Answer:
           <rdf:RDF
           xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
           xmlns:car="http://www.recshop.fake/cd#">
              <car:Owner>
                  <car:plate>ABZ-88</car:plate>
                   <car:name>  
                      <rdf:Bag>
                          <rdf:_1 rdf:resource="Faizah"/>
                          <rdf:_2 rdf:resource="Din"/>
                       </rdf:Bag>
                  </car:name>
               </car:Owner>
         </rdf:RDF>

      4. By using the "collection" value of the rdf:parseType attribute give an RDF description that
          states the following: Faizah and Din own the car ABZ-88.
         Answer:
          <?xml version="1.0"?>
          <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
            xmlns:ex="http://example.org/stuff/1.0/">
          <rdf:Description rdf:about="ABZ-88">
          <ex:ownedBy rdf:parseType="Collection">
          <rdf:Description rdf:about="Faizah"/>
         <rdf:Description rdf:about="Din"/>
        </ex:ownedBy>
         </rdf:Description>
         </rdf:RDF>


Monday, 6 April 2015

LAB 2 : XML
Question 1  

Haneena and Co. has a telephone directory that records the first and last name, telephone number and email address of everyone working in the company. Departments are the main organizing unit of the company so the telephone directory is typically displayed in department order and shows for each department the contact phone and fax number and email address.
Create an XML file containing some directory data.

Answer Question 1




Figure 1.0 – XML File for Haneena and Co.

--------------------------------------------------------------------------------------------------------------------------------------------------

Question 2


Give an XML-document (by not using attributes), which includes the information that the first name of a person is Adi, his last name is Maulud, and his professions are doctor, therapist and surgeon.

Answer Question 2a


Figure 2.0 – XML Document

--------------------------------------------------------------------------------------------------------------------------------------------------

      Give the tree diagram of  the document given in 2a.

Answer Question 2b



Figure 2.1 – XML Document and Tree Diagram

--------------------------------------------------------------------------------------------------------------------------------------------------

     Modify the document given in 2a such that the “first” and “last” are the attributes of the name element

Answer Question 2c



Figure 2.2 – Modified XML Document (Attributes)

--------------------------------------------------------------------------------------------------------------------------------------------------

Question 3


     Give an XML-document (by not using attributes), which includes the following information: the social security number (123456789A), the first name of a person is Adha, and his last name is Hadif, his address is composed of postcode (86400), city (Batu Pahat) and street (Jalan Puding), and his telephone numbers are 12345 and 67890.

Answer Question 3a



Figure 3.0 – XML Document (No Attributes)

--------------------------------------------------------------------------------------------------------------------------------------------------

      Give the tree diagram of the document given in exercise 3a.

Answer Question 3b



Figure 3.1– XML Document and Tree Diagram

--------------------------------------------------------------------------------------------------------------------------------------------------

 Give a DTD (Document Type Definition) for the XML-document specified in 3a.

Answer Question 3c





Figure 3.2 – DTD (Document Type Definition) for the XML-document

--------------------------------------------------------------------------------------------------------------------------------------------------

Give an XML Schema for the information specified in exercise 3a.

Answer Question 3d





Figure 3.3 – XML Schema

--------------------------------------------------------------------------------------------------------------------------------------------------

END LAB 2