|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openanzo.utils.StatementUtils
public class StatementUtils
Basic utilities for Statements and Literal
| Constructor Summary | |
|---|---|
StatementUtils()
|
|
| Method Summary | ||
|---|---|---|
static void |
addAllMatches(java.util.Collection<org.openrdf.model.Statement> matches,
java.util.Iterator<org.openrdf.model.Statement> statements,
org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
Add all statements from Iterator into collection that match the given subj,prop,obj pattern |
|
static boolean |
areTypesCompatible(org.openrdf.model.URI t1,
org.openrdf.model.URI t2)
Determine if 2 URI datatypes are compatible |
|
static java.util.Calendar |
convertToCalendar(org.openrdf.model.Literal dateTime)
Convert the literal to a Calendar object |
|
static java.util.Date |
convertToDate(org.openrdf.model.Literal dateTime)
Convert the literal to a Date object |
|
static java.lang.Long |
convertToTimestamp(org.openrdf.model.Literal dateTime)
Convert an XSD:DateTime Literal to its long representation |
|
static org.openrdf.model.Literal |
convertToXsdDateTime(org.openrdf.model.ValueFactory valueFactory,
java.sql.Timestamp timestamp)
Convert a timestamp to an XSD:DateTime Literal |
|
static java.lang.String |
convertToXsdDateTimeString(java.util.Calendar calendar)
Convert a calendar to its XSD:dateTime string representation |
|
static java.lang.String |
convertToXsdDateTimeString(java.util.Date date)
Convert a Date object to an XSD:dateTime string representation |
|
static org.openrdf.model.Literal |
getLiteral(java.lang.Object value,
java.lang.String returnType,
java.lang.String rangeUri)
Convert the Literal object to the expected type |
|
static
|
getLiteralValue(org.openrdf.model.Literal literal,
java.lang.Class<T> expectedType)
Convert the Literal object to the expected type |
|
static java.lang.Class<?> |
getNativeType(org.openrdf.model.URI datatype)
Get the Native Object type that this datatype should be converted |
|
static java.lang.Object |
getNativeValue(org.openrdf.model.Literal literal)
Try to convert Literal to native object based on datatype |
|
static boolean |
match(org.openrdf.model.Statement statement,
org.openrdf.model.Resource subj,
org.openrdf.model.URI prop,
org.openrdf.model.Value obj,
org.openrdf.model.Resource context)
Determine if given statement matches given subject,prop,obj,namedgraph pattern |
|
static void |
writeStatements(java.util.Collection<org.openrdf.model.Statement> statements,
java.io.OutputStream outputStream)
Write contents of graph to writer using N3 serialization |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StatementUtils()
| Method Detail |
|---|
public static void writeStatements(java.util.Collection<org.openrdf.model.Statement> statements,
java.io.OutputStream outputStream)
statements - to write to outputStreamoutputStream - to which statements are to be written
public static void addAllMatches(java.util.Collection<org.openrdf.model.Statement> matches,
java.util.Iterator<org.openrdf.model.Statement> statements,
org.openrdf.model.Resource s,
org.openrdf.model.URI p,
org.openrdf.model.Value o)
matches - Collection of statements to which matches are addedstatements - Iterator of statements to determine matchess - Subject of statements to match, or null for anyp - Predicate of statements to match, or null for anyo - Object of statements to match, or null for any
public static boolean match(org.openrdf.model.Statement statement,
org.openrdf.model.Resource subj,
org.openrdf.model.URI prop,
org.openrdf.model.Value obj,
org.openrdf.model.Resource context)
statement - Statement to compare against match parameterssubj - Subject to match, or null for anyprop - Predicate to match, or null for anyobj - Object to match, or null for anycontext - NamedGraph to match, or null for any
public static <T> java.lang.Object getLiteralValue(org.openrdf.model.Literal literal,
java.lang.Class<T> expectedType)
T - Expected typeliteral - object to convertexpectedType - expect type of converted object
public static final boolean areTypesCompatible(org.openrdf.model.URI t1,
org.openrdf.model.URI t2)
t1 - first datatype to comparet2 - second datatype to compare
public static org.openrdf.model.Literal getLiteral(java.lang.Object value,
java.lang.String returnType,
java.lang.String rangeUri)
value - native object to convert into Literal objectreturnType - expected type of converted objectrangeUri - dataType to set on return Literal
public static java.lang.Object getNativeValue(org.openrdf.model.Literal literal)
literal - Literal to convert
public static java.lang.Class<?> getNativeType(org.openrdf.model.URI datatype)
datatype - to determine native type for
public static java.util.Date convertToDate(org.openrdf.model.Literal dateTime)
dateTime - Literal to convert to date
public static java.util.Calendar convertToCalendar(org.openrdf.model.Literal dateTime)
dateTime - Literal to convert to Calendar
public static java.lang.String convertToXsdDateTimeString(java.util.Calendar calendar)
calendar - Calendar to convert
public static java.lang.String convertToXsdDateTimeString(java.util.Date date)
date - Date to convert
public static org.openrdf.model.Literal convertToXsdDateTime(org.openrdf.model.ValueFactory valueFactory,
java.sql.Timestamp timestamp)
valueFactory - Valuefactory used to create literal objecttimestamp - Timestamp to convert
public static java.lang.Long convertToTimestamp(org.openrdf.model.Literal dateTime)
dateTime - XSD:DateTime Literal to convert
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||