Overview | Package | Class | Tree | Deprecated | Index | Help
| Protégé-OWL 3.5 alpha
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.stanford.smi.protegex.owl.jena.triplestore
Class JenaMemoryTripleWriter

    java.lang.Object
      edu.stanford.smi.protegex.owl.jena.triplestore.JenaMemoryTripleWriter

All Implemented Interfaces:
  TripleWriter

    public class JenaMemoryTripleWriter

extends Object
implements TripleWriter

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.

Author:
  Holger Knublauch

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.
`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`

Constructor Detail

### JenaMemoryTripleWriter

    public JenaMemoryTripleWriter()

  Creates a JenaMemoryTripleWriter for in-memory use only. The method close shall not be called on this. This constructor is useful for testing purposes, to test the output into a writer without having to generate a File.

### JenaMemoryTripleWriter

    public JenaMemoryTripleWriter(OutputStream os)

### JenaMemoryTripleWriter

    public JenaMemoryTripleWriter(OutputStream os,
                                  com.hp.hpl.jena.ontology.OntModel ontModel)

Method Detail

### addImport

    public void addImport(String uri)

  Description copied from interface: `TripleWriter`
  Adds an owl:imports statement to the default ontology in this writer. This is a convenience method because the same can typically be achieved by adding a corresponding triple.

  Specified by:
    `addImport` in interface `TripleWriter`
  Parameters:
    `uri` - the URI to add

### addTriple

    public void addTriple(com.hp.hpl.jena.graph.Node subject,
                          com.hp.hpl.jena.graph.Node predicate,
                          com.hp.hpl.jena.graph.Node object)

### close

    public void close()
               throws Exception

  Description copied from interface: `TripleWriter`
  Tells the writer that we're finished. This method should be called at the end of a writing process. After this method has been called, no other calls to this object are permitted.

  Specified by:
    `close` in interface `TripleWriter`
  Throws:
    `Exception`

### getOntModel

    public com.hp.hpl.jena.ontology.OntModel getOntModel()

### init

    public void init(String baseURI)

  Description copied from interface: `TripleWriter`
  Initializes this writer to work with a given base URI. This URI will also be the URI of the default ontology in this file, and future calls of `addImport` will add to this ontology.

  Specified by:
    `init` in interface `TripleWriter`
  Parameters:
    `baseURI` - the base URI, such as `http://www.a.com/ontology.owl`

### write

    public void write(RDFResource tsubject,
                      RDFProperty tpredicate,
                      Object tobject)

  Description copied from interface: `TripleWriter`
  Writes a given Triples into this writer.

  Specified by:
    `write` in interface `TripleWriter`

### writePrefix

    public void writePrefix(String prefix,
                            String namespace)

  Description copied from interface: `TripleWriter`
  Writes a prefix declaration into this writer. Since namespace declarations are typically written to the beginning of a file, implementations of this method may require that any calls to this method are done before the first triple is written out.

  Specified by:
    `writePrefix` in interface `TripleWriter`
  Parameters:
    `prefix` - the prefix to define ("" for the default namespace)
    `namespace` - the namespace to assign to the prefix

Overview | Package | Class | Tree | Deprecated | Index | Help
| Protégé-OWL 3.5 alpha
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug report or feature request
Copyright (c) 1998-2012 Stanford University.