Java Doc for OntEventManager.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » ontology » event » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.ontology.event 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.hp.hpl.jena.rdf.listeners.StatementListener
      com.hp.hpl.jena.ontology.event.OntEventManager

OntEventManager
public class OntEventManager extends StatementListener (Code)

An adapter that translates RDF model-level changes into higher level changes that are appropriate to ontology users. The large number of specific events that the ontology model can produce makes the traditional Java style of listener interface impractical. Instead, this event manager allows the user to register , based on command pattern, against specific .

For example, to register a handler for the declaration of an ontology class:

 OntModel m = ...
 OntEventManager em = m.getEventManager();
 em.addHandler( OntEvents.CLASS_DECLARATION,
 new OntEventHandler() {
 public void action( Resource ev, boolean added,
 RDFNode arg0, RDFNode arg1 ) {
 OntClass c = (OntClass) arg0;
 if (added) {
 // class c added to model
 }
 else {
 // class c removed from model
 }
 }
 }
 );
 

This listener acts as an adapter for graph events (i.e. adding and removing triples), converting them to higher-level ontology events. This is non-trivial, because Jena currently doesn't have a means of batching changes so that only consistent graph states are seen. For efficiency in non event-using models, this listener is only attached as a statement listener to the underlying graph when the first ontology event listener is added.


author:
   Ian Dickinson, HP Labs
author:
   (email)
version:
   CVS $Id: OntEventManager.java,v 1.9 2008/01/02 12:10:36 andy_seaborne Exp $



Constructor Summary
public  OntEventManager(OntModel m)
    

Construct an ontology event manager for the given ontology model.


Method Summary
public  voidaddDefaultHandler(OntEventHandler handler)
    
public  voidaddHandler(Resource event, OntEventHandler handler)
    
public  voidaddHandlers(Object[][] handlers)
    
public  voidaddedStatement(Statement s)
    
public  OntEventHandlergetDefaultHandler()
    
public  OntEventHandlergetHandler(Resource event)
    
public  booleanhasHandler(Resource event)
    
public  IteratorlistRegisteredEvents()
    
public  voidraise(Resource event, boolean added, Model source, RDFNode arg0, RDFNode arg1, RDFNode arg2)
    
public  voidremoveHandler(Resource event)
    
public  voidremovedStatement(Statement s)
    


Constructor Detail
OntEventManager
public OntEventManager(OntModel m)(Code)

Construct an ontology event manager for the given ontology model. This involves registering adapters for the ontology events corresponding to the language profile of the given model.


Parameters:
  m - An ontology model




Method Detail
addDefaultHandler
public void addDefaultHandler(OntEventHandler handler)(Code)

Add the given handler as the default event handler, which will be invoked if no other handler is applicable to a given event.


Parameters:
  handler - The event handler object



addHandler
public void addHandler(Resource event, OntEventHandler handler)(Code)

Add the given handler as the handler for the given event type, replacing any existing handler.


Parameters:
  event - The event type to be handled, as a resource
Parameters:
  handler - The event handler object



addHandlers
public void addHandlers(Object[][] handlers)(Code)

Add the given handlers as the handler for the given event types, replacing any existing handlers.


Parameters:
  handlers - An array of pairs, where the first element of each pairis the resource denoting the event to be handled, and the second is the handler object



addedStatement
public void addedStatement(Statement s)(Code)

Handle the addition of a statement to the model.


Parameters:
  s - The added statement



getDefaultHandler
public OntEventHandler getDefaultHandler()(Code)

Answer the default event handler, or null if not defined

The default event handler, or null



getHandler
public OntEventHandler getHandler(Resource event)(Code)

Answer the event handler for the given event, or null if not defined


Parameters:
  event - An event type to look up The current handler for the event, or null



hasHandler
public boolean hasHandler(Resource event)(Code)

Answer true if there is a defined handler for the given event type.


Parameters:
  event - An event type, as a resource True if there is a defined handler for the event



listRegisteredEvents
public Iterator listRegisteredEvents()(Code)

Answer an iterator over the events that are registered in this event manager.

An iterator over the event types of events that have registered handlers



raise
public void raise(Resource event, boolean added, Model source, RDFNode arg0, RDFNode arg1, RDFNode arg2)(Code)

Raise an event to be handled by the attached event handlers.


Parameters:
  event - The resource representing the event type
Parameters:
  added - True if this is an addition to the model, false otherwise
Parameters:
  source - The model that caused the event to be raised
Parameters:
  arg0 - The first argument to the event
Parameters:
  arg1 - The second argument to the event, or null
Parameters:
  arg2 - The third argument to the event, or null



removeHandler
public void removeHandler(Resource event)(Code)

Remove any existing handler for the given event type.


Parameters:
  event - The event for which the handler is to be removed



removedStatement
public void removedStatement(Statement s)(Code)

Handle the removal of a statement to the model


Parameters:
  s - The removed statement



Methods inherited from com.hp.hpl.jena.rdf.listeners.StatementListener
public void addedStatement(Statement s)(Code)(Java Doc)
public void addedStatements(Statement[] statements)(Code)(Java Doc)
public void addedStatements(List statements)(Code)(Java Doc)
public void addedStatements(StmtIterator statements)(Code)(Java Doc)
public void addedStatements(Model m)(Code)(Java Doc)
public void notifyEvent(Model m, Object event)(Code)(Java Doc)
public void removedStatement(Statement s)(Code)(Java Doc)
public void removedStatements(Statement[] statements)(Code)(Java Doc)
public void removedStatements(List statements)(Code)(Java Doc)
public void removedStatements(StmtIterator statements)(Code)(Java Doc)
public void removedStatements(Model m)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.