de.fuberlin.wiwiss.d2rq
Class GraphD2RQ

java.lang.Object
  extended bycom.hp.hpl.jena.graph.impl.GraphBase
      extended byde.fuberlin.wiwiss.d2rq.GraphD2RQ
All Implemented Interfaces:
com.hp.hpl.jena.graph.Graph, com.hp.hpl.jena.graph.GraphAdd, com.hp.hpl.jena.graph.impl.GraphWithPerform

public class GraphD2RQ
extends com.hp.hpl.jena.graph.impl.GraphBase
implements com.hp.hpl.jena.graph.Graph

A D2RQ virtual read-only graph backed by a non-RDF database. D2RQ is a declarative mapping language for describing mappings between ontologies and relational data models. More information about D2RQ is found at: http://www.wiwiss.fu-berlin.de/suhl/bizer/d2rq/

History:
06-06-2004: Initial version of this class.
08-03-2004: New query algorithm, moved map building to MapParser

Version:
V0.2
Author:
Chris Bizer chris@bizer.de, Richard Cyganiak
See Also:
D2RQCapabilities

Field Summary
private  com.hp.hpl.jena.graph.Capabilities capabilities
           
(package private) static PropertyBridge[] emptyPropertyBridgeArray
           
protected  java.util.Map processingInstructions
           
private  java.util.List propertyBridges
          Collection of all PropertyBridges definded in the mapping file
private static boolean usingD2RQQueryHandler
           
 
Fields inherited from class com.hp.hpl.jena.graph.impl.GraphBase
bulkHandler, closed, gem, pm, queryHandler, reifier, style
 
Fields inherited from interface com.hp.hpl.jena.graph.Graph
emptyGraph
 
Constructor Summary
GraphD2RQ(com.hp.hpl.jena.rdf.model.Model mapModel)
          Creates a new D2RQ graph from a Jena model containing a D2RQ mapping.
GraphD2RQ(java.lang.String mapURL)
          Creates a new D2RQ graph from a D2RQ mapping file in Notation 3 syntax.
GraphD2RQ(java.lang.String mapURL, java.lang.String serializationFormat)
          Creates a new D2RQ graph from a D2RQ mapping file.
 
Method Summary
 void close()
           
 void enableDebug()
          Enables D2RQ debug messages.
 com.hp.hpl.jena.graph.Capabilities getCapabilities()
           
private  com.hp.hpl.jena.rdf.model.Model getModelFromURL(java.lang.String mapURL, java.lang.String serializationFormat)
           
 java.util.List getPropertyBridges()
           
 com.hp.hpl.jena.util.iterator.ExtendedIterator graphBaseFind(com.hp.hpl.jena.graph.TripleMatch m)
           
private  void initMap(com.hp.hpl.jena.rdf.model.Model mapModel)
           
static boolean isUsingD2RQQueryHandler()
           
 java.util.ArrayList propertyBridgesForTriple(com.hp.hpl.jena.graph.Triple t)
           
 com.hp.hpl.jena.graph.query.QueryHandler queryHandler()
          Returns a QueryHandler for this graph.
static void setUsingD2RQQueryHandler(boolean usingD2RQQueryHandler)
           
private  java.util.List sortPropertyBridges(java.util.Collection unsortedBridges)
           
 
Methods inherited from class com.hp.hpl.jena.graph.impl.GraphBase
add, checkOpen, contains, contains, containsByFind, delete, dependsOn, find, find, getBulkUpdateHandler, getEventManager, getPrefixMapping, getReifier, getTransactionHandler, graphBaseContains, graphBaseFind, graphBaseSize, isEmpty, isIsomorphicWith, notifyAdd, notifyDelete, performAdd, performDelete, reifierContains, reifierSize, reifierTriples, size, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.jena.graph.Graph
contains, contains, delete, dependsOn, find, find, getBulkUpdateHandler, getEventManager, getPrefixMapping, getReifier, getTransactionHandler, isEmpty, isIsomorphicWith, size
 
Methods inherited from interface com.hp.hpl.jena.graph.GraphAdd
add
 

Field Detail

usingD2RQQueryHandler

private static boolean usingD2RQQueryHandler

processingInstructions

protected java.util.Map processingInstructions

capabilities

private com.hp.hpl.jena.graph.Capabilities capabilities

propertyBridges

private java.util.List propertyBridges
Collection of all PropertyBridges definded in the mapping file


emptyPropertyBridgeArray

static PropertyBridge[] emptyPropertyBridgeArray
Constructor Detail

GraphD2RQ

public GraphD2RQ(java.lang.String mapURL)
          throws D2RQException
Creates a new D2RQ graph from a D2RQ mapping file in Notation 3 syntax.

Parameters:
mapURL - the URL where the mapping file is located
Throws:
D2RQException - on error in the mapping file

GraphD2RQ

public GraphD2RQ(java.lang.String mapURL,
                 java.lang.String serializationFormat)
          throws D2RQException
Creates a new D2RQ graph from a D2RQ mapping file. The second parameter specifies the RDF syntax of the mapping file. Supported values are "RDF/XML", "N-TRIPLE" and "N3".

Parameters:
mapURL - the URL where the mapping file is located
serializationFormat - the serialization syntax format
Throws:
D2RQException - on error in the mapping file

GraphD2RQ

public GraphD2RQ(com.hp.hpl.jena.rdf.model.Model mapModel)
          throws D2RQException
Creates a new D2RQ graph from a Jena model containing a D2RQ mapping.

Parameters:
mapModel - the model containing a D2RQ mapping file
Throws:
D2RQException - on error in the mapping model
Method Detail

isUsingD2RQQueryHandler

public static boolean isUsingD2RQQueryHandler()

setUsingD2RQQueryHandler

public static void setUsingD2RQQueryHandler(boolean usingD2RQQueryHandler)

getPropertyBridges

public java.util.List getPropertyBridges()

enableDebug

public void enableDebug()
Enables D2RQ debug messages.


getModelFromURL

private com.hp.hpl.jena.rdf.model.Model getModelFromURL(java.lang.String mapURL,
                                                        java.lang.String serializationFormat)

initMap

private void initMap(com.hp.hpl.jena.rdf.model.Model mapModel)
              throws D2RQException
Throws:
D2RQException

sortPropertyBridges

private java.util.List sortPropertyBridges(java.util.Collection unsortedBridges)

queryHandler

public com.hp.hpl.jena.graph.query.QueryHandler queryHandler()
Returns a QueryHandler for this graph. The query handler class can be set by the mapping. It then must have exact constructor signature QueryHandler(Graph) For some reasons, Java does not allow to call getConstructor(GraphD2RQ.class) on SimpleQueryHandler class.

Specified by:
queryHandler in interface com.hp.hpl.jena.graph.Graph
See Also:
Graph.queryHandler()

close

public void close()
Specified by:
close in interface com.hp.hpl.jena.graph.Graph
See Also:
Graph.close()

getCapabilities

public com.hp.hpl.jena.graph.Capabilities getCapabilities()
Specified by:
getCapabilities in interface com.hp.hpl.jena.graph.Graph

graphBaseFind

public com.hp.hpl.jena.util.iterator.ExtendedIterator graphBaseFind(com.hp.hpl.jena.graph.TripleMatch m)

propertyBridgesForTriple

public java.util.ArrayList propertyBridgesForTriple(com.hp.hpl.jena.graph.Triple t)