N3 Rules Processing and HTML Translation for the Semantic Web
Total Page:16
File Type:pdf, Size:1020Kb
View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by CiteSeerX N3 Rules Processing and HTML Translation for the Semantic web Chun Yip Leung Digital Media Systems Laboratory HP Laboratories Bristol HPL-2003-199 October 2nd , 2003* E-mail: [email protected] N3, The semantic web is an emerging technology that could totally change forward chained how web works. It is based on the Resource Description Framework rules, RDF (RDF) which defines graphs to represent links between data. RDF/XML translation, is the common format to store RDF graphs while N3 is another instant to semantic web represent RDF and provides powerful function like rules representation. * Internal Accession Date Only Approved for External Publication ã Copyright Hewlett-Packard Company 2003 N3 Rules Processing and HTML Translation for the Semantic web Author: Chun Yip Leung ([email protected]) Keyword: N3; Forward Chained Rules; RDF Translation; Semantic Web Abstract The semantic web is an emerging technology that could totally change how web works. It is based on the Resource Description Framework (RDF) [0] which defines graphs to represent link s between data. RDF/XML is the common format to store RDF graphs while N3 is another instant to represent RDF and provides powerful function like rules representation. In this report we will discuss how to connect N3 rules to the Jena2’s rule processing system and also use the new system to solve the visual representation problem on browsing RDF. Acknowledgements This report and the project I have been working on within my six-month placement in Hewlett-Packard Labs Bristol gave my invaluable experience and I would like to say thank you to the Jena development team, especially Andy Seaborne, Chris Dollin and Dave Reynolds who gave me many advice throughout. 1 Introduction In the current web, machines cannot understand the meaning of the links. [1] Figure 1 - The current web Web browsers use HTTP protocol to access data served by different servers. Documents and resources are linked by hyperlinks and Hypertext is transmitted to present data over 1 web browsers. When the World Wide Web was designed, the assumption was a person will read the page, not machines. This makes it very hard for information management and processing, especially across different documents. The Semantic Web makes a simple extension to the current web by using binary relationships to capture the meaning between link s and data. [2] That makes it possible to represent machine processable information and lead to automation, integration and reuse of data across various applications. [3] The computer industry has agreed and uses XML standards to give a syntactic structure for describing data. However, XML can be used in many different ways to describe the same data, this makes it too open and arbitrary to support the type of widespread and ad hoc data integration envisaged for the Semantic Web. [4] Therefore a standard syntax - Resource Description Framework (RDF) was introduced. RDF defines a graph model to provide a consistent, standardised way of describing and querying internet resources, from text pages and graphics to audio files and video clips. It gives semantic interoperability, and provides the base layer for building a Semantic Web. [4] 2 Problem “The Semantic Web is a vision: the idea of having data on the Web defined and linked in such a way that it can be used by machines not just for display purposes."[6] 2.1 Display information represented by RDF in web browsers In the semantic web, RDF is the base for defining meaning, or relationships, between data. The most common way to store RDF data is to use RDF/ XML; however XML syntax is not very good at the visual presentation of information to human beings; when we see XML files written according to the RDF specifications, we know how to interpret them. But that does not mean we could see the meaning straight away. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf -syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:foaf="http://xmlns.com/foaf/0.1/"> <foaf:Person rdf:about="http://www.chunleung.org/"> <foaf:name>Johnny Leung</foaf:name> <foaf:workplaceHomepage rdf:resource="http://www.hp.com/"/> <foaf:schoolHomepage rdf:resource="http://www.doc.ic.ac.uk/"/> </rdf:RDF> RDF/XML may be much harder to read than this: Johnny Leung workplaceHomepage : http://www.hp.com/ schoolHomepage: http://www.doc.ic.ac.uk/ Therefore, a better means of visual presentation would be necessary towards the success of semantic web. The most common way to make visual presentation over the Internet is 2 the hypertext. It would be a good idea if it is able to use HTML on displaying the information modelled by RDF, in particul ar RDF/XML, on web browsers. One of the examples is us ing web server to serve FOAF (Friend of a Friend) data stored in RDF over the internet. And throughout this report, I will illustrate how this actually could be done. Moreover, we normally do not want to display all the information stored within the RDF but only part of the information. For example, we have a collection of FOAF RDF about placement students working in Hewlett-Packard Labs but we only want to display FOAF data on a particular person, say about “Johnny”. And within Johnny’s data, we might only want a certain bit being displayed. The principle is same as report generation in general I.T. industry but our data source is any data modelled in RDF. This could be done in XSLT up to a point if data is stored in XML format, but the XML’s tree structure and centric design make it not so effective. This happened because for the same graph, we could have different RDF/XML representation, as RDF focused on representing semantic, that means there are inf inity ways to store the same semantic within the RDF/XML documents, that means we have to obtain the data within the semantic level. The good thing about RDF is that there is a graph represented by it. The logical meaning, or semantic will not be affected on the representation method and therefore the translation should not be effected if the RDF data is provided in RDF/XML, N3, N- triples or in different type of Jena model. 2.2 Customizable system When the data was presented over web browsers, it would also be great if the layout is not limited but any customizable layout. The primary aim is different types of template could be easily created and the system could generate the HTML output according to the template so we could have whatever needed. The further aim would be minimize the learning curve on how the configuration could be done. The system developer might need to understand the semantic web technology deeply and programming on declarative rules are required on serving different RDF data based on different schema, but the learning curve of the system administrator should be much shorter in order to configure the system. The HTML template is based in normal HTML but with embedded tags, known as taglibs, and normal web developer or website administrator sho uld be able pick up the technique on template writing in a very short time and create web pages to present RDF data. 3 3 Background 3.1 Semantic Web Technologies Semantic Web technologies are based on a global naming scheme (URIs), a standard syntax for describing data (RDF), standard means of describing the properties of that data (rdf-schema) and standard means of describing relationships between data items (ontologies). [5] Figure 2 - The Layer Cake The principles are: · Everything Identifiable is on SW by URI (Universal Resource Identifiers). · Some properties allow unambiguous identification · Allow effective combination of the independent work of diverse communities. · Support the ability to add new information without insisting that the old be modified. · Provide communities the ability to resolve ambiguities and clarify inconsistencies. · Use descriptive conventions that can expand as human understanding expands. 3.1.1 RDF/XML RDF provides a consistent, standardized way of describing and querying internet resources and it provides the base layer for building a Semantic Web. For instance, telnet(janet_bruten, 3128700) represents the fact that the person object Janet Bruten has the telnet number 312-8700. For example, if we have the following graphs representing relationships: [4] Figure 3 - A simple directed graph This means: 4 http://www.hp.com/JanetBruten has telnet whose value is 31287002 and http://www.hp.com/JanetBruten has employee_number whose value is 405549 The standard way to record these relationships is via RDF/XML: <?xml version=’1.0’?> <rdf:RDF xmlns:rdf = ‘http://www.w3.org/1999/02/22 -rdf-syntax-ns#’ xmlns:person = ” http://www.hpl.hp.com/semweb/person” > <rdf:Description rdf:about=‘http://www.hp.com/JanetBruten’> <person:telnet>31287002</person:telnet> <person:employee_number>405549</person:employee_number> </rdf:Description> </rdf:RDF> 3.1.2 Notation 3 - N3 [7] N3 is based on RDF standards and equivalent to RDF/XML syntax , but have extra features like rules and formula. N3 is not designed as an alternative to RDF's XML syntax but a language designed for a human-readable and scribblable language. [10] It is easier and simpler than the RDF/XML approach. In N3, information is also a collection of statements; each with a subject, verb and object - and nothing else. <subject> <verb> <object> . In a statement, everything is identified by URI. And every statement is ended with a period. For example: <#johnny> <#knows> <#mei>.