Package com.tagtraum.genres.rdf
Class TagtraumLocalizedOntology
- java.lang.Object
-
- com.tagtraum.genres.rdf.TagtraumLocalizedOntology
-
- All Implemented Interfaces:
GenreOntology
public class TagtraumLocalizedOntology extends Object implements GenreOntology
Ontology that's specific to aLocale
. In case the desired locale is not supported, the English ontology is returned by default.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description TagtraumLocalizedOntology()
TagtraumLocalizedOntology(Locale locale)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getDepth()
Number of hierarchy levels in this ontology.Collection<AudioGenre>
getGenres()
Collection of all genres contained in this ontology.Set<AudioGenre>
getGenres(String label)
Return the genre(s) registered under the given label.Set<AudioGenre>
getGenres(String label, Collection<GenreOntology> secondaryOntologies)
Return the genre(s) registered under the given label.AudioGenre
getGenreWithIRI(String iri)
Returns a genre with the given IRI.Set<String>
getLabels()
Set of all genre labels.String
toString()
-
-
-
Constructor Detail
-
TagtraumLocalizedOntology
public TagtraumLocalizedOntology() throws IOException
- Throws:
IOException
-
TagtraumLocalizedOntology
public TagtraumLocalizedOntology(Locale locale) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getGenres
public Collection<AudioGenre> getGenres()
Description copied from interface:GenreOntology
Collection of all genres contained in this ontology.- Specified by:
getGenres
in interfaceGenreOntology
- Returns:
- genres
-
getGenres
public Set<AudioGenre> getGenres(String label)
Description copied from interface:GenreOntology
Return the genre(s) registered under the given label. Due to ambiguities having to do with translations, this method may return more than one genre.- Specified by:
getGenres
in interfaceGenreOntology
- Parameters:
label
- label- Returns:
- set of mapped genres
-
getGenreWithIRI
public AudioGenre getGenreWithIRI(String iri)
Description copied from interface:GenreOntology
Returns a genre with the given IRI.- Specified by:
getGenreWithIRI
in interfaceGenreOntology
- Parameters:
iri
- IRI- Returns:
- the requested genre
-
getLabels
public Set<String> getLabels()
Description copied from interface:GenreOntology
Set of all genre labels.- Specified by:
getLabels
in interfaceGenreOntology
- Returns:
- labels
-
getDepth
public int getDepth()
Description copied from interface:GenreOntology
Number of hierarchy levels in this ontology. An ontology with one or more members has at least the depth1
. An empty ontology has the depth0
.- Specified by:
getDepth
in interfaceGenreOntology
- Returns:
- depth
-
getGenres
public Set<AudioGenre> getGenres(String label, Collection<GenreOntology> secondaryOntologies)
Description copied from interface:GenreOntology
Return the genre(s) registered under the given label. If the label is not found in this ontology, secondary ontologies may be used to look up genre ids, which in turn are looked up in this ontology. Therefore genres may be found, which aren't found just by looking up the label alone.
Due to ambiguities having to do with translations, this method may return more than one genre.
- Specified by:
getGenres
in interfaceGenreOntology
- Parameters:
label
- genre labelsecondaryOntologies
- secondary ontologies which may be used to lookup ids, if a match cannot be found right away. The ids are in turn looked up in this ontology- Returns:
- set of genres or the empty set
-
-