Class JenaModelHelper
java.lang.Object
org.eclipse.lyo.oslc4j.provider.jena.JenaModelHelper
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Model
createJenaModel
(Object[] objects) static <R extends IResource>
RfollowLink
(Model m, Link l, Class<R> rClass) Extracts a resource from the Jena model pointed to by a Link.static Object[]
fromJenaModel
(Model model, Class<?> beanClass) Deprecated.static Object
fromJenaResource
(Resource resource, Class<?> beanClass) Deprecated.Useunmarshal(Resource, Class)
orunmarshalSingle(Model, Class)
instead.protected static void
handleExtendedProperties
(Class<?> resourceClass, Model model, Resource mainResource, IExtendedResource extendedResource, Map<String, Object> properties, Map<IExtendedResource, Resource> visitedResources) static void
Skolemize all blank node by replacing them with equivalent resources with an ephemeral URI of form 'urn:skolem:%blankNodeId%''static void
skolemize
(Model m, Function<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[]
Wrapper aroundfromJenaModel(Model, Class)
to provide generics support and group exceptions.static <T> T
Wrapper aroundfromJenaResource(Resource, Class)
to provide generics support and group exceptions.static <T> T
unmarshalSingle
(Model model, Class<T> clazz) Wrapper aroundunmarshal(Model, Class)
to unmarshal a single resource instance.
-
Field Details
-
OSLC4J_STRICT_DATATYPES
Deprecated.System property "org.eclipse.lyo.oslc4j.strictDatatypes" : When "true" (default), fail on when reading a property value that is not a legal instance of a datatype. When "false", skip over invalid values in extended properties.- See Also:
-
-
Method Details
-
createJenaModel
public static Model createJenaModel(Object[] objects) throws DatatypeConfigurationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, OslcCoreApplicationException -
unmarshalSingle
public static <T> T unmarshalSingle(Model model, Class<T> clazz) throws IllegalArgumentException, LyoModelException Wrapper aroundunmarshal(Model, Class)
to unmarshal a single resource instance.- Throws:
IllegalArgumentException
- if anything but 1 resource was unmarshaled exactly.LyoModelException
-
unmarshal
Wrapper aroundfromJenaResource(Resource, Class)
to provide generics support and group exceptions.- Type Parameters:
T
- Same resource class/interface to make the method generic- Parameters:
resource
- Jena resource to be unmarshalledclazz
- Lyo resource class/interface instance to assist reflection- Returns:
- an unmarshalled resource class instance
- Throws:
LyoModelException
- if the model cannot be unmarshalled into instances of the provided class
-
fromJenaResource
@Deprecated public static Object fromJenaResource(Resource resource, Class<?> beanClass) throws DatatypeConfigurationException, IllegalAccessException, IllegalArgumentException, InstantiationException, InvocationTargetException, OslcCoreApplicationException, URISyntaxException, SecurityException, NoSuchMethodException Deprecated.Useunmarshal(Resource, Class)
orunmarshalSingle(Model, Class)
instead. -
unmarshal
Wrapper aroundfromJenaModel(Model, Class)
to provide generics support and group exceptions.- Type Parameters:
T
- Same resource class to make the method generic- Parameters:
model
- Jena model with RDF resources to be unmarshalledclazz
- Lyo resource class instance to assist reflection- Returns:
- an array of unmarshalled resource class instances
- Throws:
LyoModelException
- if the model cannot be unmarshalled into instances of the provided class
-
fromJenaModel
@Deprecated public static Object[] fromJenaModel(Model model, Class<?> beanClass) throws DatatypeConfigurationException, IllegalAccessException, IllegalArgumentException, InstantiationException, InvocationTargetException, OslcCoreApplicationException, URISyntaxException, SecurityException, NoSuchMethodException Deprecated.Useunmarshal(Model, Class)
instead. -
followLink
public static <R extends IResource> R followLink(Model m, Link l, Class<R> rClass) throws IllegalArgumentException, LyoModelException Extracts a resource from the Jena model pointed to by a Link.Useful in case of following links of a just unmarshaled resource using
unmarshal(Model, Class)
orunmarshalSingle(Model, Class)
.- Type Parameters:
R
- Same class argument to make method generic- Parameters:
m
- Jena modell
- Link that points to resouce inside the modelrClass
- Lyo resource class to unmarshall the OSLC resource into.- Returns:
- An instance of a resource class
- Throws:
IllegalArgumentException
- if the link does not point a resource in the model.LyoModelException
-
skolemize
Skolemize all blank node by replacing them with equivalent resources with an ephemeral URI of form 'urn:skolem:%blankNodeId%''- Parameters:
m
- Jena model to skolemize
-
skolemize
Skolemize all blank node by replacing them with equivalent resources with a URI generated by the supplied lambda function.See RDF 1.1 // Replacing Blank Nodes with IRIs for further guidance.
- Parameters:
m
- Jena model to skolemizeskolemUriFunction
- Lambda function that returns ("mints") a resource URI for a BNode.
-
handleExtendedProperties
protected static void handleExtendedProperties(Class<?> resourceClass, Model model, Resource mainResource, IExtendedResource extendedResource, Map<String, Object> properties, Map<IExtendedResource, throws DatatypeConfigurationException, IllegalAccessException, InvocationTargetException, OslcCoreApplicationExceptionResource> visitedResources)
-
unmarshal(Model, Class)
instead.