|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object thewebsemantic.Base thewebsemantic.RDF2Bean
public class RDF2Bean
RDF2Bean converts one or more RDF nodes into java beans. Normally these are
nodes created by the Bean2RDF class. @Namespace
annotation value of the Class.
Bean2RDF
Field Summary |
---|
Fields inherited from class thewebsemantic.Base |
---|
binder, javaclass, JAVACLASS, m |
Constructor Summary | |
---|---|
RDF2Bean(com.hp.hpl.jena.ontology.OntModel model)
Constructs and instance of RDF2Bean bound to a particular ontology model. |
Method Summary | ||
---|---|---|
boolean |
exists(java.lang.Class<?> c,
java.lang.String id)
returns true if matching individual is found in the model. |
|
java.lang.Object |
exists(java.lang.Object target)
returns true if target exists in the model |
|
Filler |
fill(java.lang.Object o)
Returns a Filler for this bean. |
|
void |
fill(java.lang.Object o,
java.lang.String propertyName)
fill or reload a non-functional property with values from the model. |
|
|
load(java.lang.Class<T> c)
Loads all individuals having RDF type which maps to Class c. |
|
protected
|
load(java.lang.Class<T> c,
boolean shallow,
java.lang.String[] includes)
load all rdf entries that map to the bean. |
|
|
load(java.lang.Class<T> c,
int id)
same as load(String) overloaded for id's of type integer. |
|
|
load(java.lang.Class<T> c,
java.lang.String id)
Loads an ontology individual as a java bean, based on annotations or bindings applied to Class c. |
|
|
load(java.lang.Class<T> c,
java.lang.String[] includes)
Similar to load(Class |
|
protected
|
load(java.lang.Class<T> c,
java.lang.String id,
boolean shallow)
|
|
|
load(java.lang.Class<T> c,
java.lang.String id,
java.lang.String[] includes)
Similar to load(Class, String), with the ability to include non-functional Collection based properties. |
|
java.lang.Object |
load(java.lang.Object target)
Loads an object from model with the same identifier as target. |
|
|
loadDeep(java.lang.Class<T> c)
Deeply loads all individuals having RDF type which matches Class c. |
|
|
loadDeep(java.lang.Class<T> c,
int id)
loadDeep will load a particular individual and all it's properties, recursively. |
|
|
loadDeep(java.lang.Class<T> c,
java.lang.String id)
Same as loadDeep(Class, String) overloaded for id's of type integer. |
Methods inherited from class thewebsemantic.Base |
---|
isBound, t, toRdfProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RDF2Bean(com.hp.hpl.jena.ontology.OntModel model)
model
- a Jena Ontology Model instanceMethod Detail |
---|
public <T> java.util.Collection<T> loadDeep(java.lang.Class<T> c)
T
- c
- a java class which maps to individuals in your ontology.
public <T> java.util.Collection<T> load(java.lang.Class<T> c)
Collection customers = myRDF2Bean.load(Customer.class)
...
myRDF2Bean.fill(aCustomer).with("orders");
foreach(Order o: aCustomer.getOrders())...
You may also use this alternate method to fill collection properties:
myRDF2Bean.fill(aCustomer, "orders");
T
- c
-
Jenabean
,
Namespace
public <T> java.util.Collection<T> load(java.lang.Class<T> c, java.lang.String[] includes)
T
- c
- includes
-
protected <T> java.util.Collection<T> load(java.lang.Class<T> c, boolean shallow, java.lang.String[] includes)
T
- c
-
public <T> T loadDeep(java.lang.Class<T> c, int id) throws NotFoundException
c
- java class of the bean. The class is converted to a URI
based on its annotations or bindings.id
- unique id of the bean to find
NotFoundException
Jenabean
,
Namespace
public <T> T loadDeep(java.lang.Class<T> c, java.lang.String id) throws NotFoundException
c
- id
-
NotFoundException
public <T> T load(java.lang.Class<T> c, java.lang.String id) throws NotFoundException
T
- c
- id
-
NotFoundException
public <T> T load(java.lang.Class<T> c, java.lang.String id, java.lang.String[] includes) throws NotFoundException
RDF2Bean reader = new RDF2Bean(model);
String[] includes = {"orders","recentPurchases"};
reader.load(Customer.class, "cust#2", includes);
T
- c
- id
- includes
-
NotFoundException
public <T> T load(java.lang.Class<T> c, int id) throws NotFoundException
T
- c
- id
-
NotFoundException
protected <T> T load(java.lang.Class<T> c, java.lang.String id, boolean shallow) throws NotFoundException
NotFoundException
public java.lang.Object load(java.lang.Object target) throws NotFoundException
target
-
NotFoundException
public java.lang.Object exists(java.lang.Object target)
target
-
NotFoundException
public Filler fill(java.lang.Object o)
RDF2Bean rdf2bean = new RDF2Bean(model);
...
rdf2bean.fill(myBean).with("children");
o
-
public void fill(java.lang.Object o, java.lang.String propertyName)
RDF2Bean rdf2bean = new RDF2Bean(model);
...
rdf2bean.fill(myBean,"children");
o
- propertyName
- public boolean exists(java.lang.Class<?> c, java.lang.String id)
c
- id
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |