|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectonto.jena.Memory
public class Memory
Jena Memory access Main functionality to access and manipulate Jena ontology models in MySQL database
Field Summary | |
---|---|
java.lang.String |
BASE
BASE returns ontology uri |
Config |
config
|
private com.hp.hpl.jena.db.IDBConnection |
conn
Instanceof database connection object |
private static java.lang.String |
DEFAULT_MODEL_NAME
Default ontology model name |
private boolean |
loaded
State variable identifies whether model is loaded |
private org.apache.log4j.Logger |
log
Log4j object |
private com.hp.hpl.jena.ontology.OntModel |
model
Instance of ontological model used in memory |
java.lang.String |
OWL_FOOT
OWL_FOOT is used to add RDF footer to Event messages comming through XML-RPC |
java.lang.String |
OWL_HEAD
OWL_HEAD is used to add RDF, OWL and ontology headers to Event messages comming through XML-RPC |
java.lang.String |
RDQL_USING
RDQL_USING is used in RDQL queries where we can write <ont:something> or <rdf:something> instead of full ontology uri or RDF uri |
java.lang.String |
SPARQL_PREFIX
SPARQL_PREFIX is used in SPARQL queries where we can write <ont:something> or <rdf:something> instead of full agent ontology uri or RDF uri |
Constructor Summary | |
---|---|
Memory(java.lang.String _propertyFile,
java.lang.String _name)
Constructor |
Method Summary | |
---|---|
void |
closeModel()
Close OWL Model and store Model in RDB if using database backend This have to be redesigned and store everything on the crash |
void |
createModel()
Creates OWL model out of defined SOURCE_FILE in OWL database and store this model see: SOURCE_FILE ,
INDIVIDUALS_FILE |
com.hp.hpl.jena.rdf.model.Property |
createProperty(java.lang.String property)
Creates ontology property out ofstring represenation |
java.lang.String |
getBase()
Reurns the onoloy name space |
com.hp.hpl.jena.db.IDBConnection |
getConnection()
This method returns db connection |
com.hp.hpl.jena.ontology.Individual |
getIndividual(java.lang.String uri)
Returns individual |
com.hp.hpl.jena.ontology.OntModel |
getModel()
|
java.lang.String |
getNS(java.lang.String key)
Returns Namespace for given key defined in config file, in property file it search for NS_[KEY] |
com.hp.hpl.jena.ontology.OntClass |
getOntologyClass(java.lang.String name)
|
com.hp.hpl.jena.ontology.Individual |
getOntologyIndividual(java.lang.String name)
Returns Individual |
java.lang.String |
getXML(com.hp.hpl.jena.rdf.model.Resource r,
java.lang.String space,
java.lang.String strRes)
Recursive method which writes resource with all properties recursively into string and returns it |
private void |
init(java.lang.String _propertyFile,
java.lang.String _name)
|
private void |
loadFiles2Model(com.hp.hpl.jena.ontology.OntModel model)
Returns OWL ontological model for manipulation |
void |
memory2owl()
Saves current content of Memory into file defined in Ontology Property file see: OUTPUT_FILE |
void |
performInference(java.lang.String ruleFile,
boolean derivationLogging)
Infers some new statements about the ontological model accoding to given rules of inference and adds inferenced model as submodel of memory |
void |
removeModel()
Remove model from DB |
void |
reset()
Sometimes if operation is idle MySQL connection fails and we need to reset connection and model |
void |
test()
Prints objects from OWL model for testing purposes |
void |
testConnection()
Tests the status of connection. |
java.lang.String |
translateNS(java.lang.String shortNS)
Translate short NS e.g. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Config config
public java.lang.String RDQL_USING
public java.lang.String SPARQL_PREFIX
public java.lang.String BASE
public java.lang.String OWL_HEAD
public java.lang.String OWL_FOOT
private static final java.lang.String DEFAULT_MODEL_NAME
private org.apache.log4j.Logger log
private com.hp.hpl.jena.db.IDBConnection conn
private com.hp.hpl.jena.ontology.OntModel model
private boolean loaded
Constructor Detail |
---|
public Memory(java.lang.String _propertyFile, java.lang.String _name)
_propertyFile
- - property file name where settings for jena memory are stored. Settings are defined according to Config
_name
- name of the componentMethod Detail |
---|
private void init(java.lang.String _propertyFile, java.lang.String _name)
public java.lang.String getBase()
public com.hp.hpl.jena.db.IDBConnection getConnection()
public void createModel()
SOURCE_FILE
,
INDIVIDUALS_FILE
public void removeModel()
private void loadFiles2Model(com.hp.hpl.jena.ontology.OntModel model)
public com.hp.hpl.jena.ontology.OntModel getModel()
public void performInference(java.lang.String ruleFile, boolean derivationLogging)
ruleFile
- path to file with line delimited list of rulesderivationLogging
- true/false value indicates whether to perform logging of inferenced statements
public void reset()
public void test()
public void memory2owl()
OUTPUT_FILE
public void closeModel()
public com.hp.hpl.jena.rdf.model.Property createProperty(java.lang.String property)
property
- represents local name of ontology propertypublic com.hp.hpl.jena.ontology.Individual getIndividual(java.lang.String uri)
uri
- URI of individual
public com.hp.hpl.jena.ontology.Individual getOntologyIndividual(java.lang.String name)
name
- of the individual without namespace prefix
public com.hp.hpl.jena.ontology.OntClass getOntologyClass(java.lang.String name)
public void testConnection()
public java.lang.String getXML(com.hp.hpl.jena.rdf.model.Resource r, java.lang.String space, java.lang.String strRes)
space
- is just to track levels of XMLr
- resource which should be converted to XML textpublic java.lang.String getNS(java.lang.String key)
key
- namespace reference keypublic java.lang.String translateNS(java.lang.String shortNS)
shortNS
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |