Saturday, March 26, 2016

Lab 3

Assalamualaikum Dr.Hanayanti :)

Lab Exercise 

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

Answer :

<?xml version="1.0" encoding="UTF-8"?>
<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:owner>haneena</dc:owner>
</rdf:Description>
</rdf:RDF>

Validation Answer :




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" encoding="UTF-8"?>
<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>

Validation Answer :




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

Answer :

<?xml version="1.0" encoding="UTF-8"?>
<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:owner>
<rdf:Bag>
<rdf:li>Faizah</rdf:li>
<rdf:li>Din</rdf:li>
</rdf:Bag>
</dc:owner>
<dc:car>ABZ-88</dc:car>
</rdf:Description>
</rdf:RDF>

Validation Answer :




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: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>


Validation Answer :






















Wednesday, March 9, 2016

Semantic Web - Lab 1

Assalamualaikum Dr. Hanayanti

Kami : NOOR IZZATI BT MOHAMAD ADNAN
       HAFIZAH SYAFIQAH BT HARUM
       MUHAMAD RAIMI B MOHD RAFLI

Kami menggunakan http://www.freeformatter.com/ untuk mengesahkan jawapan kami sama ada betul atau salah. Kami telah menyediakan screenshot semakan jawapan daripada website tersebut.  


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.

Answer :

<?xml version="1.0" encoding="UTF-8"?>
<company>
<companyname>Haneena and Co.</companyname>
<department category="Designer">
<employee>
<firstname>Raimi</firstname>
<lastname>Rafli</lastname>
<phone>017-9340650</phone>
<email>raimirafli4@gmail.com</email>
</employee>
<employee>
<firstname>Hafizah</firstname>
<lastname>Harum</lastname>
<phone>017-9341234</phone>
<email>hafizahharum@gmail.com</email>
</employee>
<contactNo>07-3123664</contactNo>
<email>designerdepartment@gmail.com</email>
<faxNo>07-9831234</faxNo>
</department>
<department category="Programmer">
<employee>
<firstname>Izzati</firstname>
<lastname>Adnan</lastname>
<phone>017-7836002</phone>
<email>izzatiadnan@gmail.com</email>
</employee>
<contactNo>07-3123664</contactNo>
<email>programmerdepartment@gmail.com</email>
<faxNo>07-8363076</faxNo>
</department>

</company>


Validation Answer :





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 :

       <person>
          <firstname> Adi </firstname>
          <lastname> Maulud </lastname>
          <profession>doctor</profession>
          <profession>theraphist </profession>
          <profession> surgeon </profession>
       </person>

Validation Answer :





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 :

       <person>
                 <firstname category="Adi"></firstname>
                 <lastname category="Maulud"></lastname>
                 <profession>doctor</profession>
                 <profession>theraphist </profession>
                 <profession> surgeon </profession>
             </person>

Validation Answer :




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 :

        <securityInformation>
            <securitynum>123456789A</securitynum>
            <fname>Adha</fname>
            <lname>Hadif</lname>
            <address>
                <poscode>86400</poscode>
                <city>Batu Pahat</city>
                <street>Jalan Puding</street>
            </address>
            <phonenum>
                <firstnum>12345</firstnum>
                <secondnum>67890</secondnum>
            </phonenum>
        </securityInformation>

Validation Answer :



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 securityInformation 
[
<!ELEMENT securityInformation (securitynum,fname,lname,address,phonenum)> 
<!ELEMENT securitynum (#PCDATA)>
<!ELEMENT fname (#PCDATA)>
<!ELEMENT lname (#PCDATA)>
<!ELEMENT address (#PCDATA)>
<!ELEMENT phonenum (#PCDATA)>
]>

<securityInformation>
    <securitynum>123456789A</securitynum>
    <fname>Adha</fname>
    <lname>Hadif</lname>
    <address>
        <poscode>86400</poscode>
        <city>Batu Pahat</city>
        <street>Jalan Puding</street>
    </address>
    <phonenum>
        <firstnum>12345</firstnum>
        <secondnum>67890</secondnum>
    </phonenum>
</securityInformation>


Validation Answer :


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

Answer :

         <securityInformation>
             <securitynum>123456789A</securitynum>
             <fname>Adha</fname>
             <lname>Hadif</lname>
             <address>
                <poscode>86400</poscode>
                <city>Batu Pahat</city>
                <street>Jalan Puding</street>
             </address>
             <phonenum>
                <firstnum>12345</firstnum>
                <secondnum>67890</secondnum>
             </phonenum>
         </securityInformation>


Validation Answer :

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="securityInformation">
    <xs:complexType>
      <xs:sequence>
        <xs:element type="xs:string" name="securitynum"/>
        <xs:element type="xs:string" name="fname"/>
        <xs:element type="xs:string" name="lname"/>
        <xs:element name="address">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:int" name="poscode"/>
              <xs:element type="xs:string" name="city"/>
              <xs:element type="xs:string" name="street"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="phonenum">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:short" name="firstnum"/>
              <xs:element type="xs:int" name="secondnum"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>