|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ontoware.rdf2go.util.RDFTool
public class RDFTool
RDFTool, a helper utility to cope with RDF in general. The accessor methods are also handled by the RDFReactor runtime.
This tool has been part of gnowsis.org.
| Constructor Summary | |
|---|---|
RDFTool()
|
|
| Method Summary | |
|---|---|
static Model |
copyModel(Model m)
|
static java.lang.String |
date2String(java.util.Date date)
format the given date in a good date format: ISO 8601, using only the date and not the T seperator example: 2003-01-22 Timezone is ignored. |
static java.lang.String |
dateTime2DateString(java.util.Date date)
Deprecated. use date2String(Date) |
static java.lang.String |
dateTime2String(java.util.Date date)
format the given date in a good dateTime format: ISO 8601, using the T seperator and the - and : seperators accordingly. example: 2003-01-22T17:00:00 |
static Statement |
findStatement(Model model,
ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
find the first statement that fits the passed triple pattern and return it. |
static java.text.DateFormat |
getDateFormat()
format to express dates in ISO 8601. |
static java.text.DateFormat |
getDateTimeFormat()
get a DateFormat to format dates according to ISO 8601. |
static java.lang.String |
getGoodLabel(Node o,
Model source)
Get the Displaylabel of a Node. |
static java.lang.String |
getLabel(Node o)
Get the label of a Node. |
static java.lang.String |
getShortName(java.lang.String uri)
The passed uri identifies something on the web, probably a namespace. |
static Node |
getSingleValue(Model m,
Resource res,
URI pred)
get the property pred of the resource res. |
static Node |
getSingleValue(ModelSet m,
Resource res,
URI pred)
|
static java.lang.String |
getSingleValueString(Model m,
Resource res,
URI pred)
read the values of a predicate of a resource. |
static java.lang.String |
getSingleValueString(ModelSet modelset,
Resource res,
URI pred)
read the values of a predicate of a resource. |
static Syntax |
guessSyntax(java.lang.String filenname)
guess the RDF syntax of a filename inspired by com.hp.hpl.jena.graph.impl.FileGraph#guessLang with the addition of toLowerCase |
static java.lang.String |
modelToString(Model model)
convert a model to a string RDF/XML for serialization |
static java.lang.String |
modelToString(ModelSet modelset)
|
static java.lang.String |
modelToString(ModelSet modelset,
Syntax syntax)
convert a modelset to a string for serialization |
static java.lang.String |
modelToString(Model model,
Syntax syntax)
convert a model to a string for serialization |
static void |
setSingleValue(Model m,
Resource res,
URI pred,
Node value)
set the property pred of the resource res. |
static void |
setSingleValue(Model m,
Resource res,
URI pred,
java.lang.String value)
set the property pred of the resource res. |
static java.lang.String |
sha1sum(java.lang.String data)
compute the sha1sum of a string (useful for handling FOAF data). |
static java.util.Date |
string2Date(java.lang.String isodate)
try to get a date out of a string. |
static java.util.Date |
string2DateTime(java.lang.String date)
format the given date in a good date format: ISO 8601, using only the date and not the T seperator example: 2003-01-22 This ignores timezones. |
static Model |
stringToModel(java.lang.String rdfxml)
convenience function to create a memModel from an RDF/XML-ABBREV stream |
static Model |
stringToModel(java.lang.String string,
Syntax syntax)
convenience function to create a memModel from a string |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RDFTool()
| Method Detail |
|---|
public static Model copyModel(Model m)
m - the model to copy
public static java.lang.String dateTime2DateString(java.util.Date date)
date2String(Date)
date -
public static java.lang.String dateTime2String(java.util.Date date)
date -
public static java.lang.String date2String(java.util.Date date)
date -
public static Statement findStatement(Model model,
ResourceOrVariable subject,
UriOrVariable predicate,
NodeOrVariable object)
model - the model to search onsubject - subjectpredicate - predicateobject - object
java.lang.RuntimeException - if the model throws an exceptionpublic static java.text.DateFormat getDateFormat()
public static java.text.DateFormat getDateTimeFormat()
public static java.lang.String getGoodLabel(Node o,
Model source)
o - the node to checksource - the model to ask
public static java.lang.String getLabel(Node o)
null, returns null.
o - the node to check
null.public static java.lang.String getShortName(java.lang.String uri)
uri - a URI
public static Node getSingleValue(Model m,
Resource res,
URI pred)
m - the model to read fromres - the resourcepred - the predicate to read
public static Node getSingleValue(ModelSet m,
Resource res,
URI pred)
public static java.lang.String getSingleValueString(Model m,
Resource res,
URI pred)
m - the model to read fromres - the resourcepred - the predicate to read
public static java.lang.String getSingleValueString(ModelSet modelset,
Resource res,
URI pred)
modelset - the model to read fromres - the resourcepred - the predicate to read
public static Syntax guessSyntax(java.lang.String filenname)
filenname - the filename, we will look at the suffix after "."
public static java.lang.String modelToString(Model model)
model - the model to convert
public static java.lang.String modelToString(ModelSet modelset)
public static java.lang.String modelToString(Model model,
Syntax syntax)
model - the model to convertsyntax - the syntax to use
public static java.lang.String modelToString(ModelSet modelset,
Syntax syntax)
modelset - the model to convertsyntax - the syntax to use
public static void setSingleValue(Model m,
Resource res,
URI pred,
Node value)
m - the model to manipulateres - the rsourcepred - the predicate to setvalue - a value or null
public static void setSingleValue(Model m,
Resource res,
URI pred,
java.lang.String value)
m - the model to manipulateres - the rsourcepred - the predicate to setvalue - a string or nullpublic static java.lang.String sha1sum(java.lang.String data)
data - the string to parse
public static java.util.Date string2Date(java.lang.String isodate)
throws java.text.ParseException
isodate - the XSD date as string.
java.text.ParseException
public static java.util.Date string2DateTime(java.lang.String date)
throws java.text.ParseException
date - the date-string to parse
java.text.ParseExceptionpublic static Model stringToModel(java.lang.String rdfxml)
rdfxml - the serialized form of the model
public static Model stringToModel(java.lang.String string,
Syntax syntax)
string - the string with the serialized modelsyntax - the syntax to use
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||