In: Computer Science
Not: The number of elements, attributes, classes, properties, and sub properties will be assessed comparing to your respective domains (website) and not according to the respective numbers 40, 20,60,30,15: given for reference of level. 10 queries
Task:
Think and define the domain of your interest: Put the
link of the website/ domain.
Write XML document:
Point out at least 40 terms (elements) in your
domain
Point out at least 20 attributes in your domain
Define an XML schema by using these elements and attributes
Define at least 7 complex data types
Write XML document containing the data (based on your schema) (xml
file should have at least 60 records)
Validate (manually) your XML document against your schema
Write RDF document:
Point out at least 60 classes and sub-classes in your
domain
Point out at least 30 properties in your domain
Identify at least 15 sub-properties
Define an RDF Schema by using these classes & sub-classes and
properties
Write RDF document containing the data (based on your RDF
Schema)
Validate your RDF document by opening it in the Ontology (RDF) Editor (Protégé) (you can download this tool from the following link): http://protege.stanford.edu/
Create ontology in your domain of interest:
Point out at least 90 classes and sub-classes in your
domain
Point out at least 30 properties in your domain (you have to define
at least 4 properties of every property type as per OWL
specifications)
Define an OWL Ontology by using these classes & sub-classes and
properties
Create instances containing the data (based on your OWL ontology)
in same OWL file
Validate your ontology document by opening it in the Ontology (OWL) Editor (Protégé) Write (in a doc file) at least 10 queries that we ask from your ontology and explain what kind of inferencing is taking place at every stage.
Your final homework should cover complete domain knowledge by creating classes, sub-classes, properties related to your domain.
1. XML - Elements
XML elements can be defined as building blocks of an XML. Elements can behave as containers to hold text, elements, attributes, media objects or all of these.
Each XML document contains one or more elements, the scope of which are either delimited by start and end tags, or for empty elements, by an empty-element tag.
Syntax
Following is the syntax to write an XML element −
<element-name attribute1 attribute2> ....content </element-name>
where,
element-name is the name of the element. The name its case in the start and end tags must match.
attribute1, attribute2 are attributes of the element separated by white spaces. An attribute defines a property of the element. It associates a name with a value, which is a string of characters. An attribute is written as −
name = "value"
name is followed by an = sign and a string value inside double(" ") or single(' ') quotes.
Empty Element
An empty element (element with no content) has following syntax −
<name attribute1 attribute2.../>
Following is an example of an XML document using various XML element −
<?xml version = "1.0"?> <contact-info> <address category = "residence"> <name>Tanmay Patil</name> <company>TutorialsPoint</company> <phone>(011) 123-4567</phone> </address> </contact-info>
XML Elements Rules
Following rules are required to be followed for XML elements −
An element name can contain any alphanumeric characters. The only punctuation mark allowed in names are the hyphen (-), under-score (_) and period (.).
Names are case sensitive. For example, Address, address, and ADDRESS are different names.
Start and end tags of an element must be identical.
An element, which is a container, can contain text or elements as seen in the above example.
2. XML - Attributes
This chapter describes the XML attributes. Attributes are part of XML elements. An element can have multiple unique attributes. Attribute gives more information about XML elements. To be more precise, they define properties of elements. An XML attribute is always a name-value pair.
Syntax
An XML attribute has the following syntax −
<element-name attribute1 attribute2 > ....content.. < /element-name>
where attribute1 and attribute2 has the following form −
name = "value"
value has to be in double (" ") or single (' ') quotes. Here, attribute1 and attribute2 are unique attribute labels.
Attributes are used to add a unique label to an element, place the label in a category, add a Boolean flag, or otherwise associate it with some string of data. Following example demonstrates the use of attributes −
<?xml version = "1.0" encoding = "UTF-8"?> <!DOCTYPE garden [ <!ELEMENT garden (plants)*> <!ELEMENT plants (#PCDATA)> <!ATTLIST plants category CDATA #REQUIRED> ]> <garden> <plants category = "flowers" /> <plants category = "shrubs"> </plants> </garden>
Attributes are used to distinguish among elements of the same name, when you do not want to create a new element for every situation. Hence, the use of an attribute can add a little more detail in differentiating two or more similar elements.
XML Complex Data type
Element Information
Syntax
<complexType
id=ID
name=NCName
abstract=true|false
mixed=true|false
block=(#all|list of (extension|restriction))
final=(#all|list of (extension|restriction))
any attributes
>
(annotation?,(simpleContent|complexContent|((group|all|
choice|sequence)?,((attribute|attributeGroup)*,anyAttribute?))))
</complexType>
(The ? sign declares that the element can occur zero or one time, and the * sign declares that the element can occur zero or more times inside the complexType element)
Classes and Properties RDF:
The following resources belong to the core RDF Schema. We first define the type system and then introduce properties for expressing various kinds of constraints.
The Type System
The RDF Schema defined in this specification is a collection of
RDF resources that can be used to describe properties of other RDF
resources (including properties) which define application-specific
RDF vocabularies. The core schema vocabulary is defined in a
namespace informally called 'rdfs
' here, and which
will be given a formal URI in the final version of this
specification.
As described in the RDF Model and Syntax specification,
resources may be instances of one or more classes; this is
indicated with the rdf:type
property. Classes
themselves are often organised in a hierarchical fashion, for
example the class 'dog' might be considered a subclass of 'animal'
which is a subclass of 'organism' etc., meaning that any resource
which is of rdf:type
'dog' is ipso facto also
ofrdf:type
'animal' and so on. This specification
describes a property, rdfs:subClassOf
, to denote such
relationships between classes.
Core Classes
The following resources are core classes that are defined as part of the RDF Schema machinery. Every RDF model (implicitly) includes these.
rdfs:Resource
All things being described by RDF expressions are called
resources, and are considered to be instances of the class
rdfs:Resource
. The RDF class
rdfs:Resource
represents the set called 'Resources' in
the formal model for RDF presented in section 5 of the Model and
Syntax specification [RDFSMS]. This roughly corresponds to the
concept of Object in Java.
rdf:Property
The class rdf:Property
represents the subset of RDF
resources that are properties, i.e., all the elements of the set
introduced as 'Properties' in section 5 of the Model and Syntax
specification [RDFSMS].
Container Model
RDF defines three types of container objects:
Bag | An unordered list of resources or literals. Bags are used to declare that a property has multiple values and that there is no significance to the order in which the values are given. Bag might be used to give a list of part numbers where the order of processing the parts does not matter. Duplicate values are permitted. |
Sequence | An ordered list of resources or literals. Sequenceis used to declare that a property has multiple values and that the order of the values is significant. Sequence might be used, for example, to preserve an alphabetical ordering of values. Duplicate values are permitted. |
Alternative | A list of resources or literals that represent alternatives for the (single) value of a property. Alternative might be used to provide alternative language translations for the title of a work, or to provide a list of Internet mirror sites at which a resource might be found. An application using a property whose value is an Alternative collection is aware that it can choose any one of the items in the list as appropriate. |
Note: The definitions of Bag and Sequenceexplicitly permit duplicate values. RDF does not define a core concept of Set, which would be a Bagwith no duplicates, because the RDF core does not mandate an enforcement mechanism in the event of violations of such constraints. Future work layered on the RDF core may define such facilities.
To represent a collection of resources, RDF uses an additional resource that identifies the specific collection (an instance of a collection, in object modeling terminology). This resource must be declared to be an instance of one of the container object types defined above. The type property, defined below, is used to make this declaration. The membership relation between this container resource and the resources that belong in the collection is defined by a set of properties defined expressly for this purpose. These membership properties are named simply "_1", "_2", "_3", etc. Container resources may have other properties in addition to the membership properties and the type property. Any such additional statements describe the container; see Section 3.3, Distributive Referents, for discussion of statements about each of the members themselves.