be.destin.skos.core
Class SkosManager

java.lang.Object
  extended by be.destin.skos.core.SkosManager

public class SkosManager
extends java.lang.Object

This is the entry point to ASKOSI (Application Services for Knowledge Organization and System Integration). The method SkosManager.getInstance(configurationDirectory) is necessary to get access to the Schemes defined in a specific Configuration Directory. Multiple instances of the SkosManager (and therefore multiple configuration directories) can coexist but they are impervious to each other. The most usefuls methods are:

Author:
Christophe Dupriez

Field Summary
static java.lang.String aboutApplications
          "about" code of the ConceptScheme containing the list of applications documented by this ASKOSI instance.
static java.lang.String aboutCategories
          "about" code of the ConceptScheme containing the list of known categories of records from different applications containing references to Concepts
static java.lang.String aboutExternals
          "about" code of the ConceptScheme containing the list of Schemes NOT managed by ASKOSI but that are used to control metadata (to help transition to integral ASKOSI integration in a system)
static java.lang.String aboutLanguages
          "about" code of the ConceptScheme containing the list of all languages.
static java.lang.String aboutMetaScheme
          "about" code of the virtual Scheme containing the list of schemes loaded by this ASKOSI instance.
static java.lang.String aboutPrefixes
          "about" code of the ConceptScheme containing the list of known prefixes for this ASKOSI instance.
static java.lang.String aboutProfiles
          ASKOSI users profiles with different update rights and viewing preferences.
static java.lang.String aboutRelationQualifiers
          "about" code of the ConceptScheme containing the list of allowed Qualifiers to Relations between Concepts.
static java.lang.String aboutRoles
          "about" code of the ConceptScheme containing the list of possible "roles" (indexes using the ConceptScheme as a search criteria).
static java.lang.String aboutSources
          "about" code of the ConceptScheme containing the list of allowed Sources for Terms within Concepts.
static java.lang.String aboutStatus
          "about" code of the ConceptScheme containing the list of allowed Status for the ASKOSI update workflow
static java.lang.String aboutSuffixes
          "about" code of the ConceptScheme containing the list of known suffixes for this ASKOSI instance.
static java.lang.String aboutUsers
          ASKOSI users
static java.lang.String synonymPrefix
          When displaying the result of search (or autocomplete), prefix to a synonym matching the search criteria and redirecting to the preferred term
 
Method Summary
 Concept findConcept(java.lang.String value, SchemeInterface defScheme, java.util.Set<SchemeInterface> schemes)
          Finds a concept by its code, validating it against a list of schemes it may belong.
 java.lang.String findNamespace(java.lang.String namespace)
           
 ConceptScheme getApplications()
           
 Concept getApplicationScheme_Concept(java.lang.String application, java.lang.String fullHandle, java.lang.String defaultScheme)
           
 ConceptScheme getCategories()
           
 ChangeManager getChangeManager()
           
 java.util.Collection<Concept> getConcept(java.util.Collection<java.lang.String> abouts)
           
 Concept[] getConcept(java.lang.String uri)
          Get all Concepts directly related to the specified Concept.
 ConceptScheme getConceptScheme(java.lang.String uri)
           
 ConceptScheme[] getConceptSchemes()
           
 java.lang.String getConfigDirectory()
           
 java.util.LinkedList<java.lang.String> getDefinedApplicationsList()
           
 java.util.LinkedList<java.lang.String> getDefinedRelationQualifiersList()
           
 java.util.LinkedList<java.lang.String> getDefinedRolesList()
           
 Concept getExternal(java.lang.String externalCode)
           
 SchemeInterface getExternals()
           
static SkosManager getInstance(java.lang.String configDirectory)
          This procedure is the essential entry point to every ASKOSI services.
static java.util.Set<java.lang.String> getInstancesList()
          List configuration directories corresponding to opened SkosManager instances.
 TermList getKeywordMatch(java.lang.String keyword, boolean includeNPT)
           
 SchemeInterface getLanguages()
           
 java.util.ArrayList<Concept> getMatchingConcepts(java.util.Collection<SearchResult> matches)
           
 MetaScheme getMetaScheme()
           
 SchemeInterface getPrefixes()
           
 ConceptScheme getProfiles()
           
 ConceptScheme getRelationQualifiers()
           
 ConceptScheme getRoles()
           
 SchemeInterface getScheme_(java.lang.String fullHandle)
           
 Concept getScheme_Concept(java.lang.String fullHandle)
           
 Concept getScheme_Concept(java.lang.String fullHandle, SchemeInterface defaultScheme)
           
 Concept getScheme_Concept(java.lang.String fullHandle, java.lang.String defListCode)
           
 SchemeInterface getScheme(java.lang.String key)
           
 java.util.Map<java.lang.String,SchemeInterface> getSchemes()
           
 java.util.HashMap<java.lang.String,UrlList> getSearch()
           
 UrlList getSearch(java.lang.String application)
           
 ConceptScheme getSources()
           
 ConceptScheme getStatus()
           
 SchemeInterface getSuffixes()
           
 Concept[] getTopmostConcepts(java.lang.String uri)
          FACET project API
 java.lang.String getUrlRoots(java.lang.String application)
           
 ConceptScheme getUsers()
           
 void initApplication(java.lang.String applicationID, java.lang.String applicationRoot)
           
 SchemeInterface openScheme(java.lang.String about)
           
 boolean putScheme(SchemeInterface scheme)
           
 void putScheme(java.lang.String key, SchemeInterface scheme)
          Record the existence of a Scheme for later accesses.
 void setApplications(SchemeInterface applications)
           
 void setCategories(SchemeInterface categories)
           
 void setExternals(SchemeInterface externals)
           
 void setLanguages(SchemeInterface languages)
           
 void setPrefixes(SchemeInterface prefixes)
           
 void setProfiles(SchemeInterface profiles)
           
 void setRelationQualifiers(SchemeInterface relationQualifiers)
           
 void setRoles(SchemeInterface roles)
           
 void setSources(SchemeInterface sources)
          No foreseen use.
 void setStatus(SchemeInterface statuses)
           
 void setSuffixes(SchemeInterface suffixes)
           
 void setUsers(SchemeInterface users)
           
 java.util.HashSet<java.lang.String> toSetAbout(java.lang.String input)
          Takes any text String and returns a set of the scheme_about codes of the concepts within it.
 java.util.HashSet<Concept> toSetScheme_Concept(java.lang.String input, SchemeInterface defaultList, boolean prefixSuffix)
          Takes any text String and returns a set of concept references within it.
 java.lang.String toSortScheme_Concept(java.lang.String input, java.lang.String language, SchemeInterface defaultList, boolean prefixSuffix)
           
 java.lang.String toStringScheme_Concept(java.lang.String input, java.lang.String language, SchemeInterface defaultList, boolean prefixSuffix)
          Takes any text String, detects concept references within it and translates them with the best prefLabel for the language specified.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aboutMetaScheme

public static final java.lang.String aboutMetaScheme
"about" code of the virtual Scheme containing the list of schemes loaded by this ASKOSI instance.

See Also:
Constant Field Values

aboutPrefixes

public static final java.lang.String aboutPrefixes
"about" code of the ConceptScheme containing the list of known prefixes for this ASKOSI instance. Prefixes are qualifiers in front of a reference to a concept. They are suffixed with an underscore. Example: solo_ instrument_flute or paper_ issn_1234_5678

See Also:
Constant Field Values

aboutSuffixes

public static final java.lang.String aboutSuffixes
"about" code of the ConceptScheme containing the list of known suffixes for this ASKOSI instance. Suffixes are qualifiers following the reference to a concept. They are prefixed with an underscore. Example: instrument_flute _2 or substance_1234567 _poisoning

See Also:
Constant Field Values

aboutExternals

public static final java.lang.String aboutExternals
"about" code of the ConceptScheme containing the list of Schemes NOT managed by ASKOSI but that are used to control metadata (to help transition to integral ASKOSI integration in a system)

See Also:
Constant Field Values

aboutLanguages

public static final java.lang.String aboutLanguages
"about" code of the ConceptScheme containing the list of all languages. Usually based on ISO 2 letters code. Collections like "userLanguage" are often defined to restrict this list for specific situations.

See Also:
Constant Field Values

aboutApplications

public static final java.lang.String aboutApplications
"about" code of the ConceptScheme containing the list of applications documented by this ASKOSI instance.

See Also:
Constant Field Values

aboutRoles

public static final java.lang.String aboutRoles
"about" code of the ConceptScheme containing the list of possible "roles" (indexes using the ConceptScheme as a search criteria).

See Also:
Constant Field Values

aboutRelationQualifiers

public static final java.lang.String aboutRelationQualifiers
"about" code of the ConceptScheme containing the list of allowed Qualifiers to Relations between Concepts. For example: partitive

See Also:
Constant Field Values

aboutCategories

public static final java.lang.String aboutCategories
"about" code of the ConceptScheme containing the list of known categories of records from different applications containing references to Concepts

See Also:
Constant Field Values

aboutProfiles

public static final java.lang.String aboutProfiles
ASKOSI users profiles with different update rights and viewing preferences. A given user may have access to different profiles

See Also:
Constant Field Values

aboutUsers

public static final java.lang.String aboutUsers
ASKOSI users

See Also:
Constant Field Values

aboutSources

public static final java.lang.String aboutSources
"about" code of the ConceptScheme containing the list of allowed Sources for Terms within Concepts. For example: INN, USAN, etc.

See Also:
Constant Field Values

aboutStatus

public static final java.lang.String aboutStatus
"about" code of the ConceptScheme containing the list of allowed Status for the ASKOSI update workflow

See Also:
Constant Field Values

synonymPrefix

public static final java.lang.String synonymPrefix
When displaying the result of search (or autocomplete), prefix to a synonym matching the search criteria and redirecting to the preferred term

See Also:
Constant Field Values
Method Detail

getInstance

public static SkosManager getInstance(java.lang.String configDirectory)
This procedure is the essential entry point to every ASKOSI services. It identifies the set of schemes one wishes to access using the directory where their configurations are stored.

Parameters:
configDirectory - the precise path (case sensitive) where the configurations of ASKOSI Concept Schemes are stored. Usually, the same directory for all applications sharing those schemes.
Returns:
the SkosManager instance that can be used for all ASKOSI services accesses.

getConcept

public Concept[] getConcept(java.lang.String uri)
Get all Concepts directly related to the specified Concept. Returns an array of ConceptRelative objects. NOT IMPLEMENTED and previous implementors have disappeared!

Parameters:
uri -
Returns:
public ConceptRelative[] getAllConceptRelatives(String uri)

getConcept

public java.util.Collection<Concept> getConcept(java.util.Collection<java.lang.String> abouts)
Parameters:
abouts -
Returns:

getMatchingConcepts

public java.util.ArrayList<Concept> getMatchingConcepts(java.util.Collection<SearchResult> matches)

getConceptScheme

public ConceptScheme getConceptScheme(java.lang.String uri)

getConceptSchemes

public ConceptScheme[] getConceptSchemes()

getExternal

public Concept getExternal(java.lang.String externalCode)

getExternals

public SchemeInterface getExternals()
Returns:
the externals

getKeywordMatch

public TermList getKeywordMatch(java.lang.String keyword,
                                boolean includeNPT)

getPrefixes

public SchemeInterface getPrefixes()
Returns:
the prefixes

getScheme

public SchemeInterface getScheme(java.lang.String key)
Parameters:
key: - code of the list to access
Returns:

getLanguages

public SchemeInterface getLanguages()
Returns:
the languages

setLanguages

public void setLanguages(SchemeInterface languages)
Parameters:
languages - the languages to set

getScheme_Concept

public Concept getScheme_Concept(java.lang.String fullHandle,
                                 SchemeInterface defaultScheme)

getScheme_Concept

public Concept getScheme_Concept(java.lang.String fullHandle)

getScheme_Concept

public Concept getScheme_Concept(java.lang.String fullHandle,
                                 java.lang.String defListCode)

getScheme_

public SchemeInterface getScheme_(java.lang.String fullHandle)

getApplicationScheme_Concept

public Concept getApplicationScheme_Concept(java.lang.String application,
                                            java.lang.String fullHandle,
                                            java.lang.String defaultScheme)

getSchemes

public java.util.Map<java.lang.String,SchemeInterface> getSchemes()
Returns:
the schemes

getSuffixes

public SchemeInterface getSuffixes()
Returns:
the suffixes

getTopmostConcepts

public Concept[] getTopmostConcepts(java.lang.String uri)
FACET project API


initApplication

public void initApplication(java.lang.String applicationID,
                            java.lang.String applicationRoot)

openScheme

public SchemeInterface openScheme(java.lang.String about)

putScheme

public boolean putScheme(SchemeInterface scheme)

findNamespace

public java.lang.String findNamespace(java.lang.String namespace)

putScheme

public void putScheme(java.lang.String key,
                      SchemeInterface scheme)
Record the existence of a Scheme for later accesses. Ensures the "about" code of the Scheme is set to key.

Parameters:
key - "about" code of the scheme to record
scheme - scheme object to record

setExternals

public void setExternals(SchemeInterface externals)
Parameters:
externals - the externals to set

setPrefixes

public void setPrefixes(SchemeInterface prefixes)
Parameters:
prefixes - the prefixes to set

setSuffixes

public void setSuffixes(SchemeInterface suffixes)
Parameters:
suffixes - the suffixes to set

findConcept

public Concept findConcept(java.lang.String value,
                           SchemeInterface defScheme,
                           java.util.Set<SchemeInterface> schemes)
Finds a concept by its code, validating it against a list of schemes it may belong. Concept from the Prefix or the Suffix schemes (conceptCode_ or _conceptCode)are always allowed.

Parameters:
value - Code to translate
defScheme - Default scheme if the code is not prefixed by its scheme code. May be null.
schemes - List of the schemes to which the concept is allowed to pertain
Returns:
the Concept for the provided code

toStringScheme_Concept

public java.lang.String toStringScheme_Concept(java.lang.String input,
                                               java.lang.String language,
                                               SchemeInterface defaultList,
                                               boolean prefixSuffix)
Takes any text String, detects concept references within it and translates them with the best prefLabel for the language specified. Concept references "candidates" are any word containing an underscore. Unfound "candidates" are left as is.

Parameters:
input - Text to analyze
language - User language
defaultList - Not useful: null recommended. Default scheme if the code is not prefixed by its scheme code (but contains an underscore!)
prefixSuffix - Does prefix (prefixCode_) or suffix (_suffixCode) should be detected?
Returns:
The text with concept codes translated for the user.

toSetScheme_Concept

public java.util.HashSet<Concept> toSetScheme_Concept(java.lang.String input,
                                                      SchemeInterface defaultList,
                                                      boolean prefixSuffix)
Takes any text String and returns a set of concept references within it. Concept references "candidates" are any word containing an underscore. Unfound "candidates" are not returned.

Parameters:
input - Text to analyze
defaultList - Not useful: null recommended. Default scheme if the code is not prefixed by its scheme code (but contains an underscore!)
prefixSuffix - Does prefix (prefixCode_) or suffix (_suffixCode) should be detected?
Returns:
Set of found Concepts

toSetAbout

public java.util.HashSet<java.lang.String> toSetAbout(java.lang.String input)
Takes any text String and returns a set of the scheme_about codes of the concepts within it. Concept references "candidates" are any word containing an underscore. Unfound "candidates" are not returned. Prefixes and suffixes are always ignored.

Parameters:
input - Text to analyze
Returns:
Set of found Concepts

getConfigDirectory

public java.lang.String getConfigDirectory()
Returns:
the configuration directory for this SkosManager Instance

getApplications

public ConceptScheme getApplications()
Returns:
the ConceptScheme defining the applications for this SkosManager Instance

setApplications

public void setApplications(SchemeInterface applications)
Parameters:
applications - the applications to set

getRoles

public ConceptScheme getRoles()
Returns:
the roles

setRoles

public void setRoles(SchemeInterface roles)
Parameters:
roles - the roles to set

getRelationQualifiers

public ConceptScheme getRelationQualifiers()
Returns:
the roles

setRelationQualifiers

public void setRelationQualifiers(SchemeInterface relationQualifiers)

getStatus

public ConceptScheme getStatus()
Returns:
the roles

setStatus

public void setStatus(SchemeInterface statuses)

getDefinedApplicationsList

public java.util.LinkedList<java.lang.String> getDefinedApplicationsList()

getDefinedRolesList

public java.util.LinkedList<java.lang.String> getDefinedRolesList()

getDefinedRelationQualifiersList

public java.util.LinkedList<java.lang.String> getDefinedRelationQualifiersList()

getSearch

public java.util.HashMap<java.lang.String,UrlList> getSearch()

getSearch

public UrlList getSearch(java.lang.String application)

getCategories

public ConceptScheme getCategories()
Returns:
the categories

setCategories

public void setCategories(SchemeInterface categories)
Parameters:
categories - the categories to set

getProfiles

public ConceptScheme getProfiles()

setProfiles

public void setProfiles(SchemeInterface profiles)

getUsers

public ConceptScheme getUsers()

setUsers

public void setUsers(SchemeInterface users)

getUrlRoots

public java.lang.String getUrlRoots(java.lang.String application)
Returns:
the urlRoots

toSortScheme_Concept

public java.lang.String toSortScheme_Concept(java.lang.String input,
                                             java.lang.String language,
                                             SchemeInterface defaultList,
                                             boolean prefixSuffix)
Parameters:
input -
language -
defaultList -
prefixSuffix -
Returns:

getChangeManager

public ChangeManager getChangeManager()
Returns:

getMetaScheme

public MetaScheme getMetaScheme()
Returns:
a Scheme with one Concept per Scheme loaded in this instance of ASKOSI

getSources

public ConceptScheme getSources()
Returns:
the ConceptScheme with the known sources for the terms of the different ConceptSchemes

setSources

public void setSources(SchemeInterface sources)
No foreseen use. Set the ConceptScheme with the known sources for the terms of the different ConceptSchemes

Parameters:
sources -

getInstancesList

public static java.util.Set<java.lang.String> getInstancesList()
List configuration directories corresponding to opened SkosManager instances.

Returns:
Set of configuration directories. Beware: later accesses are lower/upper case dependent.