org.nlp2rdf.core
Class Text2RDF
java.lang.Object
org.nlp2rdf.core.Text2RDF
public class Text2RDF
- extends Object
- Author:
- Sebastian Hellmann
|
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)
|
|
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)
|
stringOntologyUrl
public static final String stringOntologyUrl
- See Also:
- Constant Field Values
structuredSentenceOntologyUrl
public static final String structuredSentenceOntologyUrl
- See Also:
- Constant Field Values
Text2RDF
public Text2RDF()
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) textspan - the span for the annotationuriGenerator - 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 outmodel -
- 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.