Author: rwesten
Date: Wed Oct 10 12:43:36 2012
New Revision: 1396568
URL: http://svn.apache.org/viewvc?rev=1396568&view=rev
Log:
implements STANBOL-766, fixes STANBOL-767
Modified:
stanbol/trunk/enhancer/engines/geonames/src/main/java/org/apache/stanbol/enhancer/engines/geonames/impl/LocationEnhancementEngine.java
stanbol/trunk/enhancer/engines/geonames/src/test/java/org/apache/stanbol/enhancer/engines/geonames/impl/TestLocationEnhancementEngine.java
stanbol/trunk/enhancer/generic/test/src/main/java/org/apache/stanbol/enhancer/test/helper/EnhancementStructureHelper.java
Modified:
stanbol/trunk/enhancer/engines/geonames/src/main/java/org/apache/stanbol/enhancer/engines/geonames/impl/LocationEnhancementEngine.java
URL:
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/engines/geonames/src/main/java/org/apache/stanbol/enhancer/engines/geonames/impl/LocationEnhancementEngine.java?rev=1396568&r1=1396567&r2=1396568&view=diff
==============================================================================
---
stanbol/trunk/enhancer/engines/geonames/src/main/java/org/apache/stanbol/enhancer/engines/geonames/impl/LocationEnhancementEngine.java
(original)
+++
stanbol/trunk/enhancer/engines/geonames/src/main/java/org/apache/stanbol/enhancer/engines/geonames/impl/LocationEnhancementEngine.java
Wed Oct 10 12:43:36 2012
@@ -493,6 +493,8 @@ public class LocationEnhancementEngine
if (requiresEnhancements != null) {
for (NonLiteral requires : requiresEnhancements) {
graph.add(new TripleImpl(entityAnnotation, DC_REQUIRES,
requires));
+ //STANBOL-767: also add dc:relation link
+ graph.add(new TripleImpl(entityAnnotation, DC_RELATION,
requires));
}
}
graph.add(new TripleImpl(entityAnnotation, ENHANCER_ENTITY_REFERENCE,
entityRef));
Modified:
stanbol/trunk/enhancer/engines/geonames/src/test/java/org/apache/stanbol/enhancer/engines/geonames/impl/TestLocationEnhancementEngine.java
URL:
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/engines/geonames/src/test/java/org/apache/stanbol/enhancer/engines/geonames/impl/TestLocationEnhancementEngine.java?rev=1396568&r1=1396567&r2=1396568&view=diff
==============================================================================
---
stanbol/trunk/enhancer/engines/geonames/src/test/java/org/apache/stanbol/enhancer/engines/geonames/impl/TestLocationEnhancementEngine.java
(original)
+++
stanbol/trunk/enhancer/engines/geonames/src/test/java/org/apache/stanbol/enhancer/engines/geonames/impl/TestLocationEnhancementEngine.java
Wed Oct 10 12:43:36 2012
@@ -160,7 +160,9 @@ public class TestLocationEnhancementEngi
int entityAnnotationCount =
validateAllEntityAnnotations(ci.getMetadata(),expectedValues);
//two suggestions for New Zealand and one hierarchy entry for the first
//suggestion
- assertEquals(2, entityAnnotationCount);
+ //NOTE 2012-10-10: changed expected value back to "3" as geonames.org
+ // again returns "Oceania" as parent for "New Zealand"
+ assertEquals(3, entityAnnotationCount);
}
Modified:
stanbol/trunk/enhancer/generic/test/src/main/java/org/apache/stanbol/enhancer/test/helper/EnhancementStructureHelper.java
URL:
http://svn.apache.org/viewvc/stanbol/trunk/enhancer/generic/test/src/main/java/org/apache/stanbol/enhancer/test/helper/EnhancementStructureHelper.java?rev=1396568&r1=1396567&r2=1396568&view=diff
==============================================================================
---
stanbol/trunk/enhancer/generic/test/src/main/java/org/apache/stanbol/enhancer/test/helper/EnhancementStructureHelper.java
(original)
+++
stanbol/trunk/enhancer/generic/test/src/main/java/org/apache/stanbol/enhancer/test/helper/EnhancementStructureHelper.java
Wed Oct 10 12:43:36 2012
@@ -319,10 +319,16 @@ public class EnhancementStructureHelper
// check if the relation to the text annotation is set
assertTrue(relationToTextAnnotationIterator.hasNext());
while (relationToTextAnnotationIterator.hasNext()) {
- // test if the referred annotations are text annotations
+ // test if the referred annotations are text annotations or
+ // the referenced annotations is a fise:EntityAnnotation AND also a
+ // dc:requires link is defined (STANBOL-766)
UriRef referredTextAnnotation = (UriRef)
relationToTextAnnotationIterator.next().getObject();
- assertTrue(enhancements.filter(referredTextAnnotation, RDF_TYPE,
- ENHANCER_TEXTANNOTATION).hasNext());
+ assertTrue("fise:EntityAnnotations MUST BE dc:related to a
fise:TextAnnotation OR dc:requires and dc:related to the same
fise:EntityAnnotation",
+ enhancements.filter(referredTextAnnotation, RDF_TYPE,
+ ENHANCER_TEXTANNOTATION).hasNext() || (
+ enhancements.filter(referredTextAnnotation, RDF_TYPE,
+ ENHANCER_ENTITYANNOTATION).hasNext() &&
+ enhancements.filter(entityAnnotation,
Properties.DC_REQUIRES, referredTextAnnotation).hasNext()));
}
// test if an entity is referred