|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.smi.protegex.owl.jena.triplestore.JenaMemoryTripleWriter
A TripleWriter that writes into a given OntModel, which is then written to a file when done. This TripleWriter keeps the whole model in memory, i.e. it is mandatory to make sure that the model does not become too big. However, the advantage is that this can be used to write triples and prefixes in an arbitrary order.
Field Summary | |
private com.hp.hpl.jena.graph.Node |
defaultOntologyNode
|
private com.hp.hpl.jena.ontology.OntModel |
ontModel
|
private OutputStream |
os
|
Constructor Summary | |
JenaMemoryTripleWriter()
Creates a JenaMemoryTripleWriter for in-memory use only. |
|
JenaMemoryTripleWriter(OutputStream os)
|
|
JenaMemoryTripleWriter(OutputStream os,
com.hp.hpl.jena.ontology.OntModel ontModel)
|
Method Summary | |
void |
addImport(String uri)
Adds an owl:imports statement to the default ontology in this writer. |
void |
addTriple(com.hp.hpl.jena.graph.Node subject,
com.hp.hpl.jena.graph.Node predicate,
com.hp.hpl.jena.graph.Node object)
|
void |
close()
Tells the writer that we're finished. |
private com.hp.hpl.jena.graph.Node |
createNodeFromRDFResource(RDFResource resource)
|
private com.hp.hpl.jena.graph.Node |
createNodeFromRDFSLiteral(RDFSLiteral literal,
OWLModel owlModel)
|
com.hp.hpl.jena.ontology.OntModel |
getOntModel()
|
void |
init(String baseURI)
Initializes this writer to work with a given base URI. |
void |
write(RDFResource tsubject,
RDFProperty tpredicate,
Object tobject)
Writes a given Triples into this writer. |
void |
writePrefix(String prefix,
String namespace)
Writes a prefix declaration into this writer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private com.hp.hpl.jena.graph.Node defaultOntologyNode
private com.hp.hpl.jena.ontology.OntModel ontModel
private OutputStream os
Constructor Detail |
public JenaMemoryTripleWriter()
public JenaMemoryTripleWriter(OutputStream os)
public JenaMemoryTripleWriter(OutputStream os, com.hp.hpl.jena.ontology.OntModel ontModel)
Method Detail |
public void addImport(String uri)
TripleWriter
addImport
in interface TripleWriter
uri
- the URI to addpublic void addTriple(com.hp.hpl.jena.graph.Node subject, com.hp.hpl.jena.graph.Node predicate, com.hp.hpl.jena.graph.Node object)
public void close() throws Exception
TripleWriter
close
in interface TripleWriter
Exception
private com.hp.hpl.jena.graph.Node createNodeFromRDFResource(RDFResource resource)
private com.hp.hpl.jena.graph.Node createNodeFromRDFSLiteral(RDFSLiteral literal, OWLModel owlModel)
public com.hp.hpl.jena.ontology.OntModel getOntModel()
public void init(String baseURI)
TripleWriter
addImport
will add to this ontology.
init
in interface TripleWriter
baseURI
- the base URI, such as http://www.a.com/ontology.owl
public void write(RDFResource tsubject, RDFProperty tpredicate, Object tobject)
TripleWriter
write
in interface TripleWriter
public void writePrefix(String prefix, String namespace)
TripleWriter
writePrefix
in interface TripleWriter
prefix
- the prefix to define ("" for the default namespace)namespace
- the namespace to assign to the prefix
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |