org.eaglei.repository.model
Enum View

java.lang.Object
  extended by java.lang.Enum<View>
      extended by org.eaglei.repository.model.View
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<View>

public enum View
extends java.lang.Enum<View>

Views are named datasets to be used in SPARQL queries, which are constructed dynamically according to the current user's access permissions. The View class is two things: 1. An enumerated type that defines the set of implemented views. 2. A set of static utility methods to manipulate datasets. The implemented views are: public - all graphs visible to the anonymous role metadata - all accessible metadata graphs ontology - all accessible ontology graphs metadata+ontology - all accessible md AND ontology graphs user - every NG user can see user-resource - every NG user can see related to ei instance resources all - every named graph whether permitted or not null - query entire Sesame repo without regard to named graphs (superuser)

Version:
$Id: $ Started April 2010
Author:
Larry Stone

Enum Constant Summary
ALL
           
METADATA
           
METADATA_ONTOLOGY
           
NULL
           
ONTOLOGY
           
PUBLIC
           
PUBLISHED
           
PUBLISHED_RESOURCES
           
USER
           
USER_RESOURCES
           
 
Method Summary
static void addGraphs(javax.servlet.http.HttpServletRequest request, org.openrdf.query.impl.DatasetImpl ds, View vw)
          Add the named graphs composing a view to the specified dataset.
static void addWorkspaceGraphs(javax.servlet.http.HttpServletRequest request, org.openrdf.query.impl.DatasetImpl ds, org.openrdf.model.URI graphName)
          Construct a "workspace" view based on a single named graph of type Workspace or Published which is expected to contain resource instances.
static java.util.Map<java.lang.String,org.openrdf.model.URI> getAllWorkspaceGraphs(javax.servlet.http.HttpServletRequest request)
          Returns map loaded with name and graph-URI of all named graphs of type workspace or pubilshed.
 java.lang.String getLabel()
          Getter for the field label.
 java.lang.String getTitle()
          getTitle - get pretty title to e.g.
static View parseView(java.lang.String v)
          parseView - find View matching name.
static View valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static View[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ALL

public static final View ALL

METADATA

public static final View METADATA

METADATA_ONTOLOGY

public static final View METADATA_ONTOLOGY

ONTOLOGY

public static final View ONTOLOGY

PUBLIC

public static final View PUBLIC

PUBLISHED

public static final View PUBLISHED

PUBLISHED_RESOURCES

public static final View PUBLISHED_RESOURCES

USER

public static final View USER

USER_RESOURCES

public static final View USER_RESOURCES

NULL

public static final View NULL
Method Detail

values

public static View[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (View c : View.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static View valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getLabel

public java.lang.String getLabel()

Getter for the field label.

Returns:
a String object.

getTitle

public java.lang.String getTitle()

getTitle - get pretty title to e.g. include in a menu

Returns:
a String object.

parseView

public static View parseView(java.lang.String v)

parseView - find View matching name. Implemented with dumb linear search, but good enough for now.

Parameters:
v - the view name to match.
Returns:
a org.eaglei.repository.View object or null if none found.

addGraphs

public static void addGraphs(javax.servlet.http.HttpServletRequest request,
                             org.openrdf.query.impl.DatasetImpl ds,
                             View vw)
Add the named graphs composing a view to the specified dataset. Adding graphs to an existing view allows the caller to compose a dataset of multiple views, or a view and some graphs. Each graph is added to both the default graphs list and the named graphs list to allow the SPARQL GRAPH keyword to match graphs. Any failure that prevents the intent from being completely and successfully achieved will throw an error.

Parameters:
request - a HttpServletRequest object.
ds - dataset to modify a DatasetImpl object.
vw - the View whose graphs to add.

addWorkspaceGraphs

public static void addWorkspaceGraphs(javax.servlet.http.HttpServletRequest request,
                                      org.openrdf.query.impl.DatasetImpl ds,
                                      org.openrdf.model.URI graphName)
Construct a "workspace" view based on a single named graph of type Workspace or Published which is expected to contain resource instances. Add the metadata, ontology, and inferred graphs. WARNING: This assumes all access control has been done already!

Parameters:
request - a HttpServletRequest object.
ds - dataset to modify a DatasetImpl object.
graphName - names the workspace graph, a URI object.

getAllWorkspaceGraphs

public static java.util.Map<java.lang.String,org.openrdf.model.URI> getAllWorkspaceGraphs(javax.servlet.http.HttpServletRequest request)
Returns map loaded with name and graph-URI of all named graphs of type workspace or pubilshed. Intended for constructing UI menu.

Parameters:
request - a HttpServletRequest object.
Returns:
all named graphs of type published or workspace in a Map object.


Copyright © 2009-2011 Eagle-I. All Rights Reserved.