com.hp.hpl.swade.portal
Class MultiStatementWrapper

java.lang.Object
  |
  +--com.hp.hpl.swade.portal.MultiStatementWrapper
All Implemented Interfaces:
java.lang.Comparable

public class MultiStatementWrapper
extends java.lang.Object
implements java.lang.Comparable

A wrapper around a set of property/value pairs. This roughly corresponds to a set of RDF statements except that the property value of each statement is expected to be the same.

However, this is not an invariant and is not checked.

Version:
$Revision: 1.3 $ on $Date: 2004/07/04 20:30:54 $
Author:
Dave Reynolds

Field Summary
protected  DataSource datasource
          The datasource this node is located in
protected  java.util.Map sources
          Map from statements in this wrapper to their sources
protected  java.util.List statements
          The list of statements in the wrapper
 
Constructor Summary
MultiStatementWrapper(DataSource datasource)
          Constructor
MultiStatementWrapper(java.util.Iterator stmts, DataSource datasource)
          Constructor.
 
Method Summary
 void add(com.hp.hpl.jena.rdf.model.Statement stmt)
          Add an additional statement to set.
 int compareTo(java.lang.Object o1)
          Comparison based on displayname of property.
 ResourceWrapper getProp()
          Return the property as a wrapped resource
 java.lang.String getPropName()
          Return the displayable name of the property whose values are being wrapped.
 NodeWrapper getStatementSource()
          Return a wrapped resource representing the data source of an arbitrary value for this multi statement or null if it is not known.
 NodeWrapper getStatementSource(java.lang.Object value)
          Return a wrapped resource representing the data source of the given value of this multi-statement or null if it is not known.
 java.util.List getSubjects()
          Return the set of subject values as wrapped objects.
 NodeWrapper getValue()
          Return a wrapped arbitrary single value from this set or null if it is empty.
 java.util.List getValues()
          Return the set of property values as a list of wrapper objects.
 boolean hasValue(java.lang.String resource)
          Test if the MSW contains the given resource.
 boolean isEmpty()
          Return true if this wrapper contains no statements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statements

protected java.util.List statements
The list of statements in the wrapper


datasource

protected DataSource datasource
The datasource this node is located in


sources

protected java.util.Map sources
Map from statements in this wrapper to their sources

Constructor Detail

MultiStatementWrapper

public MultiStatementWrapper(DataSource datasource)
Constructor


MultiStatementWrapper

public MultiStatementWrapper(java.util.Iterator stmts,
                             DataSource datasource)
Constructor.

Parameters:
stmts - an iterator over the statements to include
Method Detail

add

public void add(com.hp.hpl.jena.rdf.model.Statement stmt)
Add an additional statement to set.


isEmpty

public boolean isEmpty()
Return true if this wrapper contains no statements.


getPropName

public java.lang.String getPropName()
Return the displayable name of the property whose values are being wrapped. This will return an arbitrary name in the case where more than one property has been mixed up in the set.


getProp

public ResourceWrapper getProp()
Return the property as a wrapped resource


getValues

public java.util.List getValues()
Return the set of property values as a list of wrapper objects. Currently these are not cached.


getSubjects

public java.util.List getSubjects()
Return the set of subject values as wrapped objects. Normally this will be a single subject but there are strange uses for which there might be more. Currently these are not cached.


hasValue

public boolean hasValue(java.lang.String resource)
Test if the MSW contains the given resource.


getValue

public NodeWrapper getValue()
Return a wrapped arbitrary single value from this set or null if it is empty.


getStatementSource

public NodeWrapper getStatementSource(java.lang.Object value)
Return a wrapped resource representing the data source of the given value of this multi-statement or null if it is not known. The source locations are cached on demand.


getStatementSource

public NodeWrapper getStatementSource()
Return a wrapped resource representing the data source of an arbitrary value for this multi statement or null if it is not known. The source locations are cached on demand.


compareTo

public int compareTo(java.lang.Object o1)
Comparison based on displayname of property.

Specified by:
compareTo in interface java.lang.Comparable


Copyright © 2004 Hewlett-Packard. All Rights Reserved.