eu.monnetproject.lemon.impl
Class LemonModelImpl

java.lang.Object
  extended by eu.monnetproject.lemon.impl.LemonModelImpl
All Implemented Interfaces:
LemonModel

public class LemonModelImpl
extends Object
implements LemonModel

Instantiated via LemonSerializerImpl

Author:
John McCrae

Field Summary
 
Fields inherited from interface eu.monnetproject.lemon.LemonModel
LEMON_URI
 
Constructor Summary
LemonModelImpl(RemoteUpdaterFactory updaterFactory)
           
LemonModelImpl(String baseURI, RemoteResolver resolver, RemoteUpdaterFactory updaterFactory)
           
LemonModelImpl(String baseURI, RemoteUpdaterFactory updaterFactory)
           
 
Method Summary
 Lexicon addLexicon(URI uri, String language)
          Add a (new blank) lexicon
 void addPattern(MorphPattern pattern)
          Add a pattern to the model
 boolean allowRemote()
           
 boolean allowUpdate()
           
 URI getContext()
          Get the base URI of the model.
 LemonFactory getFactory()
          Get the factory for making new elements
 LemonElementOrPredicate getLemonElement(URI uri)
           
 Collection<Lexicon> getLexica()
          Get the set of lexica contained by this model
 Collection<MorphPattern> getPatterns()
          Get all patterns now in the model
 void importLexicon(Lexicon lxcn, LinguisticOntology lo)
          Import a lexicon from another model
<Elem extends LemonElement>
void
merge(Elem from, Elem to)
          Merge two elements
 void purgeLexicon(Lexicon lxcn, LinguisticOntology lo)
          Remove a lexicon and all entries
<Elem extends LemonElementOrPredicate>
Iterator<Elem>
query(Class<Elem> target, String sparqlQuery)
          Return all elements in the lemon model matching some certain SPARQL query
 void register(URI uri, LemonElementOrPredicate lep)
           
 void removeLexicon(Lexicon lexicon)
          Remove a lexicon from the repository.
 RemoteResolver resolver()
           
 RemoteUpdater updater()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LemonModelImpl

public LemonModelImpl(RemoteUpdaterFactory updaterFactory)

LemonModelImpl

public LemonModelImpl(String baseURI,
                      RemoteUpdaterFactory updaterFactory)

LemonModelImpl

public LemonModelImpl(String baseURI,
                      RemoteResolver resolver,
                      RemoteUpdaterFactory updaterFactory)
Method Detail

getLexica

public Collection<Lexicon> getLexica()
Description copied from interface: LemonModel
Get the set of lexica contained by this model

Specified by:
getLexica in interface LemonModel
Returns:
The set of lexica

getLemonElement

public LemonElementOrPredicate getLemonElement(URI uri)

getContext

public URI getContext()
Description copied from interface: LemonModel
Get the base URI of the model. If this is not clear return the prefix of the first lexicon object

Specified by:
getContext in interface LemonModel
Returns:
The base URI, or null if the model has no context

getFactory

public LemonFactory getFactory()
Description copied from interface: LemonModel
Get the factory for making new elements

Specified by:
getFactory in interface LemonModel

addLexicon

public Lexicon addLexicon(URI uri,
                          String language)
Description copied from interface: LemonModel
Add a (new blank) lexicon

Specified by:
addLexicon in interface LemonModel

removeLexicon

public void removeLexicon(Lexicon lexicon)
Description copied from interface: LemonModel
Remove a lexicon from the repository. Note this does not remove any entries or other information contained in the lexicon, this must be done manually

Specified by:
removeLexicon in interface LemonModel

addPattern

public void addPattern(MorphPattern pattern)
Description copied from interface: LemonModel
Add a pattern to the model

Specified by:
addPattern in interface LemonModel
Parameters:
pattern - The pattern

getPatterns

public Collection<MorphPattern> getPatterns()
Description copied from interface: LemonModel
Get all patterns now in the model

Specified by:
getPatterns in interface LemonModel
Returns:
The set of patterns

query

public <Elem extends LemonElementOrPredicate> Iterator<Elem> query(Class<Elem> target,
                                                                   String sparqlQuery)
Description copied from interface: LemonModel
Return all elements in the lemon model matching some certain SPARQL query

Specified by:
query in interface LemonModel
Parameters:
target - The class of the target
sparqlQuery - The query in sparql, must be a select query returning a single variable
Returns:
A Collection of elements matching the given query

merge

public <Elem extends LemonElement> void merge(Elem from,
                                              Elem to)
Description copied from interface: LemonModel
Merge two elements

Specified by:
merge in interface LemonModel
Parameters:
from - The element to be removed
to - The element to be preserved

purgeLexicon

public void purgeLexicon(Lexicon lxcn,
                         LinguisticOntology lo)
Description copied from interface: LemonModel
Remove a lexicon and all entries

Specified by:
purgeLexicon in interface LemonModel
Parameters:
lxcn - The lexicon
lo - The linguistic ontology used for links in the lexicon. If this is incorrect it may result in links being followed that are not in the model resulting in to many entries being deleted

importLexicon

public void importLexicon(Lexicon lxcn,
                          LinguisticOntology lo)
Description copied from interface: LemonModel
Import a lexicon from another model

Specified by:
importLexicon in interface LemonModel
Parameters:
lxcn - The lexicon
lo - The linguistic ontology used for links in the lexicon. If this is incorrect it may result in links being followed that are not in the model resulting in to many entries being imported

allowRemote

public final boolean allowRemote()

allowUpdate

public final boolean allowUpdate()

resolver

public final RemoteResolver resolver()

updater

public final RemoteUpdater updater()

register

public void register(URI uri,
                     LemonElementOrPredicate lep)


Copyright © 2012. All Rights Reserved.