Knowledge Management Semantic Web and Social Networking Semantic Web Technologies Dr Bhavani Thuraisingham The University of Texas at Dallas January 2010 Outline XML RDF OWL RULES Reference G Antoniou and F vanHarmelen A Semantic Web Primer MIT Press 2004 second edition 2008 XML The XML Language An XML document consists of a prolog a number of elements an optional epilog The prolog consists of an XML declaration and an optional reference to external structuring documents xml version 1 0 encoding UTF 16 DOCTYPE book SYSTEM book dtd 3 XML Elements Content may be text or other elements or nothing lecturer name David Billington name phone 61 7 3875 507 phone lecturer 4 If there is no content then the element is called empty it is abbreviated as follows lecturer for lecturer lecturer XML Attributes An empty element is not necessarily meaningless It may have some properties in terms of attributes An attribute is a name value pair inside the opening tag of an element lecturer name David Billington phone 61 7 3875 507 5 Well Formed XML Documents Syntactically correct documents Some syntactic rules Only one outermost element called root element Each element contains an opening and a corresponding closing tag Tags may not overlap author name Lee Hong author name Attributes within an element have unique names Element and tag names must be permissible An XML document is valid if it is well formed respects the structuring information it uses There are two ways of defining the structure of XML documents DTDs the older and more restricted way XML Schema offers extended possibilities 6 The Tree Model of XML Documents An Example email head from name Michael Maher address michaelmaher cs gu edu au to name Grigoris Antoniou address grigoris cs unibremen de subject Where is your draft subject head body Grigoris where is the draft of the paper you promised me last week body email 7 The Tree Model of XML Documents An Example 2 8 DTD Element Type Definition lecturer name David Billington name phone 61 7 3875 507 phone lecturer DTD for above element and all lecturer elements ELEMENT lecturer name phone ELEMENT name PCDATA ELEMENT phone PCDATA The element types lecturer name and phone may be used in the document A lecturer element contains a name element and a phone element in that order sequence A name element and a phone element may have any content In DTDs PCDATA is the only atomic type for elements 9 XML Schema Significantly richer language for defining the structure of XML documents Tts syntax is based on XML itself not necessary to write separate tools Reuse and refinement of schemas Expand or delete already existent schemas Sophisticated set of data types compared to DTDs which only supports strings An XML schema is an element with an opening tag like schema http www w3 org 2000 10 XMLSchema version 1 0 Structure of schema elements Element and attribute types using data types 10 Data Types 11 There is a variety of built in data types Numerical data types integer Short etc String types string ID IDREF CDATA etc Date and time data types time Month etc There are also user defined data types simple data types which cannot use elements or attributes complex data types which can use these Complex data types are defined from already existing data types by defining some attributes if any and using sequence a sequence of existing data type elements order is important all a collection of elements that must appear order is not important choice a collection of elements of which one will be chosen A Data Type Example complexType name lecturerType sequence element name firstname type string minOccurs 0 maxOccurs unbounded element name lastname type string sequence attribute name title type string use optional complexType 12 XML Schema The Email Example element name email type emailType complexType name emailType sequence element name head type headType element name body type bodyType sequence complexType 13 Namespaces An XML document may use more than one DTD or schema Since each structuring document was developed independently name clashes may appear The solution is to use a different prefix for each DTD or schema 14 prefix name An Example vu instructors xmlns vu http www vu com empDTD xmlns gu http www gu au empDTD xmlns uky http www uky edu empDTD uky faculty uky title assistant professor uky name John Smith uky department Computer Science gu academicStaff gu title lecturer gu name Mate Jones gu school Information Technology vu instructors 15 Addressing and Querying XML Documents XPATH 16 In relational databases parts of a database can be selected and retrieved using SQL Same necessary for XML documents Query languages XQuery XQL XML QL The central concept of XML query languages is a path expression Specifies how a node or a set of nodes in the tree representation of the XML document can be reached XPath is core for XML query languages Language for addressing parts of an XML document It operates on the tree data model of XML It has a non XML syntax XSL Transformations XSLT XSLT specifies rules with which an input XML document is transformed to another XML document an HTML document plain text The output document may use the same DTD or schema or a completely different vocabulary XSLT can be used independently of the formatting language author name Grigoris Antoniou name affiliation University of Bremen affiliation email ga tzi de email author may be displayed in different ways Grigoris Antoniou University of Bremen ga tzi de 17 Grigoris Antoniou University of Bremen ga tzi de Summary XML is a metalanguage that allows users to define markup XML separates content and structure from formatting XML is the de facto standard for the representation and exchange of structured information on the Web XML is supported by query languages 18 RDF Drawbacks of XML XML is a universal metalanguage for defining markup It provides a uniform frramework for interchange of data and metadata between applications However XML does not provide any means of talking about the semantics meaning of data E g there is no intended meaning associated with the nesting of tags 19 It is up to each application to interpret the nesting Basic Ideas of RDF 20 Basic building block object attribute value triple It is called a statement Sentence about Billington is such a statement RDF has been given a syntax in XML This syntax inherits the benefits of XML Other syntactic representations of RDF possible The fundamental concepts of RDF are resources
View Full Document
Unlocking...