org.nlp2rdf.core.impl
Class MD5Based

java.lang.Object
  extended by org.nlp2rdf.core.impl.AbstractURIGenerator
      extended by org.nlp2rdf.core.impl.MD5Based
All Implemented Interfaces:
URIGenerator

public class MD5Based
extends AbstractURIGenerator
implements URIGenerator

Author:
Sebastian Hellmann

This class implements the NIF Context-Hash URI Scheme. http://nlp2rdf.org/nif-1-0#toc-nif-recipe-context-hash-based-uris The initial contextLength is set to 10

To change this either call init(), which calculates the required minimal contextlength for all uris to be unique for this document. or use the constructor

There is no reason, why this would be threaded, so it is not threadsafe


Field Summary
static String BRA
           
static String IDENTIFIER
           
static String KET
           
 
Constructor Summary
MD5Based()
           
MD5Based(int contextLength)
           
MD5Based(String prefix, com.hp.hpl.jena.ontology.OntModel model)
           
MD5Based(String text, Set<Span> allSpans)
           
 
Method Summary
 void assignRecipeClass(String uri, com.hp.hpl.jena.ontology.OntModel model)
          adds an rdf:type statement to model for the respective recipe
 int getContextLength()
           
 String getRecipeUri()
          This returns the recipe class form the String ontology: http://nlp2rdf.lod2.eu/schema/string/
 Span getSpanFor(String prefix, String uri, String text)
           
 String makeUri(String prefix, String text, Span span)
          Depending on the implementation, it might be necessary to call init before calling this function
 void setContextLength(int contextLength)
           
 void setMinimalContextLength(String text, Set<Span> spans)
           
 
Methods inherited from class org.nlp2rdf.core.impl.AbstractURIGenerator
makeUri
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nlp2rdf.core.URIGenerator
makeUri
 

Field Detail

IDENTIFIER

public static final String IDENTIFIER
See Also:
Constant Field Values

BRA

public static final String BRA
See Also:
Constant Field Values

KET

public static final String KET
See Also:
Constant Field Values
Constructor Detail

MD5Based

public MD5Based()

MD5Based

public MD5Based(int contextLength)

MD5Based

public MD5Based(String text,
                Set<Span> allSpans)

MD5Based

public MD5Based(String prefix,
                com.hp.hpl.jena.ontology.OntModel model)
Method Detail

getRecipeUri

public String getRecipeUri()
Description copied from interface: URIGenerator
This returns the recipe class form the String ontology: http://nlp2rdf.lod2.eu/schema/string/

Specified by:
getRecipeUri in interface URIGenerator
Returns:
a URI from http://nlp2rdf.lod2.eu/schema/string/

assignRecipeClass

public void assignRecipeClass(String uri,
                              com.hp.hpl.jena.ontology.OntModel model)
Description copied from interface: URIGenerator
adds an rdf:type statement to model for the respective recipe

Specified by:
assignRecipeClass in interface URIGenerator

makeUri

public String makeUri(String prefix,
                      String text,
                      Span span)
Description copied from interface: URIGenerator
Depending on the implementation, it might be necessary to call init before calling this function

Specified by:
makeUri in interface URIGenerator
Returns:

setMinimalContextLength

public void setMinimalContextLength(String text,
                                    Set<Span> spans)

getSpanFor

public Span getSpanFor(String prefix,
                       String uri,
                       String text)
Specified by:
getSpanFor in interface URIGenerator
Overrides:
getSpanFor in class AbstractURIGenerator

getContextLength

public int getContextLength()

setContextLength

public void setContextLength(int contextLength)


Copyright © 2011. All Rights Reserved.