public class RDFUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static com.hp.hpl.jena.rdf.model.Property[] |
descriptionProps |
static com.hp.hpl.jena.rdf.model.Property[] |
labelProps |
| Constructor and Description |
|---|
RDFUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Set<com.hp.hpl.jena.rdf.model.Property> |
allPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r)
Return a collection of all the distinct properties of the given resource
|
static List<com.hp.hpl.jena.rdf.model.Resource> |
allResourceValues(com.hp.hpl.jena.rdf.model.Resource resource,
com.hp.hpl.jena.rdf.model.Property p)
Return a list of all the resource-values of the property on the resource
|
static com.hp.hpl.jena.rdf.model.Property |
asProperty(com.hp.hpl.jena.rdf.model.Resource r)
Create a property with the same URI as the given resource
|
static com.hp.hpl.jena.rdf.model.RDFNode |
asRDFNode(Object val)
Convert an arbitrary value to a RDF node.
|
static long |
asTimestamp(com.hp.hpl.jena.rdf.model.RDFNode n)
Convert a datetime literal to a unix style date stamp
|
static void |
copyProperty(com.hp.hpl.jena.rdf.model.Resource src,
com.hp.hpl.jena.rdf.model.Resource dest,
com.hp.hpl.jena.rdf.model.Property p)
Copy all values of the given property from the source to the dest resource
|
static void |
copyProperty(com.hp.hpl.jena.rdf.model.Resource src,
com.hp.hpl.jena.rdf.model.Resource dest,
com.hp.hpl.jena.rdf.model.Property p,
com.hp.hpl.jena.rdf.model.Property newp)
Copy all values of p from src to values of newp on dest.
|
static com.hp.hpl.jena.rdf.model.RDFNode |
deserialize(String ser)
Decode a serlialized RDFNode, not associated with any useful model
|
static String |
findLangMatchValue(com.hp.hpl.jena.rdf.model.Resource root,
String language,
com.hp.hpl.jena.rdf.model.Property... props)
Checks the list of properties for one for which we can return a string
which either matches the given language or a plain-literal
|
static com.hp.hpl.jena.rdf.model.Resource |
findRoot(com.hp.hpl.jena.rdf.model.Model m)
Return the root resource of a model (or the first root we find if there are multiple).
|
static List<com.hp.hpl.jena.rdf.model.Resource> |
findRoots(com.hp.hpl.jena.rdf.model.Model m)
Return all the root resources of a model
|
static com.hp.hpl.jena.rdf.model.Literal |
fromDateTime(long date)
Create a datetime literal representing the given Date (in unix ms since epoch style)
|
static com.hp.hpl.jena.rdf.model.RDFNode |
getAPropertyValue(com.hp.hpl.jena.rdf.model.Resource root,
com.hp.hpl.jena.rdf.model.Property[] props)
Return the first available value for the given list of properties
|
static boolean |
getBooleanValue(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Property p,
boolean ifAbsent)
Answer the boolean value of property
p on resource
r. |
static String |
getDescription(com.hp.hpl.jena.rdf.model.Resource root)
Return a description for the given resource
|
static String |
getDescription(com.hp.hpl.jena.rdf.model.Resource root,
String lang)
Return a description for the given resource
|
static Double |
getDoubleValue(com.hp.hpl.jena.rdf.model.Resource x,
com.hp.hpl.jena.rdf.model.Property p)
Answer the double value of property p on resource x or null if there isn't one.
|
static int |
getIntValue(com.hp.hpl.jena.rdf.model.Resource x,
com.hp.hpl.jena.rdf.model.Property p,
int ifAbsent)
Answer the integer value of property p on resource x, or
ifAbsent if there isn't one.
|
static String |
getLabel(com.hp.hpl.jena.rdf.model.RDFNode node)
Return a label for the given node
|
static String |
getLabel(com.hp.hpl.jena.rdf.model.Resource root)
Return a label for the given resource
|
static String |
getLabel(com.hp.hpl.jena.rdf.model.Resource root,
String language)
Return a label for the given resource
|
static String |
getLexicalForm(com.hp.hpl.jena.rdf.model.RDFNode value)
Return the lexical form of a node.
|
static String |
getLocalname(com.hp.hpl.jena.rdf.model.Resource r)
Return a useful version of the local name for a resource.
|
static String |
getLocalname(String uri)
Return a useful version of the local name for a resource.
|
static Long |
getLongValue(com.hp.hpl.jena.rdf.model.Resource x,
com.hp.hpl.jena.rdf.model.Property p)
Answer the long value of property p on resource x or null if there isn't one.
|
static String |
getNamespace(com.hp.hpl.jena.rdf.model.Resource r)
Return a useful version of the namespace resource.
|
static Number |
getNumericValue(com.hp.hpl.jena.rdf.model.Resource x,
com.hp.hpl.jena.rdf.model.Property p) |
static com.hp.hpl.jena.rdf.model.Resource |
getResourceValue(com.hp.hpl.jena.rdf.model.Resource subject,
com.hp.hpl.jena.rdf.model.Property prop)
Return the value of a resource on a property as a resource, or
null if there isn't a resource value.
|
static List<com.hp.hpl.jena.rdf.model.Resource> |
getResourceValues(com.hp.hpl.jena.rdf.model.Resource subject,
com.hp.hpl.jena.rdf.model.Property prop)
Return all the resource values of the property on a resource.
|
static String |
getStringValue(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Property p)
Return one of the values of the property on the resource in string form.
|
static String |
getStringValue(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Property p,
String defaultValue)
Return one of the values of the property on the resource in string form.
|
static com.hp.hpl.jena.rdf.model.Resource |
getSubject(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Property prop,
com.hp.hpl.jena.rdf.model.RDFNode object)
Find the singleton subject of the given property/value pair.
|
static com.hp.hpl.jena.rdf.model.Model |
mapNamespace(com.hp.hpl.jena.rdf.model.Model model,
String originalNS,
String replacementNS)
Map a namespace used in a model
|
static String |
serlialize(com.hp.hpl.jena.rdf.model.RDFNode node)
Serialize a (URI or literal) RDFNode to a string which can be later parsed
|
static void |
timestamp(com.hp.hpl.jena.rdf.model.Resource resource,
com.hp.hpl.jena.rdf.model.Property prop)
Timestamp a resource using current time
|
public static final com.hp.hpl.jena.rdf.model.Property[] labelProps
public static final com.hp.hpl.jena.rdf.model.Property[] descriptionProps
public static com.hp.hpl.jena.rdf.model.RDFNode getAPropertyValue(com.hp.hpl.jena.rdf.model.Resource root,
com.hp.hpl.jena.rdf.model.Property[] props)
public static String findLangMatchValue(com.hp.hpl.jena.rdf.model.Resource root, String language, com.hp.hpl.jena.rdf.model.Property... props)
public static String getLabel(com.hp.hpl.jena.rdf.model.Resource root)
public static String getLabel(com.hp.hpl.jena.rdf.model.Resource root, String language)
public static String getLabel(com.hp.hpl.jena.rdf.model.RDFNode node)
public static String getDescription(com.hp.hpl.jena.rdf.model.Resource root)
public static String getDescription(com.hp.hpl.jena.rdf.model.Resource root, String lang)
public static com.hp.hpl.jena.rdf.model.Resource getSubject(com.hp.hpl.jena.rdf.model.Model model,
com.hp.hpl.jena.rdf.model.Property prop,
com.hp.hpl.jena.rdf.model.RDFNode object)
public static String getStringValue(com.hp.hpl.jena.rdf.model.Resource r, com.hp.hpl.jena.rdf.model.Property p, String defaultValue)
public static String getStringValue(com.hp.hpl.jena.rdf.model.Resource r, com.hp.hpl.jena.rdf.model.Property p)
public static String getLexicalForm(com.hp.hpl.jena.rdf.model.RDFNode value)
public static com.hp.hpl.jena.rdf.model.Resource getResourceValue(com.hp.hpl.jena.rdf.model.Resource subject,
com.hp.hpl.jena.rdf.model.Property prop)
public static List<com.hp.hpl.jena.rdf.model.Resource> getResourceValues(com.hp.hpl.jena.rdf.model.Resource subject, com.hp.hpl.jena.rdf.model.Property prop)
public static int getIntValue(com.hp.hpl.jena.rdf.model.Resource x,
com.hp.hpl.jena.rdf.model.Property p,
int ifAbsent)
public static Long getLongValue(com.hp.hpl.jena.rdf.model.Resource x, com.hp.hpl.jena.rdf.model.Property p)
public static Double getDoubleValue(com.hp.hpl.jena.rdf.model.Resource x, com.hp.hpl.jena.rdf.model.Property p)
public static Number getNumericValue(com.hp.hpl.jena.rdf.model.Resource x, com.hp.hpl.jena.rdf.model.Property p)
public static boolean getBooleanValue(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Property p,
boolean ifAbsent)
p on resource
r. If there is no p-value, or the p-value is not a
literal, return ifAbsent. Otherwise return true if
the literal has spelling "true" or "yes", false if it has the
spelling "false" or "no", and an unspecified value otherwise.public static String getLocalname(String uri)
public static String getLocalname(com.hp.hpl.jena.rdf.model.Resource r)
public static String getNamespace(com.hp.hpl.jena.rdf.model.Resource r)
public static com.hp.hpl.jena.rdf.model.RDFNode asRDFNode(Object val)
http: is converted to a resource@lang becomes a lang-tagged literalval - Any valueRDFNodepublic static void timestamp(com.hp.hpl.jena.rdf.model.Resource resource,
com.hp.hpl.jena.rdf.model.Property prop)
public static void copyProperty(com.hp.hpl.jena.rdf.model.Resource src,
com.hp.hpl.jena.rdf.model.Resource dest,
com.hp.hpl.jena.rdf.model.Property p)
public static void copyProperty(com.hp.hpl.jena.rdf.model.Resource src,
com.hp.hpl.jena.rdf.model.Resource dest,
com.hp.hpl.jena.rdf.model.Property p,
com.hp.hpl.jena.rdf.model.Property newp)
public static com.hp.hpl.jena.rdf.model.Literal fromDateTime(long date)
public static long asTimestamp(com.hp.hpl.jena.rdf.model.RDFNode n)
public static com.hp.hpl.jena.rdf.model.Resource findRoot(com.hp.hpl.jena.rdf.model.Model m)
public static List<com.hp.hpl.jena.rdf.model.Resource> findRoots(com.hp.hpl.jena.rdf.model.Model m)
public static Set<com.hp.hpl.jena.rdf.model.Property> allPropertiesOf(com.hp.hpl.jena.rdf.model.Resource r)
public static com.hp.hpl.jena.rdf.model.Property asProperty(com.hp.hpl.jena.rdf.model.Resource r)
public static List<com.hp.hpl.jena.rdf.model.Resource> allResourceValues(com.hp.hpl.jena.rdf.model.Resource resource, com.hp.hpl.jena.rdf.model.Property p)
public static String serlialize(com.hp.hpl.jena.rdf.model.RDFNode node)
public static com.hp.hpl.jena.rdf.model.RDFNode deserialize(String ser)
Copyright © 2015. All rights reserved.