eu.monnetproject.lemon
Class LemonModels

java.lang.Object
  extended by eu.monnetproject.lemon.LemonModels

public final class LemonModels
extends Object

Set of static task that work on lemon models

Author:
John McCrae

Method Summary
static LexicalEntry addEntryToLexicon(Lexicon lexicon, URI entryURI, String canForm, URI senseRef)
          Quickly add a lexical entry to a lexicon
static Collection<LexicalEntry> getEntriesAlphabetic(LemonModel model, Lexicon lexicon, int offset, int limit)
          Get all the entries in a lexicon as an alphabetic sorted list
static List<LexicalEntry> getEntriesByForm(LemonModel model, LexicalForm form)
          Select a lexical entry by its form
static List<LexicalEntry> getEntriesByForm(LemonModel model, String form, String lang)
          Select a lexical entry by the form's representation
static List<LexicalEntry> getEntriesByFormAndProps(LemonModel model, String form, String lang, Map<Property,PropertyValue> props)
          Get entries by their written representation and properties
static List<LexicalEntry> getEntriesByFormApprox(LemonModel model, String form)
          Select a lexical entry by the form's representation, using regex
static Map<URI,List<LexicalEntry>> getEntriesBySense(LemonModel model, Lexicon lexicon, int offset, int limit)
          Get entries in a lexicon mapped by the references they have
static List<LexicalEntry> getEntryByReference(LemonModel model, URI reference)
          Get the set of entries that refer to a given reference
static List<LexicalEntry> getEntryByReference(Lexicon lexicon, URI reference)
           
static LexicalEntry getEntryBySense(LemonModel model, LexicalSense sense)
          Get the set of entries that refer to a given sense
static List<Lexicon> getLexicaByEntry(LemonModel model, LexicalEntry entry)
          Get the set of lexica containing a given entry
static LexicalForm resolveForm(LexicalEntry entry, Map<Property,Collection<PropertyValue>> properties)
           
static LemonModel sparqlEndpoint(URL endpoint, Set<URI> graphs, LinguisticOntology lingOnto)
          Connect to a lemon model contained in a SPARQL endpoint
static LemonModel sparqlUpdateEndpoint(URL sparqlEndpoint, URI graph, LinguisticOntology lingOnto, String updateEndpoint, SPARQL dialect)
          Connect to a lemon model in a repository supporting SPARQL and SPARQL update
static LemonModel sparqlUpdateEndpoint(URL sparqlEndpoint, URI graph, LinguisticOntology lingOnto, String updateEndpoint, String username, String password, SPARQL dialect)
          Connect to a lemon model in a repository supporting SPARQL and SPARQL update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEntriesByForm

public static List<LexicalEntry> getEntriesByForm(LemonModel model,
                                                  String form,
                                                  String lang)
Select a lexical entry by the form's representation

Parameters:
model - The model containing the appropriate lexica
form - The representation of the form
lang - The languages of the form

getEntriesByFormApprox

public static List<LexicalEntry> getEntriesByFormApprox(LemonModel model,
                                                        String form)
Select a lexical entry by the form's representation, using regex

Parameters:
model - The model containing the appropriate lexica
form - The representation of the form

getEntriesByForm

public static List<LexicalEntry> getEntriesByForm(LemonModel model,
                                                  LexicalForm form)
Select a lexical entry by its form

Parameters:
model - The model containing the appropriate lexica
form - The form object

getLexicaByEntry

public static List<Lexicon> getLexicaByEntry(LemonModel model,
                                             LexicalEntry entry)
Get the set of lexica containing a given entry

Parameters:
model - The model containing the appropriate lexica
entry - The entry

getEntryByReference

public static List<LexicalEntry> getEntryByReference(LemonModel model,
                                                     URI reference)
Get the set of entries that refer to a given reference

Parameters:
model - The model containing the appropriate lexica
reference - The uri reference

getEntryByReference

public static List<LexicalEntry> getEntryByReference(Lexicon lexicon,
                                                     URI reference)

getEntryBySense

public static LexicalEntry getEntryBySense(LemonModel model,
                                           LexicalSense sense)
Get the set of entries that refer to a given sense

Parameters:
model - The model containing the appropriate lexica
sense - The sense object

getEntriesAlphabetic

public static Collection<LexicalEntry> getEntriesAlphabetic(LemonModel model,
                                                            Lexicon lexicon,
                                                            int offset,
                                                            int limit)
Get all the entries in a lexicon as an alphabetic sorted list

Parameters:
model - The model containing the lexica
lexicon - The lexicon to list
offset - The first entry to show
limit - The maximum number of entries to return, 0 for no limit

getEntriesBySense

public static Map<URI,List<LexicalEntry>> getEntriesBySense(LemonModel model,
                                                            Lexicon lexicon,
                                                            int offset,
                                                            int limit)
Get entries in a lexicon mapped by the references they have

Parameters:
model - The model containing all the lexica
lexicon - The lexicon containg all entries
offset - The first entry to return
limit - The maxiumum number of entries to return, 0 for unlimited

getEntriesByFormAndProps

public static List<LexicalEntry> getEntriesByFormAndProps(LemonModel model,
                                                          String form,
                                                          String lang,
                                                          Map<Property,PropertyValue> props)
Get entries by their written representation and properties

Parameters:
model - The model containing all lexica
form - The written representation of the form
lang - The language of the form
props - The set of properties the entry object has

addEntryToLexicon

public static LexicalEntry addEntryToLexicon(Lexicon lexicon,
                                             URI entryURI,
                                             String canForm,
                                             URI senseRef)
Quickly add a lexical entry to a lexicon

Parameters:
Lexicon - The lexicon
entryURI - The identifier for the entry
canForm - The canonical form
sense - The reference of the sense URI

resolveForm

public static LexicalForm resolveForm(LexicalEntry entry,
                                      Map<Property,Collection<PropertyValue>> properties)

sparqlEndpoint

public static LemonModel sparqlEndpoint(URL endpoint,
                                        Set<URI> graphs,
                                        LinguisticOntology lingOnto)
Connect to a lemon model contained in a SPARQL endpoint

Parameters:
endpoint - The URL of the SPARQL endpoint
graphs - The graphs in the endpoint to use
lingOnto - The linguistic ontology to use (may be null)
Returns:
A model which resolves based on the endpoint

sparqlUpdateEndpoint

public static LemonModel sparqlUpdateEndpoint(URL sparqlEndpoint,
                                              URI graph,
                                              LinguisticOntology lingOnto,
                                              String updateEndpoint,
                                              SPARQL dialect)
Connect to a lemon model in a repository supporting SPARQL and SPARQL update

Parameters:
sparqlEndpoint - The URL of the endpoint for querying, e.g., "http://localhost:8080/sparql"
graph - The graph to use in the endpoint
lingOnto - The linguistic ontology to use (may be null)
updateEndpoint - The URL pattern for the endpoint with query, e.g., "http://localhost:8080/sparql-auth?query="
dialect - Which dialect of SPARQL to use, e.g., SPARUL for Virtuoso, SPARQL11 for 4store
Returns:
A model which resolves and updates based on the endpoint

sparqlUpdateEndpoint

public static LemonModel sparqlUpdateEndpoint(URL sparqlEndpoint,
                                              URI graph,
                                              LinguisticOntology lingOnto,
                                              String updateEndpoint,
                                              String username,
                                              String password,
                                              SPARQL dialect)
Connect to a lemon model in a repository supporting SPARQL and SPARQL update

Parameters:
sparqlEndpoint - The URL of the endpoint for querying, e.g., "http://localhost:8080/sparql"
graph - The graph to use in the endpoint
lingOnto - The linguistic ontology to use (may be null)
updateEndpoint - The URL pattern for the endpoint with query, e.g., "http://localhost:8080/sparql-auth?query="
username - The user name to use to authenticate
password - The password to use to authenticate
dialect - Which dialect of SPARQL to use, e.g., SPARUL for Virtuoso, SPARQL11 for 4store
Returns:
A model which resolves and updates based on the endpoint


Copyright © 2012. All Rights Reserved.