|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectinfo.sswap.http.util.EntityUtil
public class EntityUtil
A utility class for extracting information from intermediate representation for Entities, while performing validation.
Field Summary | |
---|---|
private static com.hp.hpl.jena.rdf.model.Model |
model
|
Constructor Summary | |
---|---|
EntityUtil()
|
Method Summary | ||
---|---|---|
private static
|
convertValue(Value value,
com.google.common.base.Function<Value,T> valueConverter)
Invokes the conversion function for a Value, and generates an exception if the function is unable to perform the conversion. |
|
static
|
getMultiValueProperty(Entity entity,
java.lang.String propertyName,
com.google.common.base.Function<Value,T> valueConverter)
Converts values for a property that can potentially have multiple values (e.g., the value of the property is a JSON array). |
|
static java.lang.String |
getOptionalPropertyAsString(Entity entity,
java.lang.String propertyName)
|
|
static java.net.URI |
getOptionalPropertyAsURI(Entity entity,
java.lang.String propertyName)
Gets a URI value for an optional property. |
|
static java.lang.String |
getRequiredPropertyAsString(Entity entity,
java.lang.String propertyName)
Gets a value for the first property with the specified name for an entity. |
|
static java.net.URI |
getRequiredPropertyAsURI(Entity entity,
java.lang.String propertyName)
Gets a URI value for a required property |
|
private static boolean |
isMarked(java.lang.String markedURI)
Checks whether the string has markings at the beginning (<) and the end (>) |
|
static boolean |
isMarkedEntityURI(java.lang.String uri)
Checks whether the given value is a URI with entity markers (i.e., surrounded by < and >) This kind of marking is used to mark URIs of entities in contexts where it is not certain whether the value is a URI or a literal typed xsd:anyURI. |
|
static boolean |
isReserved(java.lang.String uri)
|
|
static boolean |
isUnknownReserved(java.lang.String uri,
info.sswap.api.model.SSWAPDocument doc)
|
|
static java.lang.String |
stripEntityMarkers(java.lang.String markedURI)
Strips the markings from a string (if it has them). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final com.hp.hpl.jena.rdf.model.Model model
Constructor Detail |
---|
public EntityUtil()
Method Detail |
---|
public static java.net.URI getOptionalPropertyAsURI(Entity entity, java.lang.String propertyName) throws java.lang.IllegalArgumentException
entity
- the entity from which the value should be extractedpropertyName
- the property name
InvalidParametersException
- if the value for this property existed in the entity, but it was not a valid URI
java.lang.IllegalArgumentException
public static java.lang.String getOptionalPropertyAsString(Entity entity, java.lang.String propertyName) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static java.net.URI getRequiredPropertyAsURI(Entity entity, java.lang.String propertyName) throws java.lang.IllegalArgumentException
entity
- the entity from which the value should be extractedpropertyName
- the propertyName
InvalidParametersException
- if the value is not a valid URI or there is no such property defined for this entity
java.lang.IllegalArgumentException
public static java.lang.String getRequiredPropertyAsString(Entity entity, java.lang.String propertyName) throws java.lang.IllegalArgumentException
entity
- the entity from which the value should be extractedpropertyName
- the property name
InvalidParametersException
- if there are no defined properties with that name for this entity
java.lang.IllegalArgumentException
public static <T> java.util.Collection<T> getMultiValueProperty(Entity entity, java.lang.String propertyName, com.google.common.base.Function<Value,T> valueConverter) throws java.lang.IllegalArgumentException
T
- the return type of the conversionentity
- the entity containing the propertypropertyName
- the name of the propertyvalueConverter
- a function that can convert a Value to the desired format
java.lang.IllegalArgumentException
- if the values within the array are not literals, the value of the property
is not a literal or an array, or the converting function returns null (indicating a conversion failure).private static <T> T convertValue(Value value, com.google.common.base.Function<Value,T> valueConverter) throws java.lang.IllegalArgumentException
T
- the type of the converted objectsvalue
- a single value to be convertedvalueConverter
- the function that performs the conversion
java.lang.IllegalArgumentException
public static boolean isMarkedEntityURI(java.lang.String uri)
uri
- the URI to be checked for marking
private static boolean isMarked(java.lang.String markedURI)
markedURI
- the uri to be checked for marking
public static java.lang.String stripEntityMarkers(java.lang.String markedURI)
markedURI
- the string whose markings should be stripped
public static boolean isReserved(java.lang.String uri)
public static boolean isUnknownReserved(java.lang.String uri, info.sswap.api.model.SSWAPDocument doc)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |