org.w3c.IsaViz.fresnel
Class FSLSesameEvaluator

java.lang.Object
  extended byorg.w3c.IsaViz.fresnel.FSLEvaluator
      extended byorg.w3c.IsaViz.fresnel.FSLSesameEvaluator

public class FSLSesameEvaluator
extends FSLEvaluator

Main class for evaluating an FSL expression on a Sesame repository (requires Sesame 2-alpha1)


Constructor Summary
FSLSesameEvaluator(FSLNSResolver nsr, FSLHierarchyStore fhs)
          Construct an FSL Path evaluator for expression path
 
Method Summary
 java.util.Vector evaluate(FSLPath p, java.io.File file, boolean printPaths)
          Evaluate this FSL expression on an RDF/XML file
 java.util.Vector evaluate(FSLPath p, java.net.URL url, boolean printPaths)
          Evaluate this FSL expression on an RDF/XML file.
 java.util.Vector evaluate(java.lang.String path, short firstStepType, java.lang.String loc, boolean printPaths)
          Evaluate this FSL expression on an RDF/XML file
 java.util.Vector evaluatePath(FSLPath p)
          Evaluate a path expression on the repository set by setRepository(Repository r).
The initial set of nodes/arcs (i.e., the set of nodes or arcs that are going to be considered as potential starting points for matching paths) is:
1) all resource nodes in the graph if firstStepType = NODE_STEP and the first location step does not test for a literal node (i.e.
 java.util.Vector evaluatePath(FSLPath p, java.util.Vector startSet)
          Evaluate a path expression on the repository set by setRepository(Repository r), only considering specific nodes/arcs in the graph as potential starting points for paths.
 java.util.Vector evaluatePathExpr(FSLPath expr, java.lang.Object nodeOrArc)
           
 java.lang.String fcLiteralDT(FSLPath expr, java.lang.Object nodeOrArc)
           
 java.lang.String fcLiteralValue(FSLPath expr, java.lang.Object nodeOrArc)
           
 java.lang.String fcLocalName(FSLPath expr, java.lang.Object nodeOrArc)
           
 java.lang.String fcNamespaceURI(FSLPath expr, java.lang.Object nodeOrArc)
           
 java.lang.String fcURI(FSLPath expr, java.lang.Object nodeOrArc)
           
 float getFirstLiteralAsNumber(FSLPath expr, java.lang.Object nodeOrArc)
           
 java.lang.String getFirstLiteralAsString(FSLPath expr, java.lang.Object nodeOrArc)
           
 float[] getLiteralsAsNumbers(FSLPath expr, java.lang.Object nodeOrArc)
           
 java.lang.String[] getLiteralsAsStrings(FSLPath expr, java.lang.Object nodeOrArc)
           
 org.openrdf.sesame.repository.Repository getRepository()
          Get the Sesame repository on which the path expression is evaluated
static void main(java.lang.String[] args)
           
 void printPath(java.util.Vector v)
           
 void setRepository(org.openrdf.sesame.repository.Repository r)
          Set the Sesame repository on which the path expression will be evaluated
This method should be used when the repository is created, initialized and populated somewhere else.
When just evaluating the path expression on a file or URL, it is simpler to use methods evaluate(...)
 
Methods inherited from class org.w3c.IsaViz.fresnel.FSLEvaluator
callBooleanFunction, callNumberFunction, callStringFunction, evaluateBooleanExpr, evaluateNumberExpr, evaluateStringExpr, fcBoolean, fcConcat, fcContains, fcContains, fcContains, fcContains, fcCount, fcExpand, fcFalse, fcNormalizeSpace, fcNot, fcNumber, fcNumber, fcStartsWith, fcStartsWith, fcStartsWith, fcStartsWith, fcStringLength, fcStringLength, fcSubstring, fcSubstring, fcSubstringAfter, fcSubstringBefore, fcTrue, printFunctionCallError, printUnknownFunctionError, testDIFFExpr, testEQExpr, testINFEQExpr, testINFExpr, testSUPEQExpr, testSUPExpr
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSLSesameEvaluator

public FSLSesameEvaluator(FSLNSResolver nsr,
                          FSLHierarchyStore fhs)
Construct an FSL Path evaluator for expression path

Parameters:
nsr - namespace prefix bindings used in the FSL expression (this has to be instantiated by the client)
fhs - class / type hierarchy store for RDFS/OWL awareness (this has to be instantiated by the client)
Method Detail

evaluate

public java.util.Vector evaluate(java.lang.String path,
                                 short firstStepType,
                                 java.lang.String loc,
                                 boolean printPaths)
Evaluate this FSL expression on an RDF/XML file

Parameters:
path - the FSL path expression as a String
firstStepType - one of {FSLPath.NODE_STEP, FSLPath.ARC_STEP} - specifies how the first location step should be interpreted (as a node step or arc step)
loc - the file's URL (either a local file or an http URL)
printPaths - should the result paths be printed on System.out or not
Returns:
the set of paths in the model that instantiate the FSL expression

evaluate

public java.util.Vector evaluate(FSLPath p,
                                 java.io.File file,
                                 boolean printPaths)
Evaluate this FSL expression on an RDF/XML file

Parameters:
p - the FSL path expression (use FSLPath.pathFactory() to build it from its String representation)
file - the file's URL
printPaths - should the result paths be printed on System.out or not
Returns:
the set of paths in the model that instantiate the FSL expression

evaluate

public java.util.Vector evaluate(FSLPath p,
                                 java.net.URL url,
                                 boolean printPaths)
Evaluate this FSL expression on an RDF/XML file.

Parameters:
p - the FSL path expression (use FSLPath.pathFactory() to build it from its String representation)
url - the file's URL
printPaths - should the result paths be printed on System.out or not
Returns:
the set of paths in the model that instantiate the FSL expression

setRepository

public void setRepository(org.openrdf.sesame.repository.Repository r)
Set the Sesame repository on which the path expression will be evaluated
This method should be used when the repository is created, initialized and populated somewhere else.
When just evaluating the path expression on a file or URL, it is simpler to use methods evaluate(...)

Parameters:
r - the repository on which to evaluate the expression

getRepository

public org.openrdf.sesame.repository.Repository getRepository()
Get the Sesame repository on which the path expression is evaluated

Returns:
the Sesame repository

evaluatePath

public java.util.Vector evaluatePath(FSLPath p)
Evaluate a path expression on the repository set by setRepository(Repository r).
The initial set of nodes/arcs (i.e., the set of nodes or arcs that are going to be considered as potential starting points for matching paths) is:
1) all resource nodes in the graph if firstStepType = NODE_STEP and the first location step does not test for a literal node (i.e. it is not "text()");
2) all literal nodes in the graph if firstStepType = NODE_STEP and the first location step tests for a literal node (i.e. it is "text()");
3) all property arcs in the graph if firstStepType = ARC_STEP

Parameters:
p - the FSL path expression (use FSLPath.pathFactory() to build it from its String representation)
Returns:
a Vector containing Vectors that represent sequences of nodes/arcs that are instances of actual paths in the graph that match the FSL expression. These vectors are made of Sesame org.openrdf.model.Resource or org.openrdf.model.Literal objects for node steps and org.openrdf.model.Statement objects for arc steps. Naturally, one every two steps is a Resource or a Literal, the other being a Statement.
See Also:
evaluatePath(FSLPath p, Vector startSet)

evaluatePath

public java.util.Vector evaluatePath(FSLPath p,
                                     java.util.Vector startSet)
Evaluate a path expression on the repository set by setRepository(Repository r), only considering specific nodes/arcs in the graph as potential starting points for paths.

Parameters:
p - the FSL path expression (use FSLPath.pathFactory() to build it from its String representation)
startSet - The initial set of nodes/arcs (i.e., the set of nodes or arcs that are going to be considered as potential starting points for matching paths).
1) if firstStepType = NODE_STEP and the first location step does not test for a literal node (i.e. it is not "text()"), startSet should contain objects that implement org.openrdf.model.Resource;
2) if firstStepType = NODE_STEP and the first location step tests for a literal node (i.e. it is "text()"), startSet should contain objects that implement org.openrdf.model.Literal;
3) if firstStepType = ARC_STEP, startsSet should contain objects that implement org.openrdf.model.Statement
Returns:
a Vector containing Vectors that represent sequences of nodes/arcs that are instances of actual paths in the graph that match the FSL expression. These vectors are made of Sesame org.openrdf.model.Resource or org.openrdf.model.Literal objects for node steps and org.openrdf.model.Statement objects for arc steps. Naturally, one every two steps is a Resource or a Literal, the other being a Statement.
See Also:
evaluatePath(FSLPath p)

evaluatePathExpr

public java.util.Vector evaluatePathExpr(FSLPath expr,
                                         java.lang.Object nodeOrArc)
Specified by:
evaluatePathExpr in class FSLEvaluator

getLiteralsAsNumbers

public float[] getLiteralsAsNumbers(FSLPath expr,
                                    java.lang.Object nodeOrArc)
Specified by:
getLiteralsAsNumbers in class FSLEvaluator

getLiteralsAsStrings

public java.lang.String[] getLiteralsAsStrings(FSLPath expr,
                                               java.lang.Object nodeOrArc)
Specified by:
getLiteralsAsStrings in class FSLEvaluator

getFirstLiteralAsString

public java.lang.String getFirstLiteralAsString(FSLPath expr,
                                                java.lang.Object nodeOrArc)
Specified by:
getFirstLiteralAsString in class FSLEvaluator

getFirstLiteralAsNumber

public float getFirstLiteralAsNumber(FSLPath expr,
                                     java.lang.Object nodeOrArc)
Specified by:
getFirstLiteralAsNumber in class FSLEvaluator

fcLocalName

public java.lang.String fcLocalName(FSLPath expr,
                                    java.lang.Object nodeOrArc)
Specified by:
fcLocalName in class FSLEvaluator

fcNamespaceURI

public java.lang.String fcNamespaceURI(FSLPath expr,
                                       java.lang.Object nodeOrArc)
Specified by:
fcNamespaceURI in class FSLEvaluator

fcURI

public java.lang.String fcURI(FSLPath expr,
                              java.lang.Object nodeOrArc)
Specified by:
fcURI in class FSLEvaluator

fcLiteralValue

public java.lang.String fcLiteralValue(FSLPath expr,
                                       java.lang.Object nodeOrArc)
Specified by:
fcLiteralValue in class FSLEvaluator

fcLiteralDT

public java.lang.String fcLiteralDT(FSLPath expr,
                                    java.lang.Object nodeOrArc)
Specified by:
fcLiteralDT in class FSLEvaluator

printPath

public void printPath(java.util.Vector v)

main

public static void main(java.lang.String[] args)


Copyright © 2005 INRIA. All Rights Reserved
Licensed under the GNU LGPL. For full terms see the file COPYING.