Your SlideShare is downloading. ×
0
Download It
Download It
Download It
Download It
Download It
Download It
Download It
Download It
Download It
Download It
Download It
Download It
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Download It

134

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
134
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Using AJAX for RDF/OWL processing Emil Gatial, Martin Šeleng Institute of Informatics Slovak Academy of Sciences
  • 2. Introduction • Examples from GOM Browser (part of K-WfGrid project) • AJAX (Asynchronous JavaScript And XML) – A methodology employing DOM in combination with techniques for retrieving data without reloading a page – Constructing synchronous and asynchronous HTTP requests – Processing Document using JavaScript • XML format, HTML format, plain text, JSON format as well as RDF/OWL – Using „XMLHttpRequest‟ object to make requests • DOM (Document Object Model) – description of how an HTML or XML document is represented in a tree structure – RDF/OWL processing using XMLDocument and mapping data into DOM (RDFDataSource can be used with Mozilla/Firefox ?) 29. 4. 2010 WIKT 2006 2
  • 3. Used technologies • Client technologies – OWL/RDF syntax JavaScript DOM – JavaScript language (similar to Document Object Model Java) OWL/RDF syntax – AJAX and DOM • Server technologies – PHP, JSP or other PHP JSP References OWL/RDF: http://www.w3.org/TR/owl-ref/ JavaScript, others: http://w3schools.com/js/ AJAX and DOM: http://www.xulplanet.com/references/objref/XMLHttpRequest.html 29. 4. 2010 WIKT 2006 3
  • 4. Client side: Importing ontology files • AJAX methods – Initialization of object XMLHttpRequest depends on browser (Mozilla, IE, ...) – Synchronous vs. Asynchronous call – Using method GET and POST • Using associative arrays to access to JavaScript objects nsMap = new Array(); … nsMap[attribute.localName] = attribute.nodeValue; • Importing OWL files – Recursive processing of tag owl:imports from OWL header – Find all imports and then process them with reverse order importedDocs = new Array(); importOntology(ontoUrl) { <owl:Ontology rdf:about=""> xmlDocument = loadViaAjax(ontoUrl); … if(xmlDocument != null) { // is accessible? <owl:imports rdf:resource="..."/> importedDocs[ontoUrl] = xmlDocument; </owl:Ontology> imports = findImports(xmlDocument); // set of import URLs for(var newDoc in imports) { if (importedDocs[imports[newDocs]]) // avoid duplicates importOntology(imports[newDoc]); // call itself } } } 29. 4. 2010 WIKT 2006 4
  • 5. Client side: RDF/OWL processing • XMLDocument array processing – Reverese order processing for (docIdx = importXmlDoc.length - 1; docIdx >= 0 ; docIdx--) { createClassTree(importXmlDoc[docIdx]); } • RDF/OWL processing – Create namespace mapping nsMap[nsAbbr] = nsUrl; – RDF/OWL tag handling var rootRDF = xmlDocument.getElementsByTagName("RDF"); for(var id in rootRDF.childNodes) { xmlElement = rootRDF[0].childNodes[i]; if(xmlElement.tagName == "owl:Class") { // handle class elements according RDF/OWL syntax “rdfs:subClassOf” } else if(xmlElements.tagName == "owl:DataProperty") { } // hande ObjectProprty, Restrictions, Comments, etc. else if(xmlElement.prefix != "owl" && nsMap[xmlElement.prefix) { // handle instances } } 29. 4. 2010 WIKT 2006 5
  • 6. Client side: Storing elements • OWL distinguishes six types of class descriptions – a class identifier (a URI reference) – an exhaustive enumeration of individuals that together form the instances of a class – a property restriction – the intersection of two or more class descriptions – the union of two or more class descriptions – the complement of a class description • Storing processed elements – GOM Browser creates class tree objects as set of HTML “DIV” elements. Hidden by default. var element = document.createElement("div"); // set attributes style, wrapping element.id = id; // unique ID – owl:clasName element.eventListener(click, “action”, false); element.properties = new Array(); element.instances = new Array(); // include other elements IMG, SPAN (text info), etc. 29. 4. 2010 WIKT 2006 6
  • 7. Client side: Handling events • Event handling – usually shows/hides DOM elements, performs actions such add, delete and modify ontology function showProperties(e) { var element = e.target; element.style.display = "block"; // display element // element.style.display = “none“; hide element } 29. 4. 2010 WIKT 2006 7
  • 8. Server side: Web page code • Creating static/dynamic HTML page – JSP, PHP, etc – Included JavaScript code – Layout using tables and names element <html> <head> <script language=“JavaScript” src=“jsonto.js”></script> … </head> <body onLoad=“init();”> … <li id="rootClassContainer" style="width: 320px; height: 400px; overflow: -moz- scrollbars-vertical"/> </body> </html> 29. 4. 2010 WIKT 2006 8
  • 9. Server side: Forwarding • Forwarding mechanism Reason: XMLHttpRequest send requests only to server URL, otherwise a security exception is thrown http://srever1.com XMLDocument response (RDL/OWL source) http://srever2.com http://server.com?to_url=http://srever1.com http://srever3.com 29. 4. 2010 WIKT 2006 9
  • 10. Server side: Call services • Accessing services such add, delete or modify ontology element(s), etc. – Sharing one ontology among many users; change operations must be atomic • Update Notification GOM service – GOM Engine register Notification service http://srever1.com at Web server and send update events WS XMLDocument response http://srever2.com RDF/OWL request <rdf:RDF xmlns="http://gom.kwfgrid.net/ontology/ChangeOntology#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" http://srever3.com xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" <owl:Ontology rdf:about="http://local/change#"/> <IndividualRemoval rdf:about="http://local/change#change1"> <affectedResource>http://gom.kwfgrid.net/gom/CMN#MD116</affectedResource> </IndividualRemoval> </rdf:RDF> 29. 4. 2010 WIKT 2006 10
  • 11. Conclusion • Advantages – Seamless client application without reloading – Dynamically generated UI – Size of JavaScript code approx. 50kB – Fast processing because JavaScript is native to browser • Disadvantages – JavaScript experienced developer – Lack of debugging tools – Reloading page reinitialize client application 29. 4. 2010 WIKT 2006 11
  • 12. Thank you for your attention Emil Gatial, emil.gatial@savba.sk

×