info.sswap.http.rest
Class DefinitionFactoryBase

java.lang.Object
  extended by info.sswap.http.rest.DefinitionFactoryBase
Direct Known Subclasses:
OntologyFactory, PropertyFactory, TypeFactory

public abstract class DefinitionFactoryBase
extends java.lang.Object

Base for all factories that create definitions of terminology (e.g., definitions of classes, properties, ontologies) etc. It contains shared methods for processing the intermediate representation.

Author:
Blazej Bulka

Constructor Summary
DefinitionFactoryBase()
           
 
Method Summary
protected static java.util.Collection<java.net.URI> createURICollection(Value collectionValue)
          Treats the given JSON value as an array of URIs and converts it into a collection of URIs
protected static java.lang.String getString(Value value)
          Gets the value of the Value as string
protected  java.util.Collection<LiteralValue> getValuesAsLiteralCollection(Value value)
          Converts a JSON intermediate representation of a value to a collection of strings.
protected static java.util.Collection<info.sswap.api.model.SSWAPElement> getValuesAsPropertyValues(info.sswap.api.model.SSWAPDocument document, info.sswap.api.model.SSWAPPredicate predicate, Value value)
           
protected static java.util.Collection<java.lang.String> getValuesAsStringCollection(Value value)
          Converts a JSON intermediate representation of a value to a collection of strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefinitionFactoryBase

public DefinitionFactoryBase()
Method Detail

createURICollection

protected static java.util.Collection<java.net.URI> createURICollection(Value collectionValue)
                                                                 throws java.lang.IllegalArgumentException
Treats the given JSON value as an array of URIs and converts it into a collection of URIs

Parameters:
collectionValue - the json array
Returns:
URIs from Values in the array
Throws:
java.lang.IllegalArgumentException

getString

protected static java.lang.String getString(Value value)
                                     throws java.lang.IllegalArgumentException
Gets the value of the Value as string

Parameters:
value - the value that should be a string
Returns:
the string value of the Value
Throws:
java.lang.IllegalArgumentException - if the value is not a literal

getValuesAsPropertyValues

protected static java.util.Collection<info.sswap.api.model.SSWAPElement> getValuesAsPropertyValues(info.sswap.api.model.SSWAPDocument document,
                                                                                                   info.sswap.api.model.SSWAPPredicate predicate,
                                                                                                   Value value)

getValuesAsStringCollection

protected static java.util.Collection<java.lang.String> getValuesAsStringCollection(Value value)
Converts a JSON intermediate representation of a value to a collection of strings.

Parameters:
value - the JSON intermediate representation of a value -- either a literal or an array of literals
Returns:
collection of strings
Throws:
java.lang.IllegalArgumentException - if the value is neither a literal or an array of literals

getValuesAsLiteralCollection

protected java.util.Collection<LiteralValue> getValuesAsLiteralCollection(Value value)
Converts a JSON intermediate representation of a value to a collection of strings.

Parameters:
value - the JSON intermediate representation of a value -- either a literal or an array of literals
Returns:
collection of strings
Throws:
java.lang.IllegalArgumentException - if the value is neither a literal or an array of literals


Copyright (c) 2010, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.