Wednesday, 3 June 2015

LAB 4 : ONTOLOGY

ONTOLOGY....


Start protege and start a new Ontology. Enter an Ontology IRI. Use the following IRI: http://people.brunel.ac.uk/~csstnns/university.owl


Save it as university.owl



Go to the Classes tab. The empty class tree contains one class called Thing, which is superclassof everything. Create class Person as subclass of Thing. Create Lecturer and Student as the subclasses of Person.





























Tuesday, 5 May 2015

Lab Tutorial 3


Laboratory 3

1.  Resource  http: //www.haneena.com/~haneena/homepage is a homepage and it is 
     owned by Haneena. 
   
    Code

    <?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/homepage">
   <dc:title>haneena</dc:title>
   </rdf:Description>
   </rdf:RDF>

   Result



2.  





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.   




     Code

     <?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:room>BT1</dc:room>
    </rdf:Description>
    </rdf:RDF>

    Result


                                 
 3.  By using container elemn rdf:Bag,  give an RDF description that states the       
      following: Faizah and Din own the car ABZ-88

      Code

     <?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:Bag="http://www.haneena.com/haneena-ns/#T-999”>">
     <dc:owner>Faizah, Din</dc:owner>
     <dc:owner>Din</dc:owner>
    <dc:car>ABZ-88</dc:car>
    </rdf:Description>
    </rdf:RDF>

     Result



 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.

      Code

     <?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/"
         xmlns:ex="http://example.org/stuff/1.0/">
     <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar" dc:title="RDF/XML              Syntax Specification (Revised)">
    <ex:editor rdf:parseType="Resource">
      <ex:owner>Faizah, Din</ex:owner>
     <ex:owner>Din</ex:owner>
     <ex:car>ABZ-88</ex:car>
     <ex:homePage rdf:resource="http://purl.org/net/dajobe/"/>
    </ex:editor>
    </rdf:Description>
    </rdf:RDF>

    Result


Monday, 6 April 2015

SEMANTIC WEB (LAB 1)


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:

<company>
<departmentname></departmentname>
<telephone>
   <firstname></firstname>
   <lastname></lastname>
   <telephonenumber></telephonenumber>
   <email></email>
   <faxnumber></faxnumber>
</telephone>
</company>

Question 2
a.  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:

<firstname>Adi</firstname>
<lastname>Maulud</lastname> 
<professions>doctor, therapist and surgeon</professions>  

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

Answer:


c.  Modify the document given in exercise 1 such that the “first” and “last” are the attributes of the name element

Answer:

<company>
<departmentname></departmentname>
<telephone>
   <name:first_name="su" lastname="wan"></name>
   <telephonenumber></telephonenumber>
   <email></email>
   <faxnumber></faxnumber>
</telephone>
</company>

Question 3.
a.  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:

<socialsecuritynumber>123456789A</socialsecuritynumber>
<firstname>Adha</firstname> 
<lastname>Hadif</lastname>
<address>
<postcode>86400</postcode>
<city>Batu Pahat</city>
<street>Jalan Puding</street>
</address> 
<telephone>12345, 67890</telephone>


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

Answer:



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

Answer:

<?xml version="1.0"?>
<!DOCTYPE socialinformation [
<!ELEMENT socialinformation (socialsecuritynumber,firstname,lastname,address, telephone)>
<!ELEMENT socialsecuritynumber (#PCDATA)>
<!ELEMENT firstname (#PCDATA)>
<!ELEMENT lastname (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT telephone (#PCDATA)>
]>
<socialinformation>
<socialsecuritynumber>123456789A</socialsecuritynumber>
<firstname>Adha</firstname> 
<lastname>Hadif</lastname>
<address>
<postcode>86400</postcode>
<city>Batu Pahat</city>
<street>Jalan Puding</street>
</address> 
<telephone>12345, 67890</telephone>
</socialinformation>


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

Answer:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="socialinformation">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="socialsecuritynumber" type="xs:string"/>
      <xs:element name="firstname" type="xs:string"/>
      <xs:element name="lastname" type="xs:string"/>
      <xs:element name="address" type="xs:string"/>
      <xs:element name="telephone" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
</xs:schema>