org.nlp2rdf.core
Class Text2RDF

java.lang.Object
  extended by org.nlp2rdf.core.Text2RDF

public class Text2RDF
extends Object

Author:
Sebastian Hellmann

Field Summary
static String stringOntologyUrl
           
static String structuredSentenceOntologyUrl
           
 
Constructor Summary
Text2RDF()
           
 
Method Summary
 void addCopyOfOLiAClassesAndHierarchy(OLiAOntology olia, com.hp.hpl.jena.ontology.OntModel model)
           
 void addNextAndPreviousProperties(String prefix, String text, URIGenerator uriGenerator, com.hp.hpl.jena.ontology.OntModel model)
           
 Document createDocumentAnnotation(String prefix, String text, URIGenerator uriGenerator, com.hp.hpl.jena.ontology.OntModel model)
           
<S> S
createStringAnnotationForClass(Class<S> cl, String prefix, String text, Span span, URIGenerator uriGenerator, com.hp.hpl.jena.ontology.OntModel model)
          This is a convenience function, which does quite a lot: 1.
 com.hp.hpl.jena.ontology.OntModel generateNIFModel(String prefix, String text, TreeMap<Span,List<Span>> tokenizedText, URIGenerator uriGenerator, Document document, com.hp.hpl.jena.ontology.OntModel model)
          adds sso:Sentence and sso:Word to it adds the word property and additionally, though optional, the firstWord and lastWord property

Note that the expected tokenizer matches the opennlp tokenizer well, so instead of forcing a tokenizer to match the interface it might be smarter to rewrite this method.

 TreeMap<Span,List<Span>> getTokenization(String prefix, String text, URIGenerator uriGenerator, com.hp.hpl.jena.ontology.OntModel model)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stringOntologyUrl

public static final String stringOntologyUrl
See Also:
Constant Field Values

structuredSentenceOntologyUrl

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

Text2RDF

public Text2RDF()
Method Detail

createDocumentAnnotation

public Document createDocumentAnnotation(String prefix,
                                         String text,
                                         URIGenerator uriGenerator,
                                         com.hp.hpl.jena.ontology.OntModel model)
Parameters:
prefix -
text -
uriGenerator -
model -
Returns:

createStringAnnotationForClass

public <S> S createStringAnnotationForClass(Class<S> cl,
                                            String prefix,
                                            String text,
                                            Span span,
                                            URIGenerator uriGenerator,
                                            com.hp.hpl.jena.ontology.OntModel model)
This is a convenience function, which does quite a lot: 1. generates the uri 2. add the recipe class, i.e. OffsetBased or ContexthashBased 3. adds the class which is given in class (must mbe from owl2java) 4. adds the anchorOf annotation Note: all changes are also reflected in model Note: if something goes wrong this method catches all exceptions, logs it and then re throws it as a runtime exception

Type Parameters:
S -
Parameters:
cl -
prefix -
text - the whole (reference) text
span - the span for the annotation
uriGenerator -
model -
Returns:
the Jena Individual with the Type give in cl

generateNIFModel

public com.hp.hpl.jena.ontology.OntModel generateNIFModel(String prefix,
                                                          String text,
                                                          TreeMap<Span,List<Span>> tokenizedText,
                                                          URIGenerator uriGenerator,
                                                          Document document,
                                                          com.hp.hpl.jena.ontology.OntModel model)
adds sso:Sentence and sso:Word to it adds the word property and additionally, though optional, the firstWord and lastWord property

Note that the expected tokenizer matches the opennlp tokenizer well, so instead of forcing a tokenizer to match the interface it might be smarter to rewrite this method.

Parameters:
prefix -
text -
tokenizedText -
uriGenerator -
document - use null if you want to opt out
model -
Returns:
the model filled with NIF

getTokenization

public TreeMap<Span,List<Span>> getTokenization(String prefix,
                                                String text,
                                                URIGenerator uriGenerator,
                                                com.hp.hpl.jena.ontology.OntModel model)

addNextAndPreviousProperties

public void addNextAndPreviousProperties(String prefix,
                                         String text,
                                         URIGenerator uriGenerator,
                                         com.hp.hpl.jena.ontology.OntModel model)

addCopyOfOLiAClassesAndHierarchy

public void addCopyOfOLiAClassesAndHierarchy(OLiAOntology olia,
                                             com.hp.hpl.jena.ontology.OntModel model)


Copyright © 2011. All Rights Reserved.