|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectibspan.tss.semantic.Memory
public class Memory
This class provides a set of methods for transparent operating on Jena memory-based model.
Examples say more then thousand of words:
Memory mem = new Memory();
Memory mem = new Memory(rdfString);
Memory mem = new Memory(someModel);
Memory mem = new Memory(someThing);
mem.addThing(otherThing);
String otherString = mem.dump();
OWLData data = mem.buildOWLData()
OntModel
,
Thing
,
OWLData
Field Summary | |
---|---|
static String |
DEFAULT_BASE
Default base namespace URI. |
static String |
DEFAULT_LANG
Default serialization language. |
Constructor Summary | |
---|---|
Memory()
Creates Memory with empy model. |
|
Memory(com.hp.hpl.jena.ontology.OntModel model)
Creates Memory object with given model. |
|
Memory(String rdf)
Creates Memory object with model with RDF statements
represented in language DEFAULT_LANG . |
|
Memory(String rdf,
String base)
Creates Memory object with model including RDF statements
represented in language DEFAULT_LANG . |
|
Memory(com.ibm.adtech.jastor.Thing thing)
Creates Memory object with model including resource of
given Thing. |
Method Summary | |
---|---|
void |
addProperties(com.hp.hpl.jena.rdf.model.Resource root)
Recursive method which copy resource with all properties recursively into memory. |
void |
addResource(com.hp.hpl.jena.rdf.model.Resource r)
Creates a copy of given resource if it is not there |
void |
addRootThing(com.ibm.adtech.jastor.Thing thing)
Remembers thing in memory and registers it as one of the
roots. |
void |
addThing(com.ibm.adtech.jastor.Thing thing)
Remembers thing in memory. |
OWLData |
buildOWLData()
Creates OWLData containing internal model of this Memory object. |
OWLData |
buildOWLData(boolean needAll)
Creates OWLData containing internal model of this Memory object. |
com.hp.hpl.jena.rdf.model.Resource |
createAnonResource()
Creates and returns anonymous resource in the memory. |
static com.hp.hpl.jena.ontology.OntModel |
createDefaultOntModel()
Answer a new ontology model which will process in-memory models of ontologies expressed the default ontology language (OWL). |
String |
dump()
Returns a serialized represention of the internal model in a language DEFAULT_LANG .No
content from any imported model will be serialized. |
String |
dump(boolean needAll)
Returns a serialized represention of the internal model in a language DEFAULT_LANG . |
com.hp.hpl.jena.ontology.OntModel |
getModel()
Returns internal model. |
protected static String |
model2rdf(com.hp.hpl.jena.ontology.OntModel model,
boolean needAll)
Returns a serialized represention of a model in a language DEFAULT_LANG |
protected static String |
model2rdf(com.hp.hpl.jena.ontology.OntModel model,
String lang,
boolean needAll)
Returns a serialized represention of a model in a language lang |
protected static String |
model2rdf(com.hp.hpl.jena.ontology.OntModel model,
String lang,
String base,
boolean needAll)
Returns a serialized represention of a model in a language DEFAULT_LANG |
protected static com.hp.hpl.jena.ontology.OntModel |
rdf2model(String rdf)
Add RDF statements represented in language DEFAULT_LANG to
the model. |
protected static com.hp.hpl.jena.ontology.OntModel |
rdf2model(String rdf,
String base)
Add RDF statements represented in language DEFAULT_LANG to
the model. |
protected static com.hp.hpl.jena.ontology.OntModel |
rdf2model(String rdf,
String base,
String lang)
Add RDF statements represented in language lang to the
model. |
void |
removeProperties(com.hp.hpl.jena.rdf.model.Resource root)
Recursive method which remove resource with all properties recursively from the memory. |
void |
removeProperties(com.ibm.adtech.jastor.Thing root)
Recursive method which remove resource with all properties recursively from the memory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_LANG
public static final String DEFAULT_BASE
Constructor Detail |
---|
public Memory()
Memory
with empy model.
public Memory(String rdf)
Memory
object with model with RDF statements
represented in language DEFAULT_LANG
.
rdf
- the source input of the input serialization.DEFAULT_LANG
public Memory(String rdf, String base)
Memory
object with model including RDF statements
represented in language DEFAULT_LANG
.
rdf
- the source input of the input serialization.base
- the base uri to be used when converting relative URI's to
absolute URI's. The base URI may be null if there are no
relative URIs to convert. A base URI of "" may permit relative
URIs to be used in the model.public Memory(com.hp.hpl.jena.ontology.OntModel model)
Memory
object with given model.
model
- existing model.public Memory(com.ibm.adtech.jastor.Thing thing)
Memory
object with model including resource of
given Thing.
model
- existing model.Method Detail |
---|
public com.hp.hpl.jena.ontology.OntModel getModel()
public String dump(boolean needAll)
DEFAULT_LANG
.
needAll
- if true then returns also inferred statements and statements imported from other
documents
DEFAULT_LANG
public String dump()
DEFAULT_LANG
.No
content from any imported model will be serialized.
DEFAULT_LANG
public void addRootThing(com.ibm.adtech.jastor.Thing thing)
thing
in memory and registers it as one of the
roots.
More precisely, copies resource of thing
into internal
model.
thing
- given thingpublic OWLData buildOWLData()
Syntax language will be set to the value of DEFAULT_LANG
and all
resources registered as roots will be added as values of
withRootURI
property of OWLData object.
public OWLData buildOWLData(boolean needAll)
DEFAULT_LANG
and all
resources registered as roots will be added as values of
withRootURI
property of OWLData object.
needAll
- true
means that also content of imported
ontologies will be serialized into OWLData.
public void addThing(com.ibm.adtech.jastor.Thing thing)
thing
in memory.
More precisely, copies resource of thing
into internal
model.
thing
- given thingpublic void addResource(com.hp.hpl.jena.rdf.model.Resource r)
r
- public com.hp.hpl.jena.rdf.model.Resource createAnonResource()
public static com.hp.hpl.jena.ontology.OntModel createDefaultOntModel()
protected static String model2rdf(com.hp.hpl.jena.ontology.OntModel model, boolean needAll)
DEFAULT_LANG.
- Parameters:
model
- the source model of the output serialization.needAll
- true
means that also content of imported ontologies will be serialized
- Returns:
- serialized representation
- See Also:
DEFAULT_LANG
protected static String model2rdf(com.hp.hpl.jena.ontology.OntModel model, String lang, boolean needAll)
lang.
- Parameters:
model
- the source model of the output serialization.lang
- the language in which the RDF should be serializedneedAll
- true
means that also content of imported ontologies will be serialized
- Returns:
- serialized representation.
protected static String model2rdf(com.hp.hpl.jena.ontology.OntModel model, String lang, String base, boolean needAll)
DEFAULT_LANG.
- Parameters:
model
- the source model of the output serialization.lang
- the language in which the RDF should be serializedbase
- the base uri for relative URI calculations; null means use only absolute URI's.needAll
- true
means that also content of imported ontologies will be serialized
- Returns:
- serialized representation
protected static com.hp.hpl.jena.ontology.OntModel rdf2model(String rdf)
DEFAULT_LANG
to
the model.
rdf
- the source input of the input serialization.
DEFAULT_LANG
protected static com.hp.hpl.jena.ontology.OntModel rdf2model(String rdf, String base)
DEFAULT_LANG
to
the model.
rdf
- the source input of the input serialization.base
- the base uri to be used when converting relative URI's to
absolute URI's. The base URI may be DEFAULT_LANG
protected static com.hp.hpl.jena.ontology.OntModel rdf2model(String rdf, String base, String lang)
lang
to the
model.
rdf
- the source input of the input serialization.base
- the base uri to be used when converting relative URI's to
absolute URI's. The base URI may be lang
- the langauge of the serialization; null
selects
the default.
public void addProperties(com.hp.hpl.jena.rdf.model.Resource root)
r
- resource which properties should be addedpublic void removeProperties(com.hp.hpl.jena.rdf.model.Resource root)
r
- resource which properties should be addedpublic void removeProperties(com.ibm.adtech.jastor.Thing root)
r
- thing which properties should be added
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |