org.dllearner.utilities
Class Helper

java.lang.Object
  extended by org.dllearner.utilities.Helper

public class Helper
extends Object

TODO: JavaDoc

Author:
Jens Lehmann

Constructor Summary
Helper()
           
 
Method Summary
static
<T1,T2> void
addMapEntry(Map<T1,SortedSet<T2>> map, T1 keyEntry, T2 setEntry)
           
static String arrayContent(int[] ar)
           
static NamedClass checkConcepts(AbstractReasonerComponent rs, Set<NamedClass> concepts)
          Checks whether the roles exist in background knowledge
static ObjectProperty checkRoles(AbstractReasonerComponent rs, Set<ObjectProperty> roles)
          Checks whether the roles exist in background knowledge
static Set<NamedClass> computeConcepts(AbstractReasonerComponent rs)
           
static Set<NamedClass> computeConceptsUsingIgnoreList(AbstractReasonerComponent rs, Set<NamedClass> ignoredConcepts)
           
static FlatABox createFlatABox(AbstractReasonerComponent rs)
           
static
<T> Set<T>
difference(Set<T> set1, Set<T> set2)
           
static
<T> SortedSet<T>
difference(SortedSet<T> set1, SortedSet<T> set2)
           
static String getAbbreviatedCollection(Collection<String> list, String baseURI, Map<String,String> prefixes)
          Transforms a list of URIs into their abbreviated version.
static String getAbbreviatedString(String uri, String baseURI, Map<String,String> prefixes)
          Transforms an URI to an abbreviated version, e.g. if the base URI is "http://example.com/" and the uri is "http://example.com/test", then "test" is returned.
static List<NamedClass> getAtomicConcepts(Description concept)
           
static List<ObjectProperty> getAtomicRoles(Description concept)
           
static SortedSet<Individual> getIndividualSet(Set<String> individuals)
           
static SortedSetTuple<Individual> getIndividualTuple(SortedSetTuple<String> tuple)
           
static Map<String,SortedSet<String>> getStringMap(Map<Individual,SortedSet<Individual>> roleMembers)
           
static SortedSet<String> getStringSet(Set<Individual> individuals)
           
static SortedSetTuple<String> getStringTuple(SortedSetTuple<Individual> tuple)
           
static
<T> SortedSet<T>
intersection(SortedSet<T> set1, SortedSet<T> set2)
           
static
<T> SortedSet<T>
intersectionTuple(SortedSet<T> set, SortedSetTuple<T> tuple)
           
static String prettyPrintMilliSeconds(long milliSeconds)
           
static String prettyPrintNanoSeconds(long nanoSeconds)
           
static String prettyPrintNanoSeconds(long nanoSeconds, boolean printMicros, boolean printNanos)
           
static void removeUninterestingConcepts(Set<NamedClass> concepts)
          Deprecated. Deprecated method, because it is not needed anymore.
static
<T> Set<T>
union(Set<T> set1, Set<T> set2)
          Das ist eine "generic method", d.h. die Methode hat einen bestimmten Typ.
static
<T> SortedSet<T>
union(SortedSet<T> set1, SortedSet<T> set2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Helper

public Helper()
Method Detail

getAtomicConcepts

public static List<NamedClass> getAtomicConcepts(Description concept)

getAtomicRoles

public static List<ObjectProperty> getAtomicRoles(Description concept)

getAbbreviatedString

public static String getAbbreviatedString(String uri,
                                          String baseURI,
                                          Map<String,String> prefixes)
Transforms an URI to an abbreviated version, e.g. if the base URI is "http://example.com/" and the uri is "http://example.com/test", then "test" is returned. If the the uri is "http://anotherexample.com/test2" and a prefix "ns1" is given for "http://anotherexample.com", then "ns1:test2" is returned. If there is no match, uri is returned.

Parameters:
uri - The full uri, which should be transformed to an abbreviated version.
baseURI - The base uri (ignored if null).
prefixes - A prefix map (ignored if null), where each entry contains a short string e.g. ns1 as key and the corresponding uri as value.
Returns:
Abbreviated version of the parameter uri.

getAbbreviatedCollection

public static String getAbbreviatedCollection(Collection<String> list,
                                              String baseURI,
                                              Map<String,String> prefixes)
Transforms a list of URIs into their abbreviated version.

Parameters:
list - List of URIs.
baseURI - The base uri (ignored if null).
prefixes - A prefix map (ignored if null), where each entry contains a short string e.g. ns1 as key and the corresponding uri as value.
Returns:
A list with shortened URIs.
See Also:
getAbbreviatedString(String, String, Map)

prettyPrintNanoSeconds

public static String prettyPrintNanoSeconds(long nanoSeconds)

prettyPrintNanoSeconds

public static String prettyPrintNanoSeconds(long nanoSeconds,
                                            boolean printMicros,
                                            boolean printNanos)

prettyPrintMilliSeconds

public static String prettyPrintMilliSeconds(long milliSeconds)

addMapEntry

public static <T1,T2> void addMapEntry(Map<T1,SortedSet<T2>> map,
                                       T1 keyEntry,
                                       T2 setEntry)

union

public static <T> Set<T> union(Set<T> set1,
                               Set<T> set2)
Das ist eine "generic method", d.h. die Methode hat einen bestimmten Typ. Ich habe das benutzt um allen beteiligten Mengen den gleichen Typ zu geben, denn ansonsten ist es nicht möglich der neu zu erzeugenden Menge (union) den gleichen Typ wie den Argumenten zu geben. Die Methode hat gegenüber addAll den Vorteil, dass sie ein neues Objekt erzeugt.

Type Parameters:
T -
Parameters:
set1 -
set2 -

union

public static <T> SortedSet<T> union(SortedSet<T> set1,
                                     SortedSet<T> set2)

intersection

public static <T> SortedSet<T> intersection(SortedSet<T> set1,
                                            SortedSet<T> set2)

intersectionTuple

public static <T> SortedSet<T> intersectionTuple(SortedSet<T> set,
                                                 SortedSetTuple<T> tuple)

difference

public static <T> SortedSet<T> difference(SortedSet<T> set1,
                                          SortedSet<T> set2)

difference

public static <T> Set<T> difference(Set<T> set1,
                                    Set<T> set2)

getIndividualSet

public static SortedSet<Individual> getIndividualSet(Set<String> individuals)

getIndividualTuple

public static SortedSetTuple<Individual> getIndividualTuple(SortedSetTuple<String> tuple)

getStringTuple

public static SortedSetTuple<String> getStringTuple(SortedSetTuple<Individual> tuple)

getStringSet

public static SortedSet<String> getStringSet(Set<Individual> individuals)

getStringMap

public static Map<String,SortedSet<String>> getStringMap(Map<Individual,SortedSet<Individual>> roleMembers)

removeUninterestingConcepts

@Deprecated
public static void removeUninterestingConcepts(Set<NamedClass> concepts)
Deprecated. Deprecated method, because it is not needed anymore.

Removes concepts, which should be ignored by the learning algorithm. (The main reason to use this method is because Jena introduces such concepts when ontologies are converted to DIG.) Currently ignored concepts are those having prefix "anon" and concepts belonging to the RDF, RDFS, OWL standards.

Parameters:
concepts - The set from which concepts will be removed.

computeConcepts

public static Set<NamedClass> computeConcepts(AbstractReasonerComponent rs)

computeConceptsUsingIgnoreList

public static Set<NamedClass> computeConceptsUsingIgnoreList(AbstractReasonerComponent rs,
                                                             Set<NamedClass> ignoredConcepts)

checkRoles

public static ObjectProperty checkRoles(AbstractReasonerComponent rs,
                                        Set<ObjectProperty> roles)
Checks whether the roles exist in background knowledge

Parameters:
roles - The roles to check.
Returns:
The first non-existing role or null if they are all in the background knowledge.

checkConcepts

public static NamedClass checkConcepts(AbstractReasonerComponent rs,
                                       Set<NamedClass> concepts)
Checks whether the roles exist in background knowledge

Parameters:
concepts - The concepts to check.
Returns:
The first non-existing role or null if they are all in the background knowledge.

createFlatABox

public static FlatABox createFlatABox(AbstractReasonerComponent rs)
                               throws ReasoningMethodUnsupportedException
Throws:
ReasoningMethodUnsupportedException

arrayContent

public static String arrayContent(int[] ar)


SourceForge.net Logo DL-Learner is licenced under the terms of the GNU General Public License.
Copyright © 2007-2011 Jens Lehmann