eu.monnetproject.lemon
Class LemonSerializer

java.lang.Object
  extended by eu.monnetproject.lemon.LemonSerializer
Direct Known Subclasses:
LemonSerializerImpl

public abstract class LemonSerializer
extends Object

Interface for I/O on lemon models

Author:
John McCrae

Field Summary
protected  RemoteUpdaterFactory remoteUpdateFactory
           
 
Constructor Summary
LemonSerializer()
           
 
Method Summary
abstract  void close()
          Close the connection to the serializer.
abstract  LemonModel create()
          Create a blank model.
abstract  LemonModel create(URI graph)
          Deprecated. Deprecated, use either create() if the context is irrelevant or methods of particular implementations such as LemonModels.sparqlEndpoint() to define a context.
static LemonModel modelFromURL(URL url)
          Get a model from the web starting from a given URL.
abstract  void moveLexicon(Lexicon lexicon, LemonModel from, LemonModel to)
          Move a lexicon from one model to another.
static LemonSerializer newInstance()
          Get a new instance of a lemon serializer.
static LemonSerializer newInstance(LinguisticOntology lingOnto)
          Get a new instance of a lemon serializer
abstract  void read(LemonModel model, Reader source)
          Read a lemon model putting the data in a given model
abstract  LemonModel read(Reader source)
          Read a lemon model from a given data source
abstract  LexicalEntry readEntry(Reader source)
          Read a single entry
 void setRemoteUpdateFactory(RemoteUpdaterFactory remoteUpdateFactory)
          Set the value of the remote updater factory used to copy changes to a remote repository
abstract  void write(LemonModel model, Writer target)
          Write a lemon model to a given data source
abstract  void write(LemonModel model, Writer target, boolean xml)
          Write a lemon model to a given data source
abstract  void writeEntry(LemonModel model, LexicalEntry entry, LinguisticOntology lingOnto, Writer target)
          Write a single entry to a file
abstract  void writeEntry(LemonModel model, LexicalEntry entry, LinguisticOntology lingOnto, Writer target, boolean xml)
          Write a single entry to a file
abstract  void writeLexicon(LemonModel model, Lexicon lexicon, LinguisticOntology lingOnto, Writer target)
          Write a single lexicon to a file
abstract  void writeLexicon(LemonModel model, Lexicon lexicon, LinguisticOntology lingOnto, Writer target, boolean xml)
          Write a single lexicon to a file
 void writeLexiconDescription(LemonModel model, Lexicon lexicon, Writer target)
          Write the description of a lexicon, i.e., only links to entries not the entries' descriptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

remoteUpdateFactory

protected RemoteUpdaterFactory remoteUpdateFactory
Constructor Detail

LemonSerializer

public LemonSerializer()
Method Detail

read

public abstract LemonModel read(Reader source)
Read a lemon model from a given data source


read

public abstract void read(LemonModel model,
                          Reader source)
Read a lemon model putting the data in a given model


readEntry

public abstract LexicalEntry readEntry(Reader source)
Read a single entry


create

public abstract LemonModel create()
Create a blank model.


create

@Deprecated
public abstract LemonModel create(URI graph)
Deprecated. Deprecated, use either create() if the context is irrelevant or methods of particular implementations such as LemonModels.sparqlEndpoint() to define a context.

Create a blank model

Parameters:
graph - The context of the model or null for no context

write

public abstract void write(LemonModel model,
                           Writer target)
Write a lemon model to a given data source

Parameters:
model - The model to write
target - The target to write to

writeEntry

public abstract void writeEntry(LemonModel model,
                                LexicalEntry entry,
                                LinguisticOntology lingOnto,
                                Writer target)
Write a single entry to a file

Parameters:
model - The model to write from
entry - The entry to write
lingOnto - The linguistic ontology (necessary to avoid following to other entries)
target - The target to write to

writeLexicon

public abstract void writeLexicon(LemonModel model,
                                  Lexicon lexicon,
                                  LinguisticOntology lingOnto,
                                  Writer target)
Write a single lexicon to a file

Parameters:
model - The model to write from
lexicon - The lexicon to write
lingOnto - The linguistic ontology (necessary to avoid following to other entries)
target - The target to write to

writeLexiconDescription

public void writeLexiconDescription(LemonModel model,
                                    Lexicon lexicon,
                                    Writer target)
Write the description of a lexicon, i.e., only links to entries not the entries' descriptions

Parameters:
model - The model
lexicon - The lexicon
target - The target to write to

write

public abstract void write(LemonModel model,
                           Writer target,
                           boolean xml)
Write a lemon model to a given data source

Parameters:
model - The model to write
target - The target to write to
xml - Write as XML?

writeEntry

public abstract void writeEntry(LemonModel model,
                                LexicalEntry entry,
                                LinguisticOntology lingOnto,
                                Writer target,
                                boolean xml)
Write a single entry to a file

Parameters:
model - The model to write from
entry - The entry to write
lingOnto - The linguistic ontology (necessary to avoid following to other entries)
target - The target to write to
xml - Write as XML?

writeLexicon

public abstract void writeLexicon(LemonModel model,
                                  Lexicon lexicon,
                                  LinguisticOntology lingOnto,
                                  Writer target,
                                  boolean xml)
Write a single lexicon to a file

Parameters:
model - The model to write from
lexicon - The lexicon to write
lingOnto - The linguistic ontology (necessary to avoid following to other entries)
target - The target to write to
xml - Write as XML?

moveLexicon

public abstract void moveLexicon(Lexicon lexicon,
                                 LemonModel from,
                                 LemonModel to)
Move a lexicon from one model to another. Note this may not work if the models were created by different serializers

Parameters:
lexicon - The lexicon to move
from - The source model containing the lexicon
to - The target model

newInstance

public static final LemonSerializer newInstance()
Get a new instance of a lemon serializer. This will use LexInfo as the linguistic ontology

Returns:
A lemon serializer

newInstance

public static final LemonSerializer newInstance(LinguisticOntology lingOnto)
Get a new instance of a lemon serializer

Parameters:
lingOnto - The linguistic ontology used in all models
Returns:
A lemon serializer

modelFromURL

public static LemonModel modelFromURL(URL url)
                               throws IOException
Get a model from the web starting from a given URL.

Parameters:
url - The URL of the lemon data
Returns:
The lemon model
Throws:
IOException - If an error occurred accessing the URL

close

public abstract void close()
Close the connection to the serializer.


setRemoteUpdateFactory

public void setRemoteUpdateFactory(RemoteUpdaterFactory remoteUpdateFactory)
Set the value of the remote updater factory used to copy changes to a remote repository

Parameters:
remoteUpdateFactory -


Copyright © 2012. All Rights Reserved.