public final class JenaModelHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static org.apache.jena.rdf.model.Model |
createJenaModel(Object[] objects) |
static <R extends IResource> |
followLink(org.apache.jena.rdf.model.Model m,
Link l,
Class<R> rClass)
Extracts a resource from the Jena model pointed to by a Link.
|
static Object[] |
fromJenaModel(org.apache.jena.rdf.model.Model model,
Class<?> beanClass)
Deprecated.
|
static Object |
fromJenaResource(org.apache.jena.rdf.model.Resource resource,
Class<?> beanClass)
Deprecated.
|
protected static void |
handleExtendedProperties(Class<?> resourceClass,
org.apache.jena.rdf.model.Model model,
org.apache.jena.rdf.model.Resource mainResource,
IExtendedResource extendedResource,
Map<String,Object> properties,
Map<IExtendedResource,org.apache.jena.rdf.model.Resource> visitedResources) |
static void |
skolemize(org.apache.jena.rdf.model.Model m)
Skolemize all blank node by replacing them with equivalent resources with an ephemeral
URI of
form 'urn:skolem:%blankNodeId%''
|
static void |
skolemize(org.apache.jena.rdf.model.Model m,
Function<org.apache.jena.graph.BlankNodeId,String> skolemUriFunction)
Skolemize all blank node by replacing them with equivalent resources with a URI generated by
the supplied lambda function.
|
static <T> T[] |
unmarshal(org.apache.jena.rdf.model.Model model,
Class<T> clazz)
Wrapper around
fromJenaModel(Model, Class) to provide generics support and group
exceptions. |
static <T> T |
unmarshal(org.apache.jena.rdf.model.Resource resource,
Class<T> clazz)
Wrapper around
fromJenaResource(Resource, Class) to provide generics support and group
exceptions. |
static <T> T |
unmarshalSingle(org.apache.jena.rdf.model.Model model,
Class<T> clazz)
Wrapper around
unmarshal(Model, Class) to unmarshal a single resource instance. |
public static org.apache.jena.rdf.model.Model createJenaModel(Object[] objects) throws DatatypeConfigurationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, OslcCoreApplicationException
public static <T> T unmarshalSingle(org.apache.jena.rdf.model.Model model,
Class<T> clazz)
throws IllegalArgumentException,
LyoModelException
unmarshal(Model, Class) to unmarshal a single resource instance.IllegalArgumentException - if anything but 1 resource was unmarshaled exactly.LyoModelExceptionpublic static <T> T unmarshal(org.apache.jena.rdf.model.Resource resource,
Class<T> clazz)
throws LyoModelException
fromJenaResource(Resource, Class) to provide generics support and group
exceptions.T - Same resource class/interface to make the method genericresource - Jena resource to be unmarshalledclazz - Lyo resource class/interface instance to assist reflectionLyoModelException - if the model cannot be unmarshalled into instances of the
provided class@Deprecated public static Object fromJenaResource(org.apache.jena.rdf.model.Resource resource, Class<?> beanClass) throws DatatypeConfigurationException, IllegalAccessException, IllegalArgumentException, InstantiationException, InvocationTargetException, OslcCoreApplicationException, URISyntaxException, SecurityException, NoSuchMethodException
public static <T> T[] unmarshal(org.apache.jena.rdf.model.Model model,
Class<T> clazz)
throws LyoModelException
fromJenaModel(Model, Class) to provide generics support and group
exceptions.T - Same resource class to make the method genericmodel - Jena model with RDF resources to be unmarshalledclazz - Lyo resource class instance to assist reflectionLyoModelException - if the model cannot be unmarshalled into instances of the
provided class@Deprecated public static Object[] fromJenaModel(org.apache.jena.rdf.model.Model model, Class<?> beanClass) throws DatatypeConfigurationException, IllegalAccessException, IllegalArgumentException, InstantiationException, InvocationTargetException, OslcCoreApplicationException, URISyntaxException, SecurityException, NoSuchMethodException
public static <R extends IResource> R followLink(org.apache.jena.rdf.model.Model m, Link l, Class<R> rClass) throws IllegalArgumentException, LyoModelException
Useful in case of following links of a just unmarshaled resource using unmarshal(Model, Class) or unmarshalSingle(Model, Class).
R - Same class argument to make method genericm - Jena modell - Link that points to resouce inside the modelrClass - Lyo resource class to unmarshall the OSLC resource into.IllegalArgumentException - if the link does not point a resource in the model.LyoModelExceptionpublic static void skolemize(org.apache.jena.rdf.model.Model m)
m - Jena model to skolemizepublic static void skolemize(org.apache.jena.rdf.model.Model m,
Function<org.apache.jena.graph.BlankNodeId,String> skolemUriFunction)
See RDF 1.1 // Replacing Blank Nodes with IRIs for further guidance.
m - Jena model to skolemizeskolemUriFunction - Lambda function that returns ("mints") a resource URI for a BNode.protected static void handleExtendedProperties(Class<?> resourceClass, org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource mainResource, IExtendedResource extendedResource, Map<String,Object> properties, Map<IExtendedResource,org.apache.jena.rdf.model.Resource> visitedResources) throws DatatypeConfigurationException, IllegalAccessException, InvocationTargetException, OslcCoreApplicationException
Copyright © 2020. All rights reserved.