org.aksw.commons.util
Class Prefixer

java.lang.Object
  extended by org.aksw.commons.util.Prefixer

public class Prefixer
extends Object

Note this class is supposed to use certain terminology: uri - the full uri http://dbpedia.org/resource/London prefix - the shortcut canonical to prefix.cc namespace - the "common part" of uris, e.g. http://dbpedia.org/resource/ prefixedUri - namespace replaced with prefix: dbpedia:London NOTE: to use a base prefix add an empty prefix to the map: ""->"http://dbpedia.org/resource/" NOTE: Currently no order is used, namespaces could include other namespaces Created by Sebastian Hellmann - http://bis.informatik.uni-leipzig.de/SebastianHellmann A class for handling prefixes Date: 28.01.11


Constructor Summary
Prefixer()
           
Prefixer(Map<String,String> prefixToNamespace, boolean appendPopularPrefixes)
           
 
Method Summary
 String nicen(String uri)
          http://dbpedia.org/resource/J%C3%BCrgen_Prochnow will be rendered as: Jürgen Prochnow by the following operations: - strip namespace - urldecode - replace _ by whitespace
 String prefixUri(String uri)
          http://dbpedia.org/resource/London -> dbpedia:London
 void setPrefixToNamespace(Map<String,String> prefixToNamespace)
          resets everything
 String stripNamespace(String uri)
          this function calls stripNamespace(uri, true);
 String stripNamespace(String uri, boolean useHeuristic)
          strips the namespace, either by base or known prefix or a heuristic
static String stripNamespaceHeuristic(String uri)
          currently implemented to cut after the last # or if not available after the last /
 Map<String,String> theMostPopulars()
           
 String toSparqlPrefix()
          NOTE base recognition is not implemented
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Prefixer

public Prefixer()

Prefixer

public Prefixer(Map<String,String> prefixToNamespace,
                boolean appendPopularPrefixes)
Method Detail

setPrefixToNamespace

public void setPrefixToNamespace(Map<String,String> prefixToNamespace)
resets everything

Parameters:
prefixToNamespace -

theMostPopulars

public Map<String,String> theMostPopulars()

toSparqlPrefix

public String toSparqlPrefix()
NOTE base recognition is not implemented

Returns:

nicen

public String nicen(String uri)
http://dbpedia.org/resource/J%C3%BCrgen_Prochnow will be rendered as: Jürgen Prochnow by the following operations: - strip namespace - urldecode - replace _ by whitespace

Parameters:
uri -
Returns:

stripNamespace

public String stripNamespace(String uri)
this function calls stripNamespace(uri, true);

Parameters:
uri -
Returns:

stripNamespace

public String stripNamespace(String uri,
                             boolean useHeuristic)
strips the namespace, either by base or known prefix or a heuristic

Parameters:
uri - e.g. http://dbpedia.org/resource/London
useHeuristic - if true
Returns:
The stripped uri, i.e. London

stripNamespaceHeuristic

public static String stripNamespaceHeuristic(String uri)
currently implemented to cut after the last # or if not available after the last /

Parameters:
uri - e.g. http://dbpedia.org/resource/
Returns:
e.g. London

prefixUri

public String prefixUri(String uri)
http://dbpedia.org/resource/London -> dbpedia:London

Parameters:
uri -
Returns:
The prefixed URI, or the full uri, if no prefix was found


Copyright © 2012. All Rights Reserved.