You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by re...@apache.org on 2016/05/17 22:20:55 UTC
svn commit: r1744328 [12/24] - in /stanbol/trunk: ./
commons/indexedgraph/src/main/java/org/apache/stanbol/commons/indexedgraph/
commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/
commons/installer/bundleprovider/src/main/java/...
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/Nif20.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/Nif20.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/Nif20.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/Nif20.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.nif;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.nlp.pos.LexicalCategory;
import org.apache.stanbol.enhancer.nlp.pos.Pos;
@@ -523,17 +523,17 @@ public enum Nif20 {
;
public final static String NAMESPACE = "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#";
- UriRef uri;
+ IRI uri;
private Nif20() {
- uri = new UriRef(NAMESPACE+name());
+ uri = new IRI(NAMESPACE+name());
}
public String getLocalName(){
return name();
}
- public UriRef getUri(){
+ public IRI getUri(){
return uri;
}
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/SsoOntology.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/SsoOntology.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/SsoOntology.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/SsoOntology.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.nif;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
public enum SsoOntology {
/**
@@ -73,17 +73,17 @@ public enum SsoOntology {
;
public final static String NAMESPACE = "http://nlp2rdf.lod2.eu/schema/sso/";
- UriRef uri;
+ IRI uri;
private SsoOntology() {
- uri = new UriRef(NAMESPACE+name());
+ uri = new IRI(NAMESPACE+name());
}
public String getLocalName(){
return name();
}
- public UriRef getUri(){
+ public IRI getUri(){
return uri;
}
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/StringOntology.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/StringOntology.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/StringOntology.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/nif/StringOntology.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.nif;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.nlp.utils.NIFHelper;
public enum StringOntology {
@@ -24,7 +24,7 @@ public enum StringOntology {
* The URI of this String was created with the URI Recipe Context-Hash, see
* http://aksw.org/Projects/NIF#context-hash-nif-uri-recipe.
*
- * @see NIFHelper#getNifHashURI(UriRef, int, int, String)
+ * @see NIFHelper#getNifHashURI(IRI, int, int, String)
*/
ContextHashBasedString,
/**
@@ -33,7 +33,7 @@ public enum StringOntology {
* be a string, a HTML document, a PDF document, text file or any other arbitrary string. The uri denoting
* the actual document should be able to reproduce that document, i.e. either the string is directly
* included via the property sourceString or an url can be given that contains the string via the property
- * sourceUrl. Depending on the feedback, this might also become the Graph URI or a subclass of
+ * sourceUrl. Depending on the feedback, this might also become the ImmutableGraph URI or a subclass of
* owl:Ontology
*/
Document,
@@ -90,17 +90,17 @@ public enum StringOntology {
sourceString;
public final static String NAMESPACE = "http://nlp2rdf.lod2.eu/schema/string/";
- UriRef uri;
+ IRI uri;
private StringOntology() {
- uri = new UriRef(NAMESPACE + name());
+ uri = new IRI(NAMESPACE + name());
}
public String getLocalName() {
return name();
}
- public UriRef getUri() {
+ public IRI getUri() {
return uri;
}
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/ontology/SsoOntology.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/ontology/SsoOntology.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/ontology/SsoOntology.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/ontology/SsoOntology.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.ontology;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
public enum SsoOntology {
/**
@@ -73,17 +73,17 @@ public enum SsoOntology {
;
public final static String NAMESPACE = "http://nlp2rdf.lod2.eu/schema/sso/";
- UriRef uri;
+ IRI uri;
private SsoOntology() {
- uri = new UriRef(NAMESPACE+name());
+ uri = new IRI(NAMESPACE+name());
}
public String getLocalName(){
return name();
}
- public UriRef getUri(){
+ public IRI getUri(){
return uri;
}
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/ontology/StringOntology.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/ontology/StringOntology.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/ontology/StringOntology.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/ontology/StringOntology.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.ontology;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.nlp.utils.NIFHelper;
public enum StringOntology {
@@ -24,7 +24,7 @@ public enum StringOntology {
* The URI of this String was created with the URI Recipe Context-Hash, see
* http://aksw.org/Projects/NIF#context-hash-nif-uri-recipe.
*
- * @see NIFHelper#getNifHashURI(UriRef, int, int, String)
+ * @see NIFHelper#getNifHashURI(IRI, int, int, String)
*/
ContextHashBasedString,
/**
@@ -33,7 +33,7 @@ public enum StringOntology {
* be a string, a HTML document, a PDF document, text file or any other arbitrary string. The uri denoting
* the actual document should be able to reproduce that document, i.e. either the string is directly
* included via the property sourceString or an url can be given that contains the string via the property
- * sourceUrl. Depending on the feedback, this might also become the Graph URI or a subclass of
+ * sourceUrl. Depending on the feedback, this might also become the ImmutableGraph URI or a subclass of
* owl:Ontology
*/
Document,
@@ -90,17 +90,17 @@ public enum StringOntology {
sourceString;
public final static String NAMESPACE = "http://nlp2rdf.lod2.eu/schema/string/";
- UriRef uri;
+ IRI uri;
private StringOntology() {
- uri = new UriRef(NAMESPACE + name());
+ uri = new IRI(NAMESPACE + name());
}
public String getLocalName() {
return name();
}
- public UriRef getUri() {
+ public IRI getUri() {
return uri;
}
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/LexicalCategory.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/LexicalCategory.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/LexicalCategory.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/LexicalCategory.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.pos;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
/**
* Lexical categories used by the Stanbol Enhancer NLP module. Defined based on the top level
@@ -112,13 +112,13 @@ public enum LexicalCategory {
;
static final String OLIA_NAMESPACE = "http://purl.org/olia/olia.owl#";
- UriRef uri;
+ IRI uri;
LexicalCategory() {
- this.uri = new UriRef(OLIA_NAMESPACE + name());
+ this.uri = new IRI(OLIA_NAMESPACE + name());
}
- public UriRef getUri() {
+ public IRI getUri() {
return uri;
}
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/Pos.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/Pos.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/Pos.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/Pos.java Tue May 17 22:20:49 2016
@@ -27,7 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.nlp.morpho.Tense;
import com.ibm.icu.impl.Punycode;
@@ -1995,7 +1995,7 @@ public enum Pos {
private final Set<LexicalCategory> categories;
private final Collection<Pos> parents;
- private final UriRef uri;
+ private final IRI uri;
Pos(LexicalCategory category) {
this(null, category, (LexicalCategory) null);
@@ -2006,7 +2006,7 @@ public enum Pos {
}
Pos(String name, LexicalCategory category, LexicalCategory additional) {
- this.uri = new UriRef(OLIA_NAMESPACE + (name == null ? name() : name));
+ this.uri = new IRI(OLIA_NAMESPACE + (name == null ? name() : name));
categories = EnumSet.of(category);
if (additional != null) {
categories.add(additional);
@@ -2027,7 +2027,7 @@ public enum Pos {
}
Pos(String name, LexicalCategory category, Pos... parent) {
- this.uri = new UriRef(OLIA_NAMESPACE + (name == null ? name() : name));
+ this.uri = new IRI(OLIA_NAMESPACE + (name == null ? name() : name));
this.parents = parent == null || parent.length < 1 ? Collections.EMPTY_SET : Arrays.asList(parent);
categories = category == null ? EnumSet.noneOf(LexicalCategory.class) : EnumSet.of(category);
Set<Pos> toProcess = new HashSet<Pos>(parents);
@@ -2052,7 +2052,7 @@ public enum Pos {
return parents;
}
- public UriRef getUri() {
+ public IRI getUri() {
return uri;
}
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/English.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/English.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/English.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/English.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.pos.olia;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.nlp.model.tag.TagSet;
import org.apache.stanbol.enhancer.nlp.pos.LexicalCategory;
import org.apache.stanbol.enhancer.nlp.pos.Pos;
@@ -40,9 +40,9 @@ public final class English {
static {
//TODO: define constants for annotation model and linking model
PENN_TREEBANK.getProperties().put("olia.annotationModel",
- new UriRef("http://purl.org/olia/penn.owl"));
+ new IRI("http://purl.org/olia/penn.owl"));
PENN_TREEBANK.getProperties().put("olia.linkingModel",
- new UriRef("http://purl.org/olia/penn-link.rdf"));
+ new IRI("http://purl.org/olia/penn-link.rdf"));
PENN_TREEBANK.addTag(new PosTag("CC", Pos.CoordinatingConjunction));
PENN_TREEBANK.addTag(new PosTag("CD",Pos.CardinalNumber));
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/German.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/German.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/German.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/German.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.pos.olia;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.nlp.model.tag.TagSet;
import org.apache.stanbol.enhancer.nlp.pos.LexicalCategory;
import org.apache.stanbol.enhancer.nlp.pos.Pos;
@@ -40,9 +40,9 @@ public final class German {
static {
//TODO: define constants for annotation model and linking model
STTS.getProperties().put("olia.annotationModel",
- new UriRef("http://purl.org/olia/stts.owl"));
+ new IRI("http://purl.org/olia/stts.owl"));
STTS.getProperties().put("olia.linkingModel",
- new UriRef("http://purl.org/olia/stts-link.rdf"));
+ new IRI("http://purl.org/olia/stts-link.rdf"));
STTS.addTag(new PosTag("ADJA", Pos.AttributiveAdjective));
STTS.addTag(new PosTag("ADJD", Pos.PredicativeAdjective));
STTS.addTag(new PosTag("ADV", LexicalCategory.Adverb));
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/Spanish.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/Spanish.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/Spanish.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/pos/olia/Spanish.java Tue May 17 22:20:49 2016
@@ -16,7 +16,7 @@
*/
package org.apache.stanbol.enhancer.nlp.pos.olia;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.nlp.model.tag.TagSet;
import org.apache.stanbol.enhancer.nlp.pos.LexicalCategory;
import org.apache.stanbol.enhancer.nlp.pos.Pos;
@@ -37,10 +37,10 @@ public final class Spanish {
static {
//TODO: define constants for annotation model and linking model
PAROLE.getProperties().put("olia.annotationModel",
- new UriRef("http://purl.org/olia/parole_es_cat.owl"));
+ new IRI("http://purl.org/olia/parole_es_cat.owl"));
// NO linking model
// PAROLE.getProperties().put("olia.linkingModel",
-// new UriRef("http://purl.org/olia/???"));
+// new IRI("http://purl.org/olia/???"));
PAROLE.addTag(new PosTag("AO", LexicalCategory.Adjective));
PAROLE.addTag(new PosTag("AQ", Pos.QualifierAdjective));
PAROLE.addTag(new PosTag("CC", Pos.CoordinatingConjunction));
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/utils/NIFHelper.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/utils/NIFHelper.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/utils/NIFHelper.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/utils/NIFHelper.java Tue May 17 22:20:49 2016
@@ -29,12 +29,12 @@ import java.util.Collections;
import java.util.EnumMap;
import java.util.Map;
-import org.apache.clerezza.rdf.core.Language;
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
import org.apache.commons.io.IOUtils;
import org.apache.stanbol.enhancer.nlp.NlpAnnotations;
import org.apache.stanbol.enhancer.nlp.model.AnalysedText;
@@ -60,9 +60,9 @@ public final class NIFHelper {
private NIFHelper(){}
- public static final Map<SpanTypeEnum,UriRef> SPAN_TYPE_TO_SSO_TYPE;
+ public static final Map<SpanTypeEnum,IRI> SPAN_TYPE_TO_SSO_TYPE;
static {
- Map<SpanTypeEnum,UriRef> mapping = new EnumMap<SpanTypeEnum,UriRef>(SpanTypeEnum.class);
+ Map<SpanTypeEnum,IRI> mapping = new EnumMap<SpanTypeEnum,IRI>(SpanTypeEnum.class);
//mapping.put(SpanTypeEnum.Text, null);
//mapping.put(SpanTypeEnum.TextSection, null);
mapping.put(SpanTypeEnum.Sentence, SsoOntology.Sentence.getUri());
@@ -76,15 +76,15 @@ public final class NIFHelper {
* Concept representing the Phrase (e.g. {@link LexicalCategory#Noun} maps
* to "<code>http://purl.org/olia/olia.owl#NounPhrase</code>").
*/
- public static final Map<LexicalCategory,UriRef> LEXICAL_TYPE_TO_PHRASE_TYPE;
+ public static final Map<LexicalCategory,IRI> LEXICAL_TYPE_TO_PHRASE_TYPE;
static {
String olia = "http://purl.org/olia/olia.owl#";
- Map<LexicalCategory,UriRef> mapping = new EnumMap<LexicalCategory,UriRef>(LexicalCategory.class);
- mapping.put(LexicalCategory.Noun, new UriRef(olia+"NounPhrase"));
- mapping.put(LexicalCategory.Verb, new UriRef(olia+"VerbPhrase"));
- mapping.put(LexicalCategory.Adjective, new UriRef(olia+"AdjectivePhrase"));
- mapping.put(LexicalCategory.Adverb, new UriRef(olia+"AdverbPhrase"));
- mapping.put(LexicalCategory.Conjuction, new UriRef(olia+"ConjuctionPhrase"));
+ Map<LexicalCategory,IRI> mapping = new EnumMap<LexicalCategory,IRI>(LexicalCategory.class);
+ mapping.put(LexicalCategory.Noun, new IRI(olia+"NounPhrase"));
+ mapping.put(LexicalCategory.Verb, new IRI(olia+"VerbPhrase"));
+ mapping.put(LexicalCategory.Adjective, new IRI(olia+"AdjectivePhrase"));
+ mapping.put(LexicalCategory.Adverb, new IRI(olia+"AdverbPhrase"));
+ mapping.put(LexicalCategory.Conjuction, new IRI(olia+"ConjuctionPhrase"));
LEXICAL_TYPE_TO_PHRASE_TYPE = Collections.unmodifiableMap(mapping);
}
/**
@@ -95,10 +95,10 @@ public final class NIFHelper {
* @param end the end position or values < 1 when open ended.
* @return the NIF 2.0 Fragment URI
* @throws IllegalArgumentException if <code>null</code> is parsed as base
- * {@link UriRef} or the end position is >=0 but <= the parsed start
+ * {@link IRI} or the end position is >=0 but <= the parsed start
* position.
*/
- public static final UriRef getNifFragmentURI(UriRef base, int start,int end){
+ public static final IRI getNifFragmentURI(IRI base, int start,int end){
if(base == null){
throw new IllegalArgumentException("Base URI MUST NOT be NULL!");
}
@@ -111,10 +111,10 @@ public final class NIFHelper {
}
sb.append(end);
} //else open ended ...
- return new UriRef(sb.toString());
+ return new IRI(sb.toString());
}
- public static final UriRef getNifOffsetURI(UriRef base, int start, int end){
+ public static final IRI getNifOffsetURI(IRI base, int start, int end){
if(base == null){
throw new IllegalArgumentException("Base URI MUST NOT be NULL!");
}
@@ -127,7 +127,7 @@ public final class NIFHelper {
}
sb.append(end);
} //else open ended ...
- return new UriRef(sb.toString());
+ return new IRI(sb.toString());
}
public static final int NIF_HASH_CONTEXT_LENGTH = 10;
@@ -135,7 +135,7 @@ public final class NIFHelper {
public static final Charset UTF8 = Charset.forName("UTF8");
- public static final UriRef getNifHashURI(UriRef base, int start, int end, String text){
+ public static final IRI getNifHashURI(IRI base, int start, int end, String text){
if(base == null){
throw new IllegalArgumentException("Base URI MUST NOT be NULL!");
}
@@ -160,7 +160,7 @@ public final class NIFHelper {
sb.append('_');
sb.append(text.substring(start,
Math.min(end,start+NIF_HASH_MAX_STRING_LENGTH)));
- return new UriRef(sb.toString());
+ return new IRI(sb.toString());
}
/**
@@ -215,11 +215,11 @@ public final class NIFHelper {
* @param text the {@link AnalysedText}
* @param language the {@link Language} or <code>null</code> if not known
* @param span the {@link Span} to write.
- * @return the {@link UriRef} representing the parsed {@link Span} in the
+ * @return the {@link IRI} representing the parsed {@link Span} in the
* graph
*/
- public static UriRef writeSpan(MGraph graph, UriRef base, AnalysedText text, Language language, Span span){
- UriRef segment = getNifOffsetURI(base, span.getStart(), span.getEnd());
+ public static IRI writeSpan(Graph graph, IRI base, AnalysedText text, Language language, Span span){
+ IRI segment = getNifOffsetURI(base, span.getStart(), span.getEnd());
graph.add(new TripleImpl(segment, RDF_TYPE, StringOntology.OffsetBasedString.getUri()));
graph.add(new TripleImpl(segment, StringOntology.anchorOf.getUri(),
new PlainLiteralImpl(span.getSpan(),language)));
@@ -252,7 +252,7 @@ public final class NIFHelper {
* @param segmentUri the URI of the resource representing the parsed
* annotated element in the graph
*/
- public static void writePos(MGraph graph, Annotated annotated, UriRef segmentUri) {
+ public static void writePos(Graph graph, Annotated annotated, IRI segmentUri) {
Value<PosTag> posTag = annotated.getAnnotation(NlpAnnotations.POS_ANNOTATION);
if(posTag != null){
if(posTag.value().isMapped()){
@@ -280,10 +280,10 @@ public final class NIFHelper {
* @param segmentUri the URI of the resource representing the parsed
* annotated element in the graph
*/
- public static void writePhrase(MGraph graph, Annotated annotated, UriRef segmentUri) {
+ public static void writePhrase(Graph graph, Annotated annotated, IRI segmentUri) {
Value<PhraseTag> phraseTag = annotated.getAnnotation(NlpAnnotations.PHRASE_ANNOTATION);
if(phraseTag != null){
- UriRef phraseTypeUri = LEXICAL_TYPE_TO_PHRASE_TYPE.get(phraseTag.value().getCategory());
+ IRI phraseTypeUri = LEXICAL_TYPE_TO_PHRASE_TYPE.get(phraseTag.value().getCategory());
if(phraseTypeUri != null){ //add the oliaLink for the Phrase
graph.add(new TripleImpl(segmentUri, SsoOntology.oliaLink.getUri(), phraseTypeUri));
graph.add(new TripleImpl(segmentUri, ENHANCER_CONFIDENCE,
Modified: stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/utils/NlpEngineHelper.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/utils/NlpEngineHelper.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/utils/NlpEngineHelper.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/main/java/org/apache/stanbol/enhancer/nlp/utils/NlpEngineHelper.java Tue May 17 22:20:49 2016
@@ -23,7 +23,7 @@ import java.util.Dictionary;
import java.util.Map;
import java.util.Map.Entry;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.nlp.NlpProcessingRole;
import org.apache.stanbol.enhancer.nlp.NlpServiceProperties;
import org.apache.stanbol.enhancer.nlp.model.AnalysedText;
@@ -179,7 +179,7 @@ public final class NlpEngineHelper {
throw new IllegalStateException("Unable to initialise AnalysedText"
+ "ContentPart because the parsed AnalysedTextFactory is NULL");
}
- Entry<UriRef,Blob> textBlob = getPlainText(engine, ci, true);
+ Entry<IRI,Blob> textBlob = getPlainText(engine, ci, true);
//we need to create
ci.getLock().writeLock().lock();
try {
@@ -211,8 +211,8 @@ public final class NlpEngineHelper {
* @throws IllegalStateException if exception is <code>true</code> and the
* language could not be retrieved from the parsed {@link ContentItem}.
*/
- public static Entry<UriRef,Blob> getPlainText(EnhancementEngine engine, ContentItem ci, boolean exception) {
- Entry<UriRef,Blob> textBlob = ContentItemHelper.getBlob(
+ public static Entry<IRI,Blob> getPlainText(EnhancementEngine engine, ContentItem ci, boolean exception) {
+ Entry<IRI,Blob> textBlob = ContentItemHelper.getBlob(
ci, singleton("text/plain"));
if(textBlob != null) {
return textBlob;
Modified: stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelationTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelationTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelationTest.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/dependency/DependencyRelationTest.java Tue May 17 22:20:49 2016
@@ -6,7 +6,7 @@ import java.util.EnumSet;
import java.util.Set;
import java.util.Map.Entry;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory;
import org.apache.stanbol.enhancer.nlp.model.AnalysedText;
import org.apache.stanbol.enhancer.nlp.model.AnalysedTextFactory;
@@ -30,7 +30,7 @@ public class DependencyRelationTest {
private static final AnalysedTextFactory atFactory = AnalysedTextFactory.getDefaultInstance();
private static ContentItem ci;
- private static Entry<UriRef,Blob> textBlob;
+ private static Entry<IRI,Blob> textBlob;
@BeforeClass
public static void setup() throws IOException {
Modified: stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/model/AnalysedTextTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/model/AnalysedTextTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/model/AnalysedTextTest.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/model/AnalysedTextTest.java Tue May 17 22:20:49 2016
@@ -31,7 +31,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.commons.collections.CollectionUtils;
import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory;
import org.apache.stanbol.enhancer.nlp.model.annotation.Annotation;
@@ -171,7 +171,7 @@ public class AnalysedTextTest {
*/
private static AnalysedText createAnalysedText() throws IOException {
ci = ciFactory.createContentItem(new StringSource(text));
- Entry<UriRef,Blob> textBlob = ContentItemHelper.getBlob(ci, Collections.singleton("text/plain"));
+ Entry<IRI,Blob> textBlob = ContentItemHelper.getBlob(ci, Collections.singleton("text/plain"));
return atFactory.createAnalysedText(ci, textBlob.getValue());
}
Modified: stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/utils/NIFHelperTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/utils/NIFHelperTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/utils/NIFHelperTest.java (original)
+++ stanbol/trunk/enhancer/generic/nlp/src/test/java/org/apache/stanbol/enhancer/nlp/utils/NIFHelperTest.java Tue May 17 22:20:49 2016
@@ -20,7 +20,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.servicesapi.helper.ContentItemHelper;
import org.junit.Test;
@@ -28,14 +28,14 @@ import junit.framework.Assert;
public class NIFHelperTest {
- static UriRef base = new UriRef("http://stanbol.apache.org/test/nif/nif-helper");
+ static IRI base = new IRI("http://stanbol.apache.org/test/nif/nif-helper");
static String text = "This is a test for the NLP Interchange format!";
@Test
public void testFragmentURI(){
Assert.assertEquals(
- new UriRef(base.getUnicodeString()+"#char=23,26"),
+ new IRI(base.getUnicodeString()+"#char=23,26"),
NIFHelper.getNifFragmentURI(base, 23, 26));
}
@Test
@@ -50,7 +50,7 @@ public class NIFHelperTest {
String context = text.substring(13,23)+'('+selected+')'+text.substring(26,36);
byte[] contextData = context.getBytes(Charset.forName("UTF8"));
String md5 = ContentItemHelper.streamDigest(new ByteArrayInputStream(contextData), null, "MD5");
- UriRef expected = new UriRef(base.getUnicodeString()+"#hash_10_3_"+md5+"_NLP");
+ IRI expected = new IRI(base.getUnicodeString()+"#hash_10_3_"+md5+"_NLP");
Assert.assertEquals(expected, NIFHelper.getNifHashURI(base, 23, 26, text));
}
}
Modified: stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/RdfEntity.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/RdfEntity.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/RdfEntity.java (original)
+++ stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/RdfEntity.java Tue May 17 22:20:49 2016
@@ -16,9 +16,9 @@
*/
package org.apache.stanbol.enhancer.rdfentities;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.IRI;
/**
* Super interface for all interfaces using the {@link RdfEntityFactory} to
@@ -31,9 +31,9 @@ public interface RdfEntity {
/**
* Getter for the RDF node represented by the Proxy.
*
- * @return the node representing the proxy. Typically an {@link UriRef} but
- * could be also a {@link BNode}
+ * @return the node representing the proxy. Typically an {@link IRI} but
+ * could be also a {@link BlankNode}
*/
- NonLiteral getId();
+ BlankNodeOrIRI getId();
}
Modified: stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/RdfEntityFactory.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/RdfEntityFactory.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/RdfEntityFactory.java (original)
+++ stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/RdfEntityFactory.java Tue May 17 22:20:49 2016
@@ -18,8 +18,8 @@ package org.apache.stanbol.enhancer.rdfe
import java.util.Collection;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
import org.apache.stanbol.enhancer.rdfentities.impl.SimpleRdfEntityFactory;
@@ -31,13 +31,13 @@ import org.apache.stanbol.enhancer.rdfen
public abstract class RdfEntityFactory {
/**
- * Creates a new factory for the parsed {@link MGraph} instance.
+ * Creates a new factory for the parsed {@link Graph} instance.
*
* @param graph the graph used by the proxies created by this factory to
* read/write there data
* @return the created factory
*/
- public static RdfEntityFactory createInstance(MGraph graph){
+ public static RdfEntityFactory createInstance(Graph graph){
return new SimpleRdfEntityFactory(graph);
}
@@ -62,18 +62,18 @@ public abstract class RdfEntityFactory {
* Proxies returned by this Factory:
* <ul>
* <li> MUST NOT have an internal state. They need to represent a view over
- * the current data within the {@link MGraph} instance. Direct changes to
+ * the current data within the {@link Graph} instance. Direct changes to
* the graph need to be reflected in calls to proxies.
* <li> Implementations need to support {@link Collection} as parameter.
* Collections need to represent a live view over the triples within the
- * {@link MGraph}. However iterators may throw a
+ * {@link Graph}. However iterators may throw a
* {@link ConcurrentModificationException} if the graph changes while using
* the iterator.
* </ul>
*
* @param <T> The interface implemented by the returned proxy
* @param rdfNode the rdfNode represented by the proxy (created if not
- * present in the Graph)
+ * present in the ImmutableGraph)
* @param type The interface for the proxy. Needs to extend {@link RdfEntity}
* @param additionalInterfaces Additional interfaces the proxy needs to
* implement.
@@ -85,7 +85,7 @@ public abstract class RdfEntityFactory {
* @throws NullPointerException if the parameter type, additionalInterfaces
* or any entry of additionalInterfaces is <code>null</code>.
*/
- public abstract <T extends RdfEntity> T getProxy(NonLiteral rdfNode,
+ public abstract <T extends RdfEntity> T getProxy(BlankNodeOrIRI rdfNode,
Class<T> type, Class<?>... additionalInterfaces) throws IllegalArgumentException;
}
Modified: stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/fise/Enhancement.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/fise/Enhancement.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/fise/Enhancement.java (original)
+++ stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/fise/Enhancement.java Tue May 17 22:20:49 2016
@@ -19,7 +19,7 @@ package org.apache.stanbol.enhancer.rdfe
import java.util.Collection;
import java.util.Date;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.rdfentities.Rdf;
import org.apache.stanbol.enhancer.rdfentities.RdfEntity;
@@ -30,10 +30,10 @@ import org.apache.stanbol.enhancer.rdfen
* To create an instance of this interface use the following code
* <code><pre>
* ContentItem ci;
- * MGraph graph = ci.getMetadata();
+ * Graph graph = ci.getMetadata();
* RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
* String enhancementId = "http://wwww.example.com/iks-project/enhancer/example-enhancement";
- * UriRef enhancementNode = new UriRef(enhancementId);
+ * IRI enhancementNode = new IRI(enhancementId);
* Enhancement enhancement = factory.getProxy(enhancementNode, Enhancement.class);
* enhancement.setCreator("Rupert Westenthaler");
* enhancement.setCreated(new Date());
@@ -46,9 +46,9 @@ import org.apache.stanbol.enhancer.rdfen
public interface Enhancement extends RdfEntity{
@Rdf(id="http://purl.org/dc/terms/creator")
- UriRef getCreator();
+ IRI getCreator();
@Rdf(id="http://purl.org/dc/terms/creator")
- void setCreator(UriRef creator);
+ void setCreator(IRI creator);
@Rdf(id="http://purl.org/dc/terms/created")
void setCreated(Date date);
@@ -58,7 +58,7 @@ public interface Enhancement extends Rdf
// @Rdf(id="http://purl.org/dc/terms/type")
// void setDcType(Collection<URI> types);
@Rdf(id="http://purl.org/dc/terms/type")
- Collection<UriRef> getDcType();
+ Collection<IRI> getDcType();
@Rdf(id="http://fise.iks-project.eu/ontology/confidence")
Double getConfidence();
@@ -66,9 +66,9 @@ public interface Enhancement extends Rdf
void setConfidence(Double value);
@Rdf(id="http://fise.iks-project.eu/ontology/extracted-from")
- UriRef getExtractedFrom();
+ IRI getExtractedFrom();
@Rdf(id="http://fise.iks-project.eu/ontology/extracted-from")
- void setExtractedFrom(UriRef contentItem);
+ void setExtractedFrom(IRI contentItem);
@Rdf(id="http://purl.org/dc/terms/requires")
Collection<Enhancement> getRequires();
Modified: stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/fise/EntityAnnotation.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/fise/EntityAnnotation.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/fise/EntityAnnotation.java (original)
+++ stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/fise/EntityAnnotation.java Tue May 17 22:20:49 2016
@@ -18,7 +18,7 @@ package org.apache.stanbol.enhancer.rdfe
import java.util.Collection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.enhancer.rdfentities.Rdf;
@@ -26,9 +26,9 @@ import org.apache.stanbol.enhancer.rdfen
public interface EntityAnnotation extends Enhancement {
@Rdf(id="http://fise.iks-project.eu/ontology/entity-reference")
- UriRef getEntityReference();
+ IRI getEntityReference();
@Rdf(id="http://fise.iks-project.eu/ontology/entity-reference")
- void setEntityReference(UriRef reference);
+ void setEntityReference(IRI reference);
@Rdf(id="http://fise.iks-project.eu/ontology/entity-label")
String getEntityLabel();
@@ -36,5 +36,5 @@ public interface EntityAnnotation extend
void setEntityLabel(String label);
@Rdf(id="http://fise.iks-project.eu/ontology/entity-type")
- Collection<UriRef> getEntityTypes();
+ Collection<IRI> getEntityTypes();
}
Modified: stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/impl/RdfProxyInvocationHandler.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/impl/RdfProxyInvocationHandler.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/impl/RdfProxyInvocationHandler.java (original)
+++ stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/impl/RdfProxyInvocationHandler.java Tue May 17 22:20:49 2016
@@ -34,14 +34,14 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import org.apache.clerezza.rdf.core.LiteralFactory;
import org.apache.clerezza.rdf.core.NoConvertorException;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.LiteralFactory;
import org.apache.stanbol.enhancer.rdfentities.Rdf;
import org.apache.stanbol.enhancer.rdfentities.RdfEntity;
import org.apache.stanbol.enhancer.servicesapi.rdf.Properties;
@@ -89,14 +89,14 @@ public class RdfProxyInvocationHandler i
protected SimpleRdfEntityFactory factory;
protected LiteralFactory literalFactory;
- protected NonLiteral rdfNode;
+ protected BlankNodeOrIRI rdfNode;
private final Set<Class<?>> interfaces;
- public RdfProxyInvocationHandler(SimpleRdfEntityFactory factory, NonLiteral rdfNode, Class<?>[] parsedInterfaces, LiteralFactory literalFactory){
+ public RdfProxyInvocationHandler(SimpleRdfEntityFactory factory, BlankNodeOrIRI rdfNode, Class<?>[] parsedInterfaces, LiteralFactory literalFactory){
this.rdfNode = rdfNode;
this.factory = factory;
this.literalFactory = literalFactory;
- //TODO If slow implement this by directly using the MGraph Interface!
- Collection<UriRef> nodeTypes = getValues(Properties.RDF_TYPE, UriRef.class);
+ //TODO If slow implement this by directly using the Graph Interface!
+ Collection<IRI> nodeTypes = getValues(Properties.RDF_TYPE, IRI.class);
Set<Class<?>> interfaceSet = new HashSet<Class<?>>();
for (Class<?> clazz : parsedInterfaces){
if(!clazz.isInterface()){
@@ -110,7 +110,7 @@ public class RdfProxyInvocationHandler i
Rdf classAnnotation = clazz.getAnnotation(Rdf.class);
if(classAnnotation == null){
} else { //check of the type statement is present
- UriRef typeRef = new UriRef(classAnnotation.id());
+ IRI typeRef = new IRI(classAnnotation.id());
if(!nodeTypes.contains(typeRef)){
//TODO: Question: How to get the dependencies for logging working with maven :(
//log.debug("add type "+typeRef+" for interface "+clazz+" to node "+rdfNode);
@@ -161,9 +161,9 @@ public class RdfProxyInvocationHandler i
if(rdf == null){
throw new IllegalStateException("Invoked Method does not have an Rdf annotation!");
}
- UriRef property;
+ IRI property;
if(rdf.id().startsWith("http://") || rdf.id().startsWith("urn:")){
- property = new UriRef(rdf.id());
+ property = new IRI(rdf.id());
} else {
throw new IllegalStateException("The id=\""+rdf.id()+"\"provided by the rdf annotation is not an valid URI");
}
@@ -248,81 +248,81 @@ public class RdfProxyInvocationHandler i
}
@SuppressWarnings("unchecked")
- private <T> T getValue(UriRef property, Class<T> type){
+ private <T> T getValue(IRI property, Class<T> type){
Iterator<Triple> results = factory.getGraph().filter(rdfNode, property, null);
if (results.hasNext()){
- Resource result = results.next().getObject();
- if (result instanceof NonLiteral){
+ RDFTerm result = results.next().getObject();
+ if (result instanceof BlankNodeOrIRI){
if (RdfEntity.class.isAssignableFrom(type)){
- return (T)factory.getProxy((NonLiteral)result, (Class<? extends RdfEntity>)type);
- } else { //check result for UriRef and types UriRef, URI or URL
- if(result instanceof UriRef){
- if (UriRef.class.isAssignableFrom(type)){
+ return (T)factory.getProxy((BlankNodeOrIRI)result, (Class<? extends RdfEntity>)type);
+ } else { //check result for IRI and types IRI, URI or URL
+ if(result instanceof IRI){
+ if (IRI.class.isAssignableFrom(type)){
return (T)result;
} else if (URI.class.isAssignableFrom(type)){
try {
- return (T)new URI(((UriRef)result).getUnicodeString());
+ return (T)new URI(((IRI)result).getUnicodeString());
} catch (URISyntaxException e) {
throw new IllegalStateException("Unable to parse "+URI.class
- +" for "+UriRef.class+" value="+((UriRef)result).getUnicodeString());
+ +" for "+IRI.class+" value="+((IRI)result).getUnicodeString());
}
} else if (URL.class.isAssignableFrom(type)){
try {
- return (T)new URL(((UriRef)result).getUnicodeString());
+ return (T)new URL(((IRI)result).getUnicodeString());
} catch (MalformedURLException e) {
throw new IllegalStateException("Unable to parse "+URL.class
- +" for "+UriRef.class+" value="+((UriRef)result).getUnicodeString());
+ +" for "+IRI.class+" value="+((IRI)result).getUnicodeString());
}
} else {
throw new IllegalArgumentException("Parsed Type "+type
+" is not compatible for result type "+result.getClass()
+" (value "+result+") of node "+rdfNode+" and property "+property
- +"! (Subclass of RdfEntity, UriRef, URI or URL is expected for NonLiteral Values)");
+ +"! (Subclass of RdfEntity, IRI, URI or URL is expected for BlankNodeOrIRI Values)");
}
} else {
throw new IllegalArgumentException("Parsed Type "+type
+" is not compatible for result type "+result.getClass()
+" (value "+result+") of node "+rdfNode+" and property "+property
- +"! (Subclass of RdfEntity expected as type for NonLiteral values that are no instanceof UriRef)");
+ +"! (Subclass of RdfEntity expected as type for BlankNodeOrIRI values that are no instanceof IRI)");
}
}
} else {
- return literalFactory.createObject(type,(TypedLiteral) result);
+ return literalFactory.createObject(type,(Literal) result);
}
} else {
return null;
}
}
- private <T> Collection<T> getValues(UriRef property, Class<T> type){
+ private <T> Collection<T> getValues(IRI property, Class<T> type){
return new RdfProxyPropertyCollection<T>(property, type);
}
- private void setValue(UriRef property, Object value){
+ private void setValue(IRI property, Object value){
removeValues(property);
addValue(property, value);
}
- private void setValues(UriRef property, Collection<?> values){
+ private void setValues(IRI property, Collection<?> values){
removeValues(property);
for(Object value : values){
addValue(property, value);
}
}
- protected Resource getRdfResource(Object value) throws NoConvertorException{
- if(value instanceof Resource){
- //if the parsed object is already a Resource
- return (Resource) value; //return it
+ protected RDFTerm getRdfResource(Object value) throws NoConvertorException{
+ if(value instanceof RDFTerm){
+ //if the parsed object is already a RDFTerm
+ return (RDFTerm) value; //return it
} else if(value instanceof RdfEntity){ //check for other proxies
return ((RdfEntity)value).getId();
} else if(value instanceof URI){ //or URI links
- return new UriRef(value.toString());
+ return new IRI(value.toString());
} else if(value instanceof URL){ //or URL links
- return new UriRef(value.toString());
+ return new IRI(value.toString());
} else { //nothing of that
//try to make an Literal (Clarezza internal Adapters)
return literalFactory.createTypedLiteral(value);
}
}
- private boolean addValue(UriRef property, Object value){
- Resource rdfValue;
+ private boolean addValue(IRI property, Object value){
+ RDFTerm rdfValue;
try {
rdfValue = getRdfResource(value);
return factory.getGraph().add(new TripleImpl(rdfNode, property, rdfValue));
@@ -331,8 +331,8 @@ public class RdfProxyInvocationHandler i
+" to an RDF Node. Only "+RdfEntity.class+" and RDF Literal Types are supported");
}
}
- private boolean removeValue(UriRef property, Object value){
- Resource rdfValue;
+ private boolean removeValue(IRI property, Object value){
+ RDFTerm rdfValue;
try {
rdfValue = getRdfResource(value);
return factory.getGraph().remove(new TripleImpl(rdfNode, property, rdfValue));
@@ -341,7 +341,7 @@ public class RdfProxyInvocationHandler i
+" to an RDF Node. Only "+RdfEntity.class+" and RDF Literal Types are supported");
}
}
- private void removeValues(UriRef proptery){
+ private void removeValues(IRI proptery){
Iterator<Triple> toRemove = factory.getGraph().filter(rdfNode, proptery, null);
while(toRemove.hasNext()){
factory.getGraph().remove(toRemove.next());
@@ -349,9 +349,9 @@ public class RdfProxyInvocationHandler i
}
/**
- * We need this class to apply changes in the collection to the MGraph.
+ * We need this class to apply changes in the collection to the Graph.
* This collection implementation is a stateless wrapper over the
- * triples selected by the subject,property pair over the MGraph!<br>
+ * triples selected by the subject,property pair over the Graph!<br>
* Default implementation of {@link AbstractCollection} are very poor
* performance. Because of that this class overrides some methods
* already implemented by its abstract super class.
@@ -361,21 +361,21 @@ public class RdfProxyInvocationHandler i
*/
private final class RdfProxyPropertyCollection<T> extends AbstractCollection<T> {
- //private final NonLiteral resource;
- private final UriRef property;
+ //private final BlankNodeOrIRI resource;
+ private final IRI property;
private final Class<T> genericType;
private final boolean entity;
private final boolean uri;
private final boolean url;
private final boolean uriRef;
- private RdfProxyPropertyCollection(UriRef property,Class<T> genericType) {
+ private RdfProxyPropertyCollection(IRI property,Class<T> genericType) {
this.property = property;
this.genericType = genericType;
entity = RdfEntity.class.isAssignableFrom(genericType);
uri = URI.class.isAssignableFrom(genericType);
url = URL.class.isAssignableFrom(genericType);
- uriRef = UriRef.class.isAssignableFrom(genericType);
+ uriRef = IRI.class.isAssignableFrom(genericType);
}
@Override
@@ -390,26 +390,26 @@ public class RdfProxyInvocationHandler i
@SuppressWarnings("unchecked")
@Override
public T next() {
- Resource value = results.next().getObject();
+ RDFTerm value = results.next().getObject();
if (entity){
//type checks are done within the constructor
- return (T) factory.getProxy((NonLiteral)value, (Class<? extends RdfEntity>)genericType);
+ return (T) factory.getProxy((BlankNodeOrIRI)value, (Class<? extends RdfEntity>)genericType);
} else if(uri){
try {
- return (T)new URI(((UriRef)value).getUnicodeString());
+ return (T)new URI(((IRI)value).getUnicodeString());
} catch (URISyntaxException e) {
- throw new IllegalStateException("Unable to parse "+URI.class+" for "+UriRef.class+" value="+((UriRef)value).getUnicodeString());
+ throw new IllegalStateException("Unable to parse "+URI.class+" for "+IRI.class+" value="+((IRI)value).getUnicodeString());
}
} else if(url){
try {
- return (T)new URL(((UriRef)value).getUnicodeString());
+ return (T)new URL(((IRI)value).getUnicodeString());
} catch (MalformedURLException e) {
- throw new IllegalStateException("Unable to parse "+URL.class+" for "+UriRef.class+" value="+((UriRef)value).getUnicodeString());
+ throw new IllegalStateException("Unable to parse "+URL.class+" for "+IRI.class+" value="+((IRI)value).getUnicodeString());
}
} else if(uriRef){
return (T)value;
} else {
- return literalFactory.createObject(genericType, (TypedLiteral)value);
+ return literalFactory.createObject(genericType, (Literal)value);
}
}
Modified: stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/impl/SimpleRdfEntityFactory.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/impl/SimpleRdfEntityFactory.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/impl/SimpleRdfEntityFactory.java (original)
+++ stanbol/trunk/enhancer/generic/rdfentities/src/main/java/org/apache/stanbol/enhancer/rdfentities/impl/SimpleRdfEntityFactory.java Tue May 17 22:20:49 2016
@@ -18,28 +18,28 @@ package org.apache.stanbol.enhancer.rdfe
import java.lang.reflect.Proxy;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
import org.apache.clerezza.rdf.core.LiteralFactory;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
import org.apache.stanbol.enhancer.rdfentities.RdfEntity;
import org.apache.stanbol.enhancer.rdfentities.RdfEntityFactory;
public class SimpleRdfEntityFactory extends RdfEntityFactory {
- private final MGraph graph;
+ private final Graph graph;
private final LiteralFactory literalFactory;
- public SimpleRdfEntityFactory(MGraph graph) {
+ public SimpleRdfEntityFactory(Graph graph) {
if (graph == null){
- throw new IllegalArgumentException("The MGraph parsed as parameter MUST NOT be NULL!");
+ throw new IllegalArgumentException("The Graph parsed as parameter MUST NOT be NULL!");
}
this.graph = graph;
literalFactory = LiteralFactory.getInstance();
}
@SuppressWarnings("unchecked")
- public <T extends RdfEntity> T getProxy(NonLiteral rdfNode, Class<T> type,Class<?>...additionalInterfaces) {
+ public <T extends RdfEntity> T getProxy(BlankNodeOrIRI rdfNode, Class<T> type,Class<?>...additionalInterfaces) {
Class<?>[] interfaces = new Class<?>[additionalInterfaces.length+1];
interfaces[0] = type;
System.arraycopy(additionalInterfaces, 0, interfaces, 1, additionalInterfaces.length);
@@ -51,7 +51,7 @@ public class SimpleRdfEntityFactory exte
return (T)instance;
}
- protected MGraph getGraph() {
+ protected Graph getGraph() {
return graph;
}
Modified: stanbol/trunk/enhancer/generic/rdfentities/src/test/java/org/apache/stanbol/enhancer/rdfentities/RdfEntityFactoryTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/rdfentities/src/test/java/org/apache/stanbol/enhancer/rdfentities/RdfEntityFactoryTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/rdfentities/src/test/java/org/apache/stanbol/enhancer/rdfentities/RdfEntityFactoryTest.java (original)
+++ stanbol/trunk/enhancer/generic/rdfentities/src/test/java/org/apache/stanbol/enhancer/rdfentities/RdfEntityFactoryTest.java Tue May 17 22:20:49 2016
@@ -30,11 +30,11 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
import org.apache.stanbol.enhancer.rdfentities.Rdf;
import org.apache.stanbol.enhancer.rdfentities.RdfEntity;
import org.apache.stanbol.enhancer.rdfentities.RdfEntityFactory;
@@ -52,10 +52,10 @@ public class RdfEntityFactoryTest {
@Test
public void testRdfEntity() throws Exception {
- MGraph graph = new SimpleMGraph();
+ Graph graph = new SimpleGraph();
RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
String testUri = "urn:RdfEntityFactoryTest:TestEntity";
- UriRef node = new UriRef(testUri);
+ IRI node = new IRI(testUri);
RdfEntity rdfEntity = factory.getProxy(node, RdfEntity.class);
//TODO: Test type statement
//TODO: test getID Method
@@ -68,10 +68,10 @@ public class RdfEntityFactoryTest {
}
@Test
public void testPrimitiveDataTypes() throws Exception {
- MGraph graph = new SimpleMGraph();
+ Graph graph = new SimpleGraph();
RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
String testUri = "urn:RdfEntityFactoryTest:TestEntity";
- UriRef node = new UriRef(testUri);
+ IRI node = new IRI(testUri);
TestRdfEntity testEntity = factory.getProxy(node, TestRdfEntity.class);
testEntity.setBoolean(true);
@@ -139,10 +139,10 @@ public class RdfEntityFactoryTest {
@Test
public void testTypeStatements() throws Exception {
- MGraph graph = new SimpleMGraph();
+ Graph graph = new SimpleGraph();
RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
String testUri = "urn:RdfEntityFactoryTest:TestEntity";
- UriRef node = new UriRef(testUri);
+ IRI node = new IRI(testUri);
TestRdfEntity entity = factory.getProxy(node, TestRdfEntity.class, new Class[]{TestRdfEntity2.class});
// test the if the proxy implements both interfaces
assertTrue(entity instanceof TestRdfEntity);
@@ -155,12 +155,12 @@ public class RdfEntityFactoryTest {
@Test
public void testObjectProperties() throws Exception {
- MGraph graph = new SimpleMGraph();
+ Graph graph = new SimpleGraph();
RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
String testUri = "urn:RdfEntityFactoryTest:TestEntity";
String testUri2 = "urn:RdfEntityFactoryTest:TestEntity2";
- UriRef node = new UriRef(testUri);
- UriRef node2 = new UriRef(testUri2);
+ IRI node = new IRI(testUri);
+ IRI node2 = new IRI(testUri2);
TestRdfEntity entity = factory.getProxy(node, TestRdfEntity.class);
TestRdfEntity2 entity2 = factory.getProxy(node2, TestRdfEntity2.class);
@@ -172,44 +172,44 @@ public class RdfEntityFactoryTest {
entity.setURL(testURL);
assertEquals(testURL, entity.getURL());
- entity.setUriRef(node2);
- assertEquals(node2, entity.getUriRef());
+ entity.setIRI(node2);
+ assertEquals(node2, entity.getIRI());
entity2.setTestEntity(entity);
assertEquals(entity, entity2.getTestEntity());
Collection<TestRdfEntity> testEntities = entity2.getTestEntities();
assertTrue(testEntities.isEmpty()); //check that entity is not in the collection
- Set<UriRef> testUriRefs = new HashSet<UriRef>();
+ Set<IRI> testIRIs = new HashSet<IRI>();
int NUM = 10;
for (int i=0;i<NUM;i++){
- UriRef testNode = new UriRef(testUri+':'+'_'+i);
- testUriRefs.add(testNode);
+ IRI testNode = new IRI(testUri+':'+'_'+i);
+ testIRIs.add(testNode);
testEntities.add(factory.getProxy(testNode, TestRdfEntity.class));
}
//now get a new collection and test if the added entities are there
- Collection<UriRef> resultUriRefs = new ArrayList<UriRef>(); //add to a list to check for duplicates
+ Collection<IRI> resultIRIs = new ArrayList<IRI>(); //add to a list to check for duplicates
for (TestRdfEntity e : entity2.getTestEntities()){
- assertTrue(e.getId() instanceof UriRef); //I used UriRefs for the generation ...
- resultUriRefs.add((UriRef)e.getId());
+ assertTrue(e.getId() instanceof IRI); //I used IRIs for the generation ...
+ resultIRIs.add((IRI)e.getId());
}
//now cross check
- assertTrue(testUriRefs.containsAll(resultUriRefs));
- assertTrue(resultUriRefs.containsAll(testUriRefs));
+ assertTrue(testIRIs.containsAll(resultIRIs));
+ assertTrue(resultIRIs.containsAll(testIRIs));
//now one could try to remove some Elements ...
// ... but things like that are already tested for Integers in testPrimitiveDataTypes
}
@Test
public void testInterfaceHierarchies() throws Exception {
- MGraph graph = new SimpleMGraph();
+ Graph graph = new SimpleGraph();
RdfEntityFactory factory = RdfEntityFactory.createInstance(graph);
String testUri = "urn:RdfEntityFactoryTest:SubTestEntity";
String testUri2 = "urn:RdfEntityFactoryTest:TestEntity2";
String testUri3 = "urn:RdfEntityFactoryTest:TestEntity";
- UriRef node = new UriRef(testUri);
- UriRef node2 = new UriRef(testUri2);
- UriRef node3 = new UriRef(testUri3);
+ IRI node = new IRI(testUri);
+ IRI node2 = new IRI(testUri2);
+ IRI node3 = new IRI(testUri3);
SubTestRdfEntity entity = factory.getProxy(node, SubTestRdfEntity.class);
TestRdfEntity entity2 = factory.getProxy(node2, TestRdfEntity.class, SubTestRdfEntity.class, TestRdfEntity2.class);
TestRdfEntity entity3 = factory.getProxy(node3, TestRdfEntity.class);
@@ -219,7 +219,7 @@ public class RdfEntityFactoryTest {
assertTrue(entity instanceof TestRdfEntity);
assertTrue(entity instanceof RdfEntity);
- // test if the rdf:type triples are present in the MGraph
+ // test if the rdf:type triples are present in the Graph
Set<String> typeStrings = getRdfTypes(graph, node);
assertTrue(typeStrings.contains(SubTestRdfEntity.class.getAnnotation(Rdf.class).id()));
assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
@@ -231,7 +231,7 @@ public class RdfEntityFactoryTest {
assertTrue(entity2 instanceof TestRdfEntity2);
assertTrue(entity2 instanceof RdfEntity);
- // test if the rdf:type triples are present in the MGraph
+ // test if the rdf:type triples are present in the Graph
typeStrings = getRdfTypes(graph, node2);
assertTrue(typeStrings.contains(SubTestRdfEntity.class.getAnnotation(Rdf.class).id()));
assertTrue(typeStrings.contains(TestRdfEntity.class.getAnnotation(Rdf.class).id()));
@@ -256,13 +256,13 @@ public class RdfEntityFactoryTest {
assertTrue(!(entity3 instanceof SubTestRdfEntity));
}
- private static Set<String> getRdfTypes(MGraph graph, UriRef node) {
+ private static Set<String> getRdfTypes(Graph graph, IRI node) {
Iterator<Triple> typeStatements = graph.filter(node, Properties.RDF_TYPE, null);
Set<String> typeStrings = new HashSet<String>();
while(typeStatements.hasNext()){
- Resource type = typeStatements.next().getObject();
- assertTrue(type instanceof UriRef);
- typeStrings.add(((UriRef)type).getUnicodeString());
+ RDFTerm type = typeStatements.next().getObject();
+ assertTrue(type instanceof IRI);
+ typeStrings.add(((IRI)type).getUnicodeString());
}
return typeStrings;
}
@@ -329,10 +329,10 @@ public class RdfEntityFactoryTest {
@Rdf(id="urn:test:URL")
void setURL(URL uri);
- @Rdf(id="urn:test:UriRef")
- UriRef getUriRef();
- @Rdf(id="urn:test:UriRef")
- void setUriRef(UriRef uriRef);
+ @Rdf(id="urn:test:IRI")
+ IRI getIRI();
+ @Rdf(id="urn:test:IRI")
+ void setIRI(IRI uriRef);
}
/**
Modified: stanbol/trunk/enhancer/generic/rdfentities/src/test/java/org/apache/stanbol/enhancer/rdfentities/fise/TestEnhancementInterfaces.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/rdfentities/src/test/java/org/apache/stanbol/enhancer/rdfentities/fise/TestEnhancementInterfaces.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/rdfentities/src/test/java/org/apache/stanbol/enhancer/rdfentities/fise/TestEnhancementInterfaces.java (original)
+++ stanbol/trunk/enhancer/generic/rdfentities/src/test/java/org/apache/stanbol/enhancer/rdfentities/fise/TestEnhancementInterfaces.java Tue May 17 22:20:49 2016
@@ -29,12 +29,12 @@ import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
-import org.apache.clerezza.rdf.core.Literal;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItem;
import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory;
import org.apache.stanbol.enhancer.rdfentities.RdfEntityFactory;
@@ -59,7 +59,7 @@ public class TestEnhancementInterfaces {
public static final String SINGLE_SENTENCE = "Dr. Patrick Marshall (1869 - November 1950) was a"
+ " geologist who lived in New Zealand and worked at the University of Otago.";
protected static final ContentSource SINGLE_SENTENCE_SOURCE = new StringSource(SINGLE_SENTENCE);
- public static final UriRef TEST_ENHANCEMENT_ENGINE_URI = new UriRef("urn:test:dummyEnhancementEngine");
+ public static final IRI TEST_ENHANCEMENT_ENGINE_URI = new IRI("urn:test:dummyEnhancementEngine");
private static ContentItemFactory ciFactory = InMemoryContentItemFactory.getInstance();
public static ContentItem createContentItem(ContentSource cs) throws IOException {
return ciFactory.createContentItem(cs);
@@ -68,7 +68,7 @@ public class TestEnhancementInterfaces {
@Test
public void testEnhancementInterfaces() throws Exception {
ContentItem ci = createContentItem(SINGLE_SENTENCE_SOURCE);
- UriRef ciUri = new UriRef(ci.getUri().getUnicodeString());
+ IRI ciUri = new IRI(ci.getUri().getUnicodeString());
RdfEntityFactory factory = RdfEntityFactory.createInstance(ci.getMetadata());
long start = System.currentTimeMillis();
//create an Text Annotation representing an extracted Person
@@ -77,7 +77,7 @@ public class TestEnhancementInterfaces {
personAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
personAnnotation.setCreated(new Date());
personAnnotation.setExtractedFrom(ciUri);
- personAnnotation.getDcType().add(new UriRef("http://www.example.org/cv/annotatation-types/text#Person"));
+ personAnnotation.getDcType().add(new IRI("http://www.example.org/cv/annotatation-types/text#Person"));
personAnnotation.setConfidence(0.8);
personAnnotation.setSelectedText("Patrick Marshall");
personAnnotation.setStart(SINGLE_SENTENCE.indexOf(personAnnotation.getSelectedText()));
@@ -90,7 +90,7 @@ public class TestEnhancementInterfaces {
locationAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
locationAnnotation.setCreated(new Date());
locationAnnotation.setExtractedFrom(ciUri);
- locationAnnotation.getDcType().add(new UriRef("http://www.example.org/cv/annotatation-types/text#Location"));
+ locationAnnotation.getDcType().add(new IRI("http://www.example.org/cv/annotatation-types/text#Location"));
locationAnnotation.setConfidence(0.78);
locationAnnotation.setSelectedText("New Zealand");
locationAnnotation.setStart(SINGLE_SENTENCE.indexOf(locationAnnotation.getSelectedText()));
@@ -103,7 +103,7 @@ public class TestEnhancementInterfaces {
orgAnnotation.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
orgAnnotation.setCreated(new Date());
orgAnnotation.setExtractedFrom(ciUri);
- orgAnnotation.getDcType().add(new UriRef("http://www.example.org/cv/annotatation-types/text#Organisation"));
+ orgAnnotation.getDcType().add(new IRI("http://www.example.org/cv/annotatation-types/text#Organisation"));
orgAnnotation.setConfidence(0.78);
orgAnnotation.setSelectedText("University of Otago");
orgAnnotation.setStart(SINGLE_SENTENCE.indexOf(orgAnnotation.getSelectedText()));
@@ -116,30 +116,30 @@ public class TestEnhancementInterfaces {
patrickMarshall.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
patrickMarshall.setCreated(new Date());
patrickMarshall.setExtractedFrom(ciUri);
- patrickMarshall.getDcType().add(new UriRef("http://www.example.org/cv/annotatation-types/entity#Entity"));
+ patrickMarshall.getDcType().add(new IRI("http://www.example.org/cv/annotatation-types/entity#Entity"));
patrickMarshall.setConfidence(0.56);
patrickMarshall.getRelations().add(personAnnotation);
patrickMarshall.setEntityLabel("Patrick Marshall");
- patrickMarshall.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/patrick_marshall"));
+ patrickMarshall.setEntityReference(new IRI("http://rdf.freebase.com/rdf/en/patrick_marshall"));
patrickMarshall.getEntityTypes().addAll(Arrays.asList(
- new UriRef("http://rdf.freebase.com/ns/people.person"),
- new UriRef("http://rdf.freebase.com/ns/common.topic"),
- new UriRef("http://rdf.freebase.com/ns/education.academic")));
+ new IRI("http://rdf.freebase.com/ns/people.person"),
+ new IRI("http://rdf.freebase.com/ns/common.topic"),
+ new IRI("http://rdf.freebase.com/ns/education.academic")));
// and an other for New Zealand
EntityAnnotation newZealand = factory.getProxy(
createEnhancementURI(), EntityAnnotation.class);
newZealand.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
newZealand.setCreated(new Date());
newZealand.setExtractedFrom(ciUri);
- newZealand.getDcType().add(new UriRef("http://www.example.org/cv/annotatation-types/entity#Entity"));
+ newZealand.getDcType().add(new IRI("http://www.example.org/cv/annotatation-types/entity#Entity"));
newZealand.setConfidence(0.98);
newZealand.getRelations().add(locationAnnotation);
newZealand.setEntityLabel("New Zealand");
- newZealand.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/new_zealand"));
+ newZealand.setEntityReference(new IRI("http://rdf.freebase.com/rdf/en/new_zealand"));
newZealand.getEntityTypes().addAll(Arrays.asList(
- new UriRef("http://rdf.freebase.com/ns/location.location"),
- new UriRef("http://rdf.freebase.com/ns/common.topic"),
- new UriRef("http://rdf.freebase.com/ns/location.country")));
+ new IRI("http://rdf.freebase.com/ns/location.location"),
+ new IRI("http://rdf.freebase.com/ns/common.topic"),
+ new IRI("http://rdf.freebase.com/ns/location.country")));
// and an other option for New Zealand
EntityAnnotation airNewZealand = factory.getProxy(
@@ -147,20 +147,20 @@ public class TestEnhancementInterfaces {
airNewZealand.setCreator(TEST_ENHANCEMENT_ENGINE_URI);
airNewZealand.setCreated(new Date());
airNewZealand.setExtractedFrom(ciUri);
- airNewZealand.getDcType().add(new UriRef("http://www.example.org/cv/annotatation-types/entity#Entity"));
+ airNewZealand.getDcType().add(new IRI("http://www.example.org/cv/annotatation-types/entity#Entity"));
airNewZealand.setConfidence(0.36);
airNewZealand.getRelations().add(locationAnnotation);
airNewZealand.setEntityLabel("New Zealand");
- airNewZealand.setEntityReference(new UriRef("http://rdf.freebase.com/rdf/en/air_new_zealand"));
+ airNewZealand.setEntityReference(new IRI("http://rdf.freebase.com/rdf/en/air_new_zealand"));
airNewZealand.getEntityTypes().addAll(Arrays.asList(
- new UriRef("http://rdf.freebase.com/ns/business.sponsor"),
- new UriRef("http://rdf.freebase.com/ns/common.topic"),
- new UriRef("http://rdf.freebase.com/ns/travel.transport_operator"),
- new UriRef("http://rdf.freebase.com/ns/aviation.airline"),
- new UriRef("http://rdf.freebase.com/ns/aviation.aircraft_owner"),
- new UriRef("http://rdf.freebase.com/ns/business.employer"),
- new UriRef("http://rdf.freebase.com/ns/freebase.apps.hosts.com.appspot.acre.juggle.juggle"),
- new UriRef("http://rdf.freebase.com/ns/business.company")));
+ new IRI("http://rdf.freebase.com/ns/business.sponsor"),
+ new IRI("http://rdf.freebase.com/ns/common.topic"),
+ new IRI("http://rdf.freebase.com/ns/travel.transport_operator"),
+ new IRI("http://rdf.freebase.com/ns/aviation.airline"),
+ new IRI("http://rdf.freebase.com/ns/aviation.aircraft_owner"),
+ new IRI("http://rdf.freebase.com/ns/business.employer"),
+ new IRI("http://rdf.freebase.com/ns/freebase.apps.hosts.com.appspot.acre.juggle.juggle"),
+ new IRI("http://rdf.freebase.com/ns/business.company")));
System.out.println("creation time "+(System.currentTimeMillis()-start)+"ms");
//now test the enhancement
@@ -171,10 +171,10 @@ public class TestEnhancementInterfaces {
assertEquals(3, numberOfEntityAnnotations);
}
- private static UriRef createEnhancementURI() {
+ private static IRI createEnhancementURI() {
//TODO: add some Utility to create Instances to the RdfEntityFactory
// this should create a new URI by some default Algorithm
- return new UriRef("urn:enhancement-" + EnhancementEngineHelper.randomUUID());
+ return new IRI("urn:enhancement-" + EnhancementEngineHelper.randomUUID());
}
/*
@@ -183,12 +183,12 @@ public class TestEnhancementInterfaces {
* -----------------------------------------------------------------------
*/
- private int checkAllEntityAnnotations(MGraph g) {
+ private int checkAllEntityAnnotations(Graph g) {
Iterator<Triple> entityAnnotationIterator = g.filter(null,
RDF_TYPE, TechnicalClasses.ENHANCER_ENTITYANNOTATION);
int entityAnnotationCount = 0;
while (entityAnnotationIterator.hasNext()) {
- UriRef entityAnnotation = (UriRef) entityAnnotationIterator.next().getSubject();
+ IRI entityAnnotation = (IRI) entityAnnotationIterator.next().getSubject();
// test if selected Text is added
checkEntityAnnotation(g, entityAnnotation);
entityAnnotationCount++;
@@ -196,14 +196,14 @@ public class TestEnhancementInterfaces {
return entityAnnotationCount;
}
- private int checkAllTextAnnotations(MGraph g) {
+ private int checkAllTextAnnotations(Graph g) {
Iterator<Triple> textAnnotationIterator = g.filter(null,
RDF_TYPE, ENHANCER_TEXTANNOTATION);
// test if a textAnnotation is present
assertTrue("Expecting non-empty textAnnotationIterator", textAnnotationIterator.hasNext());
int textAnnotationCount = 0;
while (textAnnotationIterator.hasNext()) {
- UriRef textAnnotation = (UriRef) textAnnotationIterator.next().getSubject();
+ IRI textAnnotation = (IRI) textAnnotationIterator.next().getSubject();
// test if selected Text is added
checkTextAnnotation(g, textAnnotation);
textAnnotationCount++;
@@ -214,13 +214,13 @@ public class TestEnhancementInterfaces {
/**
* Checks if a text annotation is valid.
*/
- private void checkTextAnnotation(MGraph g, UriRef textAnnotation) {
+ private void checkTextAnnotation(Graph g, IRI textAnnotation) {
Iterator<Triple> selectedTextIterator = g.filter(textAnnotation,
ENHANCER_SELECTED_TEXT, null);
// check if the selected text is added
assertTrue(selectedTextIterator.hasNext());
// test if the selected text is part of the TEXT_TO_TEST
- Resource object = selectedTextIterator.next().getObject();
+ RDFTerm object = selectedTextIterator.next().getObject();
assertTrue(object instanceof Literal);
assertTrue(SINGLE_SENTENCE.contains(((Literal) object).getLexicalForm()));
// test if context is added
@@ -236,14 +236,14 @@ public class TestEnhancementInterfaces {
/**
* Checks if an entity annotation is valid.
*/
- private void checkEntityAnnotation(MGraph g, UriRef entityAnnotation) {
+ private void checkEntityAnnotation(Graph g, IRI entityAnnotation) {
Iterator<Triple> relationToTextAnnotationIterator = g.filter(
entityAnnotation, DC_RELATION, null);
// check if the relation to the text annotation is set
assertTrue(relationToTextAnnotationIterator.hasNext());
while (relationToTextAnnotationIterator.hasNext()) {
// test if the referred annotations are text annotations
- UriRef referredTextAnnotation = (UriRef) relationToTextAnnotationIterator.next().getObject();
+ IRI referredTextAnnotation = (IRI) relationToTextAnnotationIterator.next().getObject();
assertTrue(g.filter(referredTextAnnotation, RDF_TYPE,
ENHANCER_TEXTANNOTATION).hasNext());
}
@@ -253,7 +253,7 @@ public class TestEnhancementInterfaces {
ENHANCER_ENTITY_REFERENCE, null);
assertTrue(entityReferenceIterator.hasNext());
// test if the reference is an URI
- assertTrue(entityReferenceIterator.next().getObject() instanceof UriRef);
+ assertTrue(entityReferenceIterator.next().getObject() instanceof IRI);
// test if there is only one entity referred
assertFalse(entityReferenceIterator.hasNext());
Modified: stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/Chain.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/Chain.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/Chain.java (original)
+++ stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/Chain.java Tue May 17 22:20:49 2016
@@ -18,7 +18,7 @@ package org.apache.stanbol.enhancer.serv
import java.util.Set;
-import org.apache.clerezza.rdf.core.Graph;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
/**
* An Enhancement Chain represents a configuration that defines what engines
@@ -45,9 +45,9 @@ public interface Chain {
String PROPERTY_NAME = "stanbol.enhancer.chain.name";
/**
* Getter for the execution plan reflecting the current configuration of this
- * Chain. The returned {@link Graph} is read only and MUST NOT be changed if
+ * Chain. The returned {@link ImmutableGraph} is read only and MUST NOT be changed if
* the configuration of this Chain changes. This means that the Chain MUST
- * create a new Graph instance if the execution plan changes as a result of
+ * create a new ImmutableGraph instance if the execution plan changes as a result of
* a change in the configuration. It MUST NOT change any execution plan
* parsed to other components by the getExecutionPlan() method.
* @return the execution plan as defined by the
@@ -57,7 +57,7 @@ public interface Chain {
* the case of the Chain requires runtime information to determine the
* execution plan.
*/
- Graph getExecutionPlan() throws ChainException;
+ ImmutableGraph getExecutionPlan() throws ChainException;
/**
* Getter for the set of {@link EnhancementEngine}s referenced by there
* name within the execution plan. This method is intended to be used
Modified: stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ChainException.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ChainException.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ChainException.java (original)
+++ stanbol/trunk/enhancer/generic/servicesapi/src/main/java/org/apache/stanbol/enhancer/servicesapi/ChainException.java Tue May 17 22:20:49 2016
@@ -20,8 +20,8 @@ package org.apache.stanbol.enhancer.serv
//import static org.apache.stanbol.enhancer.servicesapi.helper.ExecutionPlanHelper.getEngine;
//import static org.apache.stanbol.enhancer.servicesapi.helper.ExecutionPlanHelper.isOptional;
//
-//import org.apache.clerezza.rdf.core.Graph;
-//import org.apache.clerezza.rdf.core.NonLiteral;
+//import org.apache.clerezza.commons.rdf.ImmutableGraph;
+//import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;
/**
* BaseException thrown by {@link Chain} implementations or
@@ -49,7 +49,7 @@ public class ChainException extends Enha
// * @param message
// * @param cause
// */
-// public ChainException(Graph executionPlan, NonLiteral node, String message, Throwable cause){
+// public ChainException(ImmutableGraph executionPlan, BlankNodeOrIRI node, String message, Throwable cause){
// super(String.format("Unable to execute node {} (engine: {} | optional : {}" +
// " | dependsOn : {}) because of: {}",
// node,getEngine(executionPlan, node),