You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by sf...@apache.org on 2010/12/12 17:10:52 UTC
svn commit: r1044841 [2/11] - in /incubator/stanbol/trunk/fise:
SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/
SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/ui/
SemiAutomaticContentEnhancer/src/main/java/eu/iks...
Modified: incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/ImageAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/ImageAnnotation.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/ImageAnnotation.java (original)
+++ incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/ImageAnnotation.java Sun Dec 12 16:10:48 2010
@@ -6,54 +6,54 @@ import java.awt.datatransfer.Unsupported
import java.io.IOException;
public class ImageAnnotation implements IAnnotation {
-
-
- /**
- *
- */
- private static final long serialVersionUID = 6917081289144409008L;
- private String filename;
- private Rectangle region;
- private IAnnotation annotation;
-
- public Object getTransferData(DataFlavor flavor)
- throws UnsupportedFlavorException, IOException {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DataFlavor[] getTransferDataFlavors() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean isDataFlavorSupported(DataFlavor flavor) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void setFilename(String filename) {
- this.filename = filename;
- }
-
- public String getFilename() {
- return filename;
- }
-
- public void setRegion(Rectangle region) {
- this.region = region;
- }
-
- public Rectangle getRegion() {
- return region;
- }
-
- public void setAnnotation(IAnnotation annotation) {
- this.annotation = annotation;
- }
-
- public IAnnotation getAnnotation() {
- return annotation;
- }
+
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6917081289144409008L;
+ private String filename;
+ private Rectangle region;
+ private IAnnotation annotation;
+
+ public Object getTransferData(DataFlavor flavor)
+ throws UnsupportedFlavorException, IOException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataFlavor[] getTransferDataFlavors() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean isDataFlavorSupported(DataFlavor flavor) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String getFilename() {
+ return filename;
+ }
+
+ public void setRegion(Rectangle region) {
+ this.region = region;
+ }
+
+ public Rectangle getRegion() {
+ return region;
+ }
+
+ public void setAnnotation(IAnnotation annotation) {
+ this.annotation = annotation;
+ }
+
+ public IAnnotation getAnnotation() {
+ return annotation;
+ }
}
Modified: incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/TextAnnotation.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/TextAnnotation.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/TextAnnotation.java (original)
+++ incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/TextAnnotation.java Sun Dec 12 16:10:48 2010
@@ -9,138 +9,138 @@ import java.util.List;
public class TextAnnotation implements IAnnotation {
- /**
- *
- */
- private static final long serialVersionUID = 5865576334353943605L;
- private String name;
- private String creator;
- private String created;
- private String selectionContext;
- private String selectedText;
- private int startIndex;
- private int endIndex;
-
- private List<EntityAnnotation> entityAnnotations;
- private Hashtable<String, List<String>> attributes;
-
- public TextAnnotation() {
- entityAnnotations = new LinkedList<EntityAnnotation>();
- attributes = new Hashtable<String, List<String>>();
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setCreator(String creator) {
- this.creator = creator;
- }
-
- public String getCreator() {
- return creator;
- }
-
- public void setCreated(String created) {
- this.created = created;
- }
-
- public String getCreated() {
- return created;
- }
-
- public void setSelectionContext(String selectionContext) {
- this.selectionContext = selectionContext;
- }
-
- public String getSelectionContext() {
- return selectionContext;
- }
-
- public void setSelectedText(String selectedText) {
- this.selectedText = selectedText;
- }
-
- public String getSelectedText() {
- return selectedText;
- }
-
- public void addEntityAnnotation(EntityAnnotation ea) {
- entityAnnotations.add(ea);
- }
-
- public List<EntityAnnotation> getEntityAnnotations() {
- return entityAnnotations;
- }
-
- public void addAttribute(String key, String value) {
- if (attributes.containsKey(key)) {
- List<String> val = attributes.remove(key);
- val.add(value);
- attributes.put(key, val);
- } else {
- List<String> val = new LinkedList<String>();
- val.add(value);
- attributes.put(key, val);
- }
- }
-
- public List<String> getAttribute(String key) {
- return attributes.get(key);
- }
-
- public void setStartIndex(int startIndex) {
- this.startIndex = startIndex;
- }
-
- public int getStartIndex() {
- return startIndex;
- }
-
- public void setEndIndex(int endIndex) {
- this.endIndex = endIndex;
- }
-
- public int getEndIndex() {
- return endIndex;
- }
-
- public Object getTransferData(DataFlavor flavor)
- throws UnsupportedFlavorException, IOException {
- return this;
- }
-
- public DataFlavor[] getTransferDataFlavors() {
- return null;
- }
-
- public boolean isDataFlavorSupported(DataFlavor flavor) {
- return true;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof TextAnnotation) {
- return ((TextAnnotation) o).name.equals(name);
- }
- return false;
- }
-
- public void retainTypeAnnotation(String type) {
- List<String> t = new LinkedList<String>();
- t.add(type);
- attributes.put("type", t);
- }
-
- public void clearEntityAnnotation() {
- entityAnnotations.clear();
- }
-
- public void clearTypeAnnotation() {
- attributes.remove("type");
- }
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5865576334353943605L;
+ private String name;
+ private String creator;
+ private String created;
+ private String selectionContext;
+ private String selectedText;
+ private int startIndex;
+ private int endIndex;
+
+ private List<EntityAnnotation> entityAnnotations;
+ private Hashtable<String, List<String>> attributes;
+
+ public TextAnnotation() {
+ entityAnnotations = new LinkedList<EntityAnnotation>();
+ attributes = new Hashtable<String, List<String>>();
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setCreator(String creator) {
+ this.creator = creator;
+ }
+
+ public String getCreator() {
+ return creator;
+ }
+
+ public void setCreated(String created) {
+ this.created = created;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public void setSelectionContext(String selectionContext) {
+ this.selectionContext = selectionContext;
+ }
+
+ public String getSelectionContext() {
+ return selectionContext;
+ }
+
+ public void setSelectedText(String selectedText) {
+ this.selectedText = selectedText;
+ }
+
+ public String getSelectedText() {
+ return selectedText;
+ }
+
+ public void addEntityAnnotation(EntityAnnotation ea) {
+ entityAnnotations.add(ea);
+ }
+
+ public List<EntityAnnotation> getEntityAnnotations() {
+ return entityAnnotations;
+ }
+
+ public void addAttribute(String key, String value) {
+ if (attributes.containsKey(key)) {
+ List<String> val = attributes.remove(key);
+ val.add(value);
+ attributes.put(key, val);
+ } else {
+ List<String> val = new LinkedList<String>();
+ val.add(value);
+ attributes.put(key, val);
+ }
+ }
+
+ public List<String> getAttribute(String key) {
+ return attributes.get(key);
+ }
+
+ public void setStartIndex(int startIndex) {
+ this.startIndex = startIndex;
+ }
+
+ public int getStartIndex() {
+ return startIndex;
+ }
+
+ public void setEndIndex(int endIndex) {
+ this.endIndex = endIndex;
+ }
+
+ public int getEndIndex() {
+ return endIndex;
+ }
+
+ public Object getTransferData(DataFlavor flavor)
+ throws UnsupportedFlavorException, IOException {
+ return this;
+ }
+
+ public DataFlavor[] getTransferDataFlavors() {
+ return null;
+ }
+
+ public boolean isDataFlavorSupported(DataFlavor flavor) {
+ return true;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof TextAnnotation) {
+ return ((TextAnnotation) o).name.equals(name);
+ }
+ return false;
+ }
+
+ public void retainTypeAnnotation(String type) {
+ List<String> t = new LinkedList<String>();
+ t.add(type);
+ attributes.put("type", t);
+ }
+
+ public void clearEntityAnnotation() {
+ entityAnnotations.clear();
+ }
+
+ public void clearTypeAnnotation() {
+ attributes.remove("type");
+ }
}
Modified: incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/Util.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/Util.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/Util.java (original)
+++ incubator/stanbol/trunk/fise/SemiAutomaticContentEnhancer/src/main/java/eu/iksproject/fise/sace/util/Util.java Sun Dec 12 16:10:48 2010
@@ -10,29 +10,29 @@ import org.jrdf.parser.RdfReader;
public class Util {
- private static SAXBuilder xmlParser;
+ private static SAXBuilder xmlParser;
- static {
- xmlParser = new SAXBuilder();
- }
-
- public static Document transformToXML (String xml) {
- StringReader inReader = new StringReader(xml);
- Document doc = null;
- try {
- doc = xmlParser.build(inReader);
-
- return doc;
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- }
-
- public static Graph parseXML (String xml) {
- RdfReader reader = new RdfReader();
- return reader.parseRdfXml(new ByteArrayInputStream(xml.getBytes()));
- }
+ static {
+ xmlParser = new SAXBuilder();
+ }
+
+ public static Document transformToXML (String xml) {
+ StringReader inReader = new StringReader(xml);
+ Document doc = null;
+ try {
+ doc = xmlParser.build(inReader);
+
+ return doc;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public static Graph parseXML (String xml) {
+ RdfReader reader = new RdfReader();
+ return reader.parseRdfXml(new ByteArrayInputStream(xml.getBytes()));
+ }
}
Modified: incubator/stanbol/trunk/fise/clerezza/clerezza-sparql/src/main/java/eu/iksproject/fise/clerezza/sparql/ClerezzaSparqlQueryEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/clerezza/clerezza-sparql/src/main/java/eu/iksproject/fise/clerezza/sparql/ClerezzaSparqlQueryEngine.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/clerezza/clerezza-sparql/src/main/java/eu/iksproject/fise/clerezza/sparql/ClerezzaSparqlQueryEngine.java (original)
+++ incubator/stanbol/trunk/fise/clerezza/clerezza-sparql/src/main/java/eu/iksproject/fise/clerezza/sparql/ClerezzaSparqlQueryEngine.java Sun Dec 12 16:10:48 2010
@@ -1,7 +1,6 @@
package eu.iksproject.fise.clerezza.sparql;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.Set;
import org.apache.clerezza.rdf.core.MGraph;
Modified: incubator/stanbol/trunk/fise/clerezza/eu.iksproject.fise.clerezza/src/main/java/eu/iksproject/fise/clerezza/ClerezzaStore.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/clerezza/eu.iksproject.fise.clerezza/src/main/java/eu/iksproject/fise/clerezza/ClerezzaStore.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/clerezza/eu.iksproject.fise.clerezza/src/main/java/eu/iksproject/fise/clerezza/ClerezzaStore.java (original)
+++ incubator/stanbol/trunk/fise/clerezza/eu.iksproject.fise.clerezza/src/main/java/eu/iksproject/fise/clerezza/ClerezzaStore.java Sun Dec 12 16:10:48 2010
@@ -45,12 +45,12 @@ public class ClerezzaStore implements St
// {@link put} method.
UriRef uriRef = new UriRef(id);
- MGraph metadataGraph;
- try {
+ MGraph metadataGraph;
+ try {
metadataGraph = tcManager.createMGraph(uriRef);
- } catch (EntityAlreadyExistsException ex) {
- return null;
- }
+ } catch (EntityAlreadyExistsException ex) {
+ return null;
+ }
handler.put(new UriRef(id), MediaType.valueOf(contentType), content);
ContentItem contentItem = new ClerezzaContentItem(new GraphNode(uriRef,
cgProvider.getContentGraph()), new SimpleMGraph(metadataGraph), handler);
@@ -66,12 +66,12 @@ public class ClerezzaStore implements St
public ContentItem get(String id) {
UriRef uriRef = new UriRef(id);
- MGraph metadataGraph;
- try {
- metadataGraph = tcManager.getMGraph(uriRef);
- } catch(NoSuchEntityException ex) {
- throw new IllegalArgumentException("Is not a content item");
- }
+ MGraph metadataGraph;
+ try {
+ metadataGraph = tcManager.getMGraph(uriRef);
+ } catch(NoSuchEntityException ex) {
+ throw new IllegalArgumentException("Is not a content item");
+ }
ContentItem contentItem = new ClerezzaContentItem(new GraphNode(uriRef,
cgProvider.getContentGraph()), metadataGraph, handler);
return contentItem;
Modified: incubator/stanbol/trunk/fise/clerezza/eu.iksproject.fise.clerezza/src/main/java/eu/iksproject/fise/clerezza/FiseHandler.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/clerezza/eu.iksproject.fise.clerezza/src/main/java/eu/iksproject/fise/clerezza/FiseHandler.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/clerezza/eu.iksproject.fise.clerezza/src/main/java/eu/iksproject/fise/clerezza/FiseHandler.java (original)
+++ incubator/stanbol/trunk/fise/clerezza/eu.iksproject.fise.clerezza/src/main/java/eu/iksproject/fise/clerezza/FiseHandler.java Sun Dec 12 16:10:48 2010
@@ -7,7 +7,6 @@ package eu.iksproject.fise.clerezza;
import eu.iksproject.fise.servicesapi.Store;
-import java.util.Iterator;
import java.util.ArrayList;
import java.util.Set;
import javax.ws.rs.FormParam;
@@ -41,22 +40,22 @@ import org.apache.clerezza.rdf.utils.Uni
@Path("/fise")
public class FiseHandler {
- @Reference
- Store store;
+ @Reference
+ Store store;
- @Reference
- TcManager tcManager;
+ @Reference
+ TcManager tcManager;
- @GET
- public MGraph getFiseMetadata(@QueryParam("uri") UriRef uri) {
- return store.get(uri.getUnicodeString()).getMetadata();
- }
-
- @POST
- public ResultSet sparql(@FormParam(value="query") String sqarqlQuery) throws ParseException {
- SelectQuery query = (SelectQuery)QueryParser.getInstance().parse(sqarqlQuery);
- Set<UriRef> graphUris = tcManager.listTripleCollections();
- ArrayList<TripleCollection> tripleCollections = new ArrayList<TripleCollection>();
+ @GET
+ public MGraph getFiseMetadata(@QueryParam("uri") UriRef uri) {
+ return store.get(uri.getUnicodeString()).getMetadata();
+ }
+
+ @POST
+ public ResultSet sparql(@FormParam(value="query") String sqarqlQuery) throws ParseException {
+ SelectQuery query = (SelectQuery)QueryParser.getInstance().parse(sqarqlQuery);
+ Set<UriRef> graphUris = tcManager.listTripleCollections();
+ ArrayList<TripleCollection> tripleCollections = new ArrayList<TripleCollection>();
for (UriRef uriRef : graphUris) {
try {
tripleCollections.add(tcManager.getTriples(uriRef));
@@ -64,9 +63,9 @@ public class FiseHandler {
continue;
}
}
- MGraph unionGraph = new UnionMGraph(tripleCollections.toArray(new TripleCollection[0]));
- ResultSet resultSet = tcManager.executeSparqlQuery(query, unionGraph);
- return resultSet;
- }
+ MGraph unionGraph = new UnionMGraph(tripleCollections.toArray(new TripleCollection[0]));
+ ResultSet resultSet = tcManager.executeSparqlQuery(query, unionGraph);
+ return resultSet;
+ }
}
Modified: incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/AutotaggingServlet.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/AutotaggingServlet.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/AutotaggingServlet.java (original)
+++ incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/AutotaggingServlet.java Sun Dec 12 16:10:48 2010
@@ -52,48 +52,48 @@ public class AutotaggingServlet extends
/** Create a ContentItem and queue for enhancement */
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
- doGet(req,resp);
+ doGet(req,resp);
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
- String labelParam = getEntityName(req);
- String typeParam = getEntityType(req);
- Autotagger autotagger = provider.getAutotagger();
- List<TagInfo> suggestions;
- if(typeParam == null){
- suggestions = autotagger.suggest(labelParam);
- } else {
- suggestions = autotagger.suggestForType(labelParam, typeParam);
- }
- //encode the results and sent it back to the client
- resp.setContentType("text/json");
+ String labelParam = getEntityName(req);
+ String typeParam = getEntityType(req);
+ Autotagger autotagger = provider.getAutotagger();
+ List<TagInfo> suggestions;
+ if(typeParam == null){
+ suggestions = autotagger.suggest(labelParam);
+ } else {
+ suggestions = autotagger.suggestForType(labelParam, typeParam);
+ }
+ //encode the results and sent it back to the client
+ resp.setContentType("text/json");
resp.setCharacterEncoding("UTF-8");
Writer writer = resp.getWriter();
JSONObject suggestionList = new JSONObject();
List<Map<String, Object>> suggestionObjects = new ArrayList<Map<String,Object>>(suggestions.size());
- for (TagInfo suggestion : suggestions){
- Map<String,Object> map = new HashMap<String, Object>();
- map.put("uri", suggestion.getId());
- map.put("label",suggestion.getLabel());
- map.put("type",suggestion.getType());
- map.put("confidence", suggestion.getConfidence());
- suggestionObjects.add(map);
- }
- try {
- suggestionList.put("suggestion", suggestionObjects);
- } catch (JSONException e) {
- log.error("Unable to encode suggestions as JSON",e);
+ for (TagInfo suggestion : suggestions){
+ Map<String,Object> map = new HashMap<String, Object>();
+ map.put("uri", suggestion.getId());
+ map.put("label",suggestion.getLabel());
+ map.put("type",suggestion.getType());
+ map.put("confidence", suggestion.getConfidence());
+ suggestionObjects.add(map);
+ }
+ try {
+ suggestionList.put("suggestion", suggestionObjects);
+ } catch (JSONException e) {
+ log.error("Unable to encode suggestions as JSON",e);
resp.sendError(500, e.getMessage());
return;
- }
- writer.append(suggestionList.toString());
+ }
+ writer.append(suggestionList.toString());
}
private String getEntityName(HttpServletRequest r) {
- final String result = r.getParameter("name");
+ final String result = r.getParameter("name");
if (result == null || result.length() == 0) {
throw new IllegalArgumentException(
"Missing Parameter name, request should include parameter \"name\"");
@@ -102,12 +102,12 @@ public class AutotaggingServlet extends
}
private String getEntityType(HttpServletRequest r) {
- final String result = r.getParameter("type");
-// if(result == null){
-// return null;
-// } else {
-// //convert the Type to the Ontology
-// }
+ final String result = r.getParameter("type");
+// if(result == null){
+// return null;
+// } else {
+// //convert the Type to the Ontology
+// }
return result;
}
@Activate
@@ -121,4 +121,4 @@ public class AutotaggingServlet extends
httpService.unregister(ALIAS);
log.info("Servlet unregistered from {}", ALIAS);
}
-}
\ No newline at end of file
+}
Modified: incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/EnhancementRDFUtils.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/EnhancementRDFUtils.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/EnhancementRDFUtils.java (original)
+++ incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/EnhancementRDFUtils.java Sun Dec 12 16:10:48 2010
@@ -20,36 +20,36 @@ public class EnhancementRDFUtils {
}
/**
- * @param literalFactory the LiteralFactory to use
- * @param graph the MGraph to use
- * @param contentItemId the contentItemId the enhancement is extracted from
- * @param relatedEnhancements enhancements this textAnnotation is related to
- * @param tag the related entity
- */
- public static UriRef writeEntityAnnotation(EnhancementEngine engine, LiteralFactory literalFactory,
+ * @param literalFactory the LiteralFactory to use
+ * @param graph the MGraph to use
+ * @param contentItemId the contentItemId the enhancement is extracted from
+ * @param relatedEnhancements enhancements this textAnnotation is related to
+ * @param tag the related entity
+ */
+ public static UriRef writeEntityAnnotation(EnhancementEngine engine, LiteralFactory literalFactory,
MGraph graph, UriRef contentItemId, Collection<NonLiteral> relatedEnhancements, TagInfo tag) {
- UriRef entityAnnotation = EnhancementEngineHelper.createEntityEnhancement(
- graph, engine, contentItemId);
- // first relate this entity annotation to the text annotation(s)
- for (NonLiteral enhancement: relatedEnhancements){
- graph.add(new TripleImpl(entityAnnotation,
- DC_RELATION, enhancement));
- }
- UriRef entityUri = new UriRef(tag.getId());
- // add the link to the referred entity
- graph.add(new TripleImpl(entityAnnotation,
- FISE_ENTITY_REFERENCE, entityUri));
- graph.add(new TripleImpl(entityAnnotation,
- FISE_ENTITY_LABEL,
- literalFactory.createTypedLiteral(tag.getLabel())));
- graph.add(new TripleImpl(entityAnnotation,
- FISE_CONFIDENCE,
- literalFactory.createTypedLiteral(tag.getConfidence())));
- for (String entityType : tag.getType()) {
- graph.add(new TripleImpl(entityAnnotation,
- FISE_ENTITY_TYPE, new UriRef(entityType)));
- }
- return entityAnnotation;
- }
+ UriRef entityAnnotation = EnhancementEngineHelper.createEntityEnhancement(
+ graph, engine, contentItemId);
+ // first relate this entity annotation to the text annotation(s)
+ for (NonLiteral enhancement: relatedEnhancements){
+ graph.add(new TripleImpl(entityAnnotation,
+ DC_RELATION, enhancement));
+ }
+ UriRef entityUri = new UriRef(tag.getId());
+ // add the link to the referred entity
+ graph.add(new TripleImpl(entityAnnotation,
+ FISE_ENTITY_REFERENCE, entityUri));
+ graph.add(new TripleImpl(entityAnnotation,
+ FISE_ENTITY_LABEL,
+ literalFactory.createTypedLiteral(tag.getLabel())));
+ graph.add(new TripleImpl(entityAnnotation,
+ FISE_CONFIDENCE,
+ literalFactory.createTypedLiteral(tag.getConfidence())));
+ for (String entityType : tag.getType()) {
+ graph.add(new TripleImpl(entityAnnotation,
+ FISE_ENTITY_TYPE, new UriRef(entityType)));
+ }
+ return entityAnnotation;
+ }
}
Modified: incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/RelatedTopicEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/RelatedTopicEnhancementEngine.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/RelatedTopicEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/fise/engines/autotagging/src/main/java/eu/iksproject/fise/engines/autotagging/impl/RelatedTopicEnhancementEngine.java Sun Dec 12 16:10:48 2010
@@ -81,9 +81,9 @@ public class RelatedTopicEnhancementEngi
List<TagInfo> suggestions = autotagger.suggestForType(text, type);
Collection<NonLiteral> noRelatedEnhancements = Collections.emptyList();
for (TagInfo tag : suggestions) {
- EnhancementRDFUtils.writeEntityAnnotation(this, literalFactory,
- graph, contentItemId,
- noRelatedEnhancements, tag);
+ EnhancementRDFUtils.writeEntityAnnotation(this, literalFactory,
+ graph, contentItemId,
+ noRelatedEnhancements, tag);
}
} catch (IOException e) {
throw new EngineException(this, ci, e);
@@ -91,7 +91,7 @@ public class RelatedTopicEnhancementEngi
}
public int canEnhance(ContentItem ci) {
- String mimeType = ci.getMimeType().split(";",2)[0];
+ String mimeType = ci.getMimeType().split(";",2)[0];
if (TEXT_PLAIN_MIMETYPE.equalsIgnoreCase(mimeType)) {
return ENHANCE_SYNCHRONOUS;
}
Modified: incubator/stanbol/trunk/fise/engines/entitytagging/src/main/java/eu/iksproject/fise/engines/entitytagging/impl/EnhancementRDFUtils.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/entitytagging/src/main/java/eu/iksproject/fise/engines/entitytagging/impl/EnhancementRDFUtils.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/entitytagging/src/main/java/eu/iksproject/fise/engines/entitytagging/impl/EnhancementRDFUtils.java (original)
+++ incubator/stanbol/trunk/fise/engines/entitytagging/src/main/java/eu/iksproject/fise/engines/entitytagging/impl/EnhancementRDFUtils.java Sun Dec 12 16:10:48 2010
@@ -14,16 +14,12 @@ import org.apache.clerezza.rdf.core.impl
import eu.iksproject.fise.servicesapi.EnhancementEngine;
import eu.iksproject.fise.servicesapi.helper.EnhancementEngineHelper;
-import eu.iksproject.fise.servicesapi.rdf.Properties;
-import eu.iksproject.rick.model.clerezza.RdfRepresentation;
-import eu.iksproject.rick.model.clerezza.RdfValueFactory;
import eu.iksproject.rick.servicesapi.model.Reference;
import eu.iksproject.rick.servicesapi.model.Sign;
import eu.iksproject.rick.servicesapi.model.Text;
import eu.iksproject.rick.servicesapi.model.rdf.RdfResourceEnum;
import static eu.iksproject.fise.servicesapi.rdf.Properties.*;
-import static eu.iksproject.fise.servicesapi.rdf.Properties.RDFS_LABEL;
/**
* Utility taken form the engine.autotagging bundle and adapted from
@@ -34,77 +30,77 @@ import static eu.iksproject.fise.service
*/
public class EnhancementRDFUtils {
- /**
- * @param literalFactory the LiteralFactory to use
- * @param graph the MGraph to use
- * @param contentItemId the contentItemId the enhancement is extracted from
- * @param relatedEnhancements enhancements this textAnnotation is related to
- * @param entity the related entity
- */
- public static UriRef writeEntityAnnotation(EnhancementEngine engine, LiteralFactory literalFactory, MGraph graph, UriRef contentItemId, Collection<NonLiteral> relatedEnhancements, Sign entity) {
- //1. check if the returned Entity does has a label -> if not return null
- //add labels (set only a single label. Use "en" if available!
- Text label = null;
- for (Iterator<Text> labels = entity.getRepresentation().getText(RDFS_LABEL.getUnicodeString());labels.hasNext();){
- Text actLabel = labels.next();
- if(label == null){
- label = actLabel;
- } else {
- if("en".equals(actLabel.getLanguage())){
- label = actLabel;
- }
- }
- }
+ /**
+ * @param literalFactory the LiteralFactory to use
+ * @param graph the MGraph to use
+ * @param contentItemId the contentItemId the enhancement is extracted from
+ * @param relatedEnhancements enhancements this textAnnotation is related to
+ * @param entity the related entity
+ */
+ public static UriRef writeEntityAnnotation(EnhancementEngine engine, LiteralFactory literalFactory,
+ MGraph graph, UriRef contentItemId, Collection<NonLiteral> relatedEnhancements, Sign entity) {
+ //1. check if the returned Entity does has a label -> if not return null
+ //add labels (set only a single label. Use "en" if available!
+ Text label = null;
+ Iterator<Text> labels = entity.getRepresentation().getText(RDFS_LABEL.getUnicodeString());
+ while (labels.hasNext()) {
+ Text actLabel = labels.next();
+ if(label == null){
+ label = actLabel;
+ } else {
+ if("en".equals(actLabel.getLanguage())){
+ label = actLabel;
+ }
+ }
+ }
if (label == null){
- return null;
- }
+ return null;
+ }
Literal literal;
if (label.getLanguage() == null){
- literal = new PlainLiteralImpl(label.getText());
- } else {
- literal = new PlainLiteralImpl(label.getText(), new Language(label.getLanguage()));
- }
- //Now create the entityAnnotation
- UriRef entityAnnotation = EnhancementEngineHelper.createEntityEnhancement(
- graph, engine, contentItemId);
- // first relate this entity annotation to the text annotation(s)
- for (NonLiteral enhancement: relatedEnhancements){
- graph.add(new TripleImpl(entityAnnotation, DC_RELATION, enhancement));
- }
- UriRef entityUri = new UriRef(entity.getId());
- // add the link to the referred entity
- graph.add(new TripleImpl(entityAnnotation,
- FISE_ENTITY_REFERENCE, entityUri));
- //add the label parsed above
- graph.add(new TripleImpl(entityAnnotation,
- FISE_ENTITY_LABEL,
- literal));
- //TODO: add real confidence values!
- // -> in case of SolrYards this will be a Lucene score and not within the range [0..1]
- // -> in case of SPARQL there will be no score information at all.
- Object score = entity.getRepresentation().getFirst(RdfResourceEnum.resultScore.getUri());
- Double scoreValue = new Double(-1); //use -1 if no score is available!
- if (score != null){
- try {
- scoreValue = Double.valueOf(score.toString());
- } catch (NumberFormatException e) {
- //ignore
- }
- }
- graph.add(new TripleImpl(entityAnnotation,
- FISE_CONFIDENCE,
- literalFactory.createTypedLiteral(scoreValue)));
-
- for (Iterator<Reference> types = entity.getRepresentation().getReferences(RDF_TYPE.getUnicodeString());types.hasNext();){
- graph.add(new TripleImpl(entityAnnotation,
- FISE_ENTITY_TYPE, new UriRef(types.next().getReference())));
- }
- //TODO: for now add the information about this entity to the graph
- // -> this might be replaced by some additional engine at the end
-// RdfValueFactory rdfValueFactory = RdfValueFactory.getInstance();
-// RdfRepresentation representation = rdfValueFactory.toRdfRepresentation(entity.getRepresentation());
-// graph.addAll(representation.getRdfGraph());
- return entityAnnotation;
- }
+ literal = new PlainLiteralImpl(label.getText());
+ } else {
+ literal = new PlainLiteralImpl(label.getText(), new Language(label.getLanguage()));
+ }
+ //Now create the entityAnnotation
+ UriRef entityAnnotation = EnhancementEngineHelper.createEntityEnhancement(
+ graph, engine, contentItemId);
+ // first relate this entity annotation to the text annotation(s)
+ for (NonLiteral enhancement: relatedEnhancements){
+ graph.add(new TripleImpl(entityAnnotation, DC_RELATION, enhancement));
+ }
+ UriRef entityUri = new UriRef(entity.getId());
+ // add the link to the referred entity
+ graph.add(new TripleImpl(entityAnnotation, FISE_ENTITY_REFERENCE, entityUri));
+ //add the label parsed above
+ graph.add(new TripleImpl(entityAnnotation, FISE_ENTITY_LABEL, literal));
+ //TODO: add real confidence values!
+ // -> in case of SolrYards this will be a Lucene score and not within the range [0..1]
+ // -> in case of SPARQL there will be no score information at all.
+ Object score = entity.getRepresentation().getFirst(RdfResourceEnum.resultScore.getUri());
+ Double scoreValue = new Double(-1); //use -1 if no score is available!
+ if (score != null){
+ try {
+ scoreValue = Double.valueOf(score.toString());
+ } catch (NumberFormatException e) {
+ //ignore
+ }
+ }
+ graph.add(new TripleImpl(entityAnnotation,
+ FISE_CONFIDENCE,
+ literalFactory.createTypedLiteral(scoreValue)));
+
+ Iterator<Reference> types = entity.getRepresentation().getReferences(RDF_TYPE.getUnicodeString());
+ while (types.hasNext()) {
+ graph.add(new TripleImpl(entityAnnotation,
+ FISE_ENTITY_TYPE, new UriRef(types.next().getReference())));
+ }
+ //TODO: for now add the information about this entity to the graph
+ // -> this might be replaced by some additional engine at the end
+// RdfValueFactory rdfValueFactory = RdfValueFactory.getInstance();
+// RdfRepresentation representation = rdfValueFactory.toRdfRepresentation(entity.getRepresentation());
+// graph.addAll(representation.getRdfGraph());
+ return entityAnnotation;
+ }
}
Modified: incubator/stanbol/trunk/fise/engines/entitytagging/src/main/java/eu/iksproject/fise/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/entitytagging/src/main/java/eu/iksproject/fise/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/entitytagging/src/main/java/eu/iksproject/fise/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/fise/engines/entitytagging/src/main/java/eu/iksproject/fise/engines/entitytagging/impl/ReferencedSiteEntityTaggingEnhancementEngine.java Sun Dec 12 16:10:48 2010
@@ -65,7 +65,7 @@ public class ReferencedSiteEntityTagging
ServiceProperties {
private final Logger log = LoggerFactory.getLogger(getClass());
-
+
@Property(value="dbPedia")
public static final String REFERENCED_SITE_ID = "eu.iksprojet.fise.engines.entitytagging.referencedSiteId";
@Property(boolValue=true)
@@ -82,7 +82,7 @@ public class ReferencedSiteEntityTagging
public static final String PLACE_TYPE = "eu.iksprojet.fise.engines.entitytagging.placeType";
@Property(value="rdfs:label")
public static final String NAME_FIELD = "eu.iksprojet.fise.engines.entitytagging.nameField";
-
+
/**
* Service of the RICK that manages all the active referenced Site.
* This Service is used to lookup the configured Referenced Site when we
@@ -107,13 +107,13 @@ public class ReferencedSiteEntityTagging
* are enhanced by this engine
*/
protected boolean personState;
-
+
/**
* State if text annotations of type {@link OntologicalClasses#DBPEDIA_ORGANISATION}
* are enhanced by this engine
*/
protected boolean orgState;
-
+
/**
* State if text annotations of type {@link OntologicalClasses#DBPEDIA_PLACE}
* are enhanced by this engine
@@ -124,13 +124,13 @@ public class ReferencedSiteEntityTagging
* if no type constraint should be used
*/
protected String personType;
-
+
/**
* The rdf:type constraint used to search for organisations or <code>null</code>
* if no type constraint should be used
*/
protected String orgType;
-
+
/**
* The rdf:type constraint used to search for places or <code>null</code>
* if no type constraint should be used
@@ -139,62 +139,64 @@ public class ReferencedSiteEntityTagging
/**
* The field used to search for the selected text of the TextAnnotation.
*/
- private String nameField;
- /**
- * The number of Suggestions to be added
- */
- public Integer numSuggestions = 3;
-
+ private String nameField;
+ /**
+ * The number of Suggestions to be added
+ */
+ public Integer numSuggestions = 3;
+
@SuppressWarnings("unchecked")
- @Activate
- protected void activate(ComponentContext context) throws ConfigurationException {
- Dictionary<String, Object> config = context.getProperties();
- Object referencedSiteID = config.get(REFERENCED_SITE_ID);
+ @Activate
+ protected void activate(ComponentContext context) throws ConfigurationException {
+ Dictionary<String, Object> config = context.getProperties();
+ Object referencedSiteID = config.get(REFERENCED_SITE_ID);
if (referencedSiteID == null) {
- throw new ConfigurationException(REFERENCED_SITE_ID, "The ID of the Referenced Site is a required Parameter and MUST NOT be NULL!");
+ throw new ConfigurationException(REFERENCED_SITE_ID,
+ "The ID of the Referenced Site is a required Parameter and MUST NOT be NULL!");
}
this.referencedSiteID = referencedSiteID.toString();
- if(this.referencedSiteID.isEmpty()){
- throw new ConfigurationException(REFERENCED_SITE_ID, "The ID of the Referenced Site is a required Parameter and MUST NOT be an empty String!");
+ if (this.referencedSiteID.isEmpty()){
+ throw new ConfigurationException(REFERENCED_SITE_ID,
+ "The ID of the Referenced Site is a required Parameter and MUST NOT be an empty String!");
}
Object state = config.get(PERSON_STATE);
personState = state == null ? true : Boolean.parseBoolean(state.toString());
- state = config.get(ORG_STATE);
+ state = config.get(ORG_STATE);
orgState = state == null ? true : Boolean.parseBoolean(state.toString());
- state = config.get(PLACE_STATE);
+ state = config.get(PLACE_STATE);
placeState = state == null ? true : Boolean.parseBoolean(state.toString());
- Object type = config.get(PERSON_TYPE);
+ Object type = config.get(PERSON_TYPE);
personType = type == null || type.toString().isEmpty() ? null : NamespaceEnum.getFullName(type.toString());
- type = config.get(ORG_TYPE);
+ type = config.get(ORG_TYPE);
orgType = type == null || type.toString().isEmpty() ? null : NamespaceEnum.getFullName(type.toString());
- type = config.get(PLACE_TYPE);
+ type = config.get(PLACE_TYPE);
placeType = type == null || type.toString().isEmpty() ? null : NamespaceEnum.getFullName(type.toString());
- Object nameField = config.get(NAME_FIELD);
- this.nameField = nameField == null || nameField.toString().isEmpty() ? NamespaceEnum.rdfs+"label" : NamespaceEnum.getFullName(nameField.toString());
- }
+ Object nameField = config.get(NAME_FIELD);
+ this.nameField = nameField == null || nameField.toString().isEmpty() ? NamespaceEnum.rdfs+"label" : NamespaceEnum.getFullName(nameField.toString());
+ }
- @Deactivate
- protected void deactivate(ComponentContext context) {
+ @Deactivate
+ protected void deactivate(ComponentContext context) {
referencedSiteID = null;
personType = null;
orgType = null;
placeType = null;
nameField = null;
- }
+ }
public void computeEnhancements(ContentItem ci) throws EngineException {
- ReferencedSite site = siteManager.getReferencedSite(referencedSiteID);
- if(site == null){
- String msg = String.format("Unable to enhance %s because Referenced Site %s is currently not active!",
- ci.getId(), referencedSiteID);
- log.warn(msg);
- //TODO: throwing Exceptions is currently deactivated. We need a more clear
- //policy what do to in such situations
- //throw new EngineException(msg);
- return;
- }
- UriRef contentItemId = new UriRef(ci.getId());
+ ReferencedSite site = siteManager.getReferencedSite(referencedSiteID);
+ if(site == null){
+ String msg = String.format("Unable to enhance %s because Referenced Site %s is currently not active!",
+ ci.getId(), referencedSiteID);
+ log.warn(msg);
+ //TODO: throwing Exceptions is currently deactivated. We need a more clear
+ //policy what do to in such situations
+ //throw new EngineException(msg);
+ return;
+ }
+ UriRef contentItemId = new UriRef(ci.getId());
MGraph graph = ci.getMetadata();
LiteralFactory literalFactory = LiteralFactory.getInstance();
@@ -255,29 +257,29 @@ public class ReferencedSiteEntityTagging
//replace spaces with plus to create an AND search for all words in the name!
query.setConstraint(nameField, new TextConstraint(name.replace(' ', '+')));
if (OntologicalClasses.DBPEDIA_PERSON.equals(type)){
- if (personState){
- if (personType!=null){
- query.setConstraint(RDF_TYPE.getUnicodeString(), new ReferenceConstraint(personType));
- } // else no type constraint
- } else { //ignore people
- return Collections.emptyList();
- }
+ if (personState){
+ if (personType!=null){
+ query.setConstraint(RDF_TYPE.getUnicodeString(), new ReferenceConstraint(personType));
+ } // else no type constraint
+ } else { //ignore people
+ return Collections.emptyList();
+ }
} else if (DBPEDIA_ORGANISATION.equals(type)){
- if (orgState){
- if (orgType!=null){
- query.setConstraint(RDF_TYPE.getUnicodeString(), new ReferenceConstraint(orgType));
- } // else no type constraint
- } else { //ignore people
- return Collections.emptyList();
- }
+ if (orgState){
+ if (orgType!=null){
+ query.setConstraint(RDF_TYPE.getUnicodeString(), new ReferenceConstraint(orgType));
+ } // else no type constraint
+ } else { //ignore people
+ return Collections.emptyList();
+ }
} else if(OntologicalClasses.DBPEDIA_PLACE.equals(type)){
- if (this.placeState){
- if (this.placeType!=null){
- query.setConstraint(RDF_TYPE.getUnicodeString(), new ReferenceConstraint(placeType));
- } // else no type constraint
- } else { //ignore people
- return Collections.emptyList();
- }
+ if (this.placeState){
+ if (this.placeType!=null){
+ query.setConstraint(RDF_TYPE.getUnicodeString(), new ReferenceConstraint(placeType));
+ } // else no type constraint
+ } else { //ignore people
+ return Collections.emptyList();
+ }
}
query.setLimit(this.numSuggestions);
QueryResultList<Sign> results = site.findSigns(query);
Modified: incubator/stanbol/trunk/fise/engines/entitytagging/src/test/java/eu/iksproject/fise/engines/entitytagging/impl/TestEntityLinkingEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/entitytagging/src/test/java/eu/iksproject/fise/engines/entitytagging/impl/TestEntityLinkingEnhancementEngine.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/entitytagging/src/test/java/eu/iksproject/fise/engines/entitytagging/impl/TestEntityLinkingEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/fise/engines/entitytagging/src/test/java/eu/iksproject/fise/engines/entitytagging/impl/TestEntityLinkingEnhancementEngine.java Sun Dec 12 16:10:48 2010
@@ -1,5 +1,8 @@
package eu.iksproject.fise.engines.entitytagging.impl;
+import static eu.iksproject.fise.servicesapi.rdf.Properties.*;
+import static eu.iksproject.fise.servicesapi.rdf.TechnicalClasses.FISE_ENTITYANNOTATION;
+import static eu.iksproject.fise.servicesapi.rdf.TechnicalClasses.FISE_TEXTANNOTATION;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@@ -20,51 +23,50 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-import eu.iksproject.fise.engines.entitytagging.impl.ReferencedSiteEntityTaggingEnhancementEngine;
import eu.iksproject.fise.servicesapi.ContentItem;
import eu.iksproject.fise.servicesapi.TextAnnotation;
import eu.iksproject.fise.servicesapi.helper.RdfEntityFactory;
-import eu.iksproject.fise.servicesapi.rdf.Properties;
-import eu.iksproject.fise.servicesapi.rdf.TechnicalClasses;
public class TestEntityLinkingEnhancementEngine {
- /**
- * The context for the tests (same as in TestOpenNLPEnhancementEngine)
- */
- public static final String CONTEXT = "Dr. Patrick Marshall (1869 - November 1950) was a"
+ /**
+ * The context for the tests (same as in TestOpenNLPEnhancementEngine)
+ */
+ public static final String CONTEXT = "Dr. Patrick Marshall (1869 - November 1950) was a"
+ " geologist who lived in New Zealand and worked at the University of Otago.";
- /**
- * The person for the tests (same as in TestOpenNLPEnhancementEngine)
- */
- public static final String PERSON = "Patrick Marshall";
- /**
- * The organisation for the tests (same as in TestOpenNLPEnhancementEngine)
- */
- public static final String ORGANISATION ="University of Otago";
- /**
- * The place for the tests (same as in TestOpenNLPEnhancementEngine)
- */
- public static final String PLACE = "New Zealand";
-
- static ReferencedSiteEntityTaggingEnhancementEngine entityLinkingEngine = new ReferencedSiteEntityTaggingEnhancementEngine();
+ /**
+ * The person for the tests (same as in TestOpenNLPEnhancementEngine)
+ */
+ public static final String PERSON = "Patrick Marshall";
+ /**
+ * The organisation for the tests (same as in TestOpenNLPEnhancementEngine)
+ */
+ public static final String ORGANISATION ="University of Otago";
+ /**
+ * The place for the tests (same as in TestOpenNLPEnhancementEngine)
+ */
+ public static final String PLACE = "New Zealand";
+
+ static ReferencedSiteEntityTaggingEnhancementEngine entityLinkingEngine
+ = new ReferencedSiteEntityTaggingEnhancementEngine();
@BeforeClass
public static void setUpServices() throws IOException {
}
- @Before
- public void bindServices() throws IOException {
- }
-
- @After
- public void unbindServices() {
- }
+
+ @Before
+ public void bindServices() throws IOException {
+ }
+
+ @After
+ public void unbindServices() {
+ }
@AfterClass
public static void shutdownServices() {
}
- public static ContentItem getContentItem(final String id,
- final String text) {
+
+ public static ContentItem getContentItem(final String id, final String text) {
return new ContentItem() {
SimpleMGraph metadata = new SimpleMGraph();
@@ -86,60 +88,58 @@ public class TestEntityLinkingEnhancemen
}
};
}
-
+
public static void getTextAnnotation(ContentItem ci, String name,String context,UriRef type){
- String content;
- try {
- content = IOUtils.toString(ci.getStream());
- } catch (IOException e) {
- //should never happen anyway!
- content = "";
- }
- RdfEntityFactory factory = RdfEntityFactory.createInstance(ci.getMetadata());
- TextAnnotation testAnnotation = factory.getProxy(new UriRef("urn:iks-project:fise:test:text-annotation:person"), TextAnnotation.class);
- testAnnotation.setCreator(new UriRef("urn:iks-project:fise:test:dummyEngine"));
- testAnnotation.setCreated(new Date());
- testAnnotation.setSelectedText(name);
- testAnnotation.setSelectionContext(context);
- testAnnotation.getDcType().add(type);
- Integer start = content.indexOf(name);
- if(start < 0){ //if not found in the content
- //set some random numbers for start/end
- start = (int)Math.random()*100;
- }
- testAnnotation.setStart(start);
- testAnnotation.setEnd(start+name.length());
+ String content;
+ try {
+ content = IOUtils.toString(ci.getStream());
+ } catch (IOException e) {
+ //should never happen anyway!
+ content = "";
+ }
+ RdfEntityFactory factory = RdfEntityFactory.createInstance(ci.getMetadata());
+ TextAnnotation testAnnotation = factory.getProxy(
+ new UriRef("urn:iks-project:fise:test:text-annotation:person"), TextAnnotation.class);
+ testAnnotation.setCreator(new UriRef("urn:iks-project:fise:test:dummyEngine"));
+ testAnnotation.setCreated(new Date());
+ testAnnotation.setSelectedText(name);
+ testAnnotation.setSelectionContext(context);
+ testAnnotation.getDcType().add(type);
+ Integer start = content.indexOf(name);
+ if (start < 0){ //if not found in the content
+ //set some random numbers for start/end
+ start = (int)Math.random()*100;
+ }
+ testAnnotation.setStart(start);
+ testAnnotation.setEnd(start+name.length());
}
- @Test
+
+ @Test
public void testEntityLinkingEnhancementEngine() throws Exception{
- //TODO: adapt this test to work with this engine
- // -> here the problem is mainly to fake the needed infrastructure
- return;
-// //create a content item
-// ContentItem ci = getContentItem("urn:iks-project:fise:text:content-item:person", CONTEXT);
-// //add three text annotations to be consumed by this test
-// getTextAnnotation(ci, PERSON, CONTEXT, OntologicalClasses.DBPEDIA_PERSON);
-// getTextAnnotation(ci, ORGANISATION, CONTEXT, OntologicalClasses.DBPEDIA_ORGANISATION);
-// getTextAnnotation(ci, PLACE, CONTEXT, OntologicalClasses.DBPEDIA_PLACE);
-// //perform the computation of the enhancements
-// entityLinkingEngine.computeEnhancements(ci);
-// int entityAnnotationCount = checkAllEntityAnnotations(ci.getMetadata());
-// assertEquals(2, entityAnnotationCount);
+ //TODO: adapt this test to work with this engine
+ // -> here the problem is mainly to fake the needed infrastructure
+ return;
+// //create a content item
+// ContentItem ci = getContentItem("urn:iks-project:fise:text:content-item:person", CONTEXT);
+// //add three text annotations to be consumed by this test
+// getTextAnnotation(ci, PERSON, CONTEXT, OntologicalClasses.DBPEDIA_PERSON);
+// getTextAnnotation(ci, ORGANISATION, CONTEXT, OntologicalClasses.DBPEDIA_ORGANISATION);
+// getTextAnnotation(ci, PLACE, CONTEXT, OntologicalClasses.DBPEDIA_PLACE);
+// //perform the computation of the enhancements
+// entityLinkingEngine.computeEnhancements(ci);
+// int entityAnnotationCount = checkAllEntityAnnotations(ci.getMetadata());
+// assertEquals(2, entityAnnotationCount);
}
-
+
/*
* -----------------------------------------------------------------------
* Helper Methods to check Text and EntityAnnotations
* -----------------------------------------------------------------------
*/
-
- /**
- * @param g
- * @return
- */
+
private int checkAllEntityAnnotations(MGraph g) {
Iterator<Triple> entityAnnotationIterator = g.filter(null,
- Properties.RDF_TYPE, TechnicalClasses.FISE_ENTITYANNOTATION);
+ RDF_TYPE, FISE_ENTITYANNOTATION);
int entityAnnotationCount = 0;
while (entityAnnotationIterator.hasNext()) {
UriRef entityAnnotation = (UriRef) entityAnnotationIterator.next().getSubject();
@@ -149,27 +149,25 @@ public class TestEntityLinkingEnhancemen
}
return entityAnnotationCount;
}
+
/**
- * Checks if an entity annotation is valid
- *
- * @param g
- * @param textAnnotation
+ * Checks if an entity annotation is valid.
*/
private void checkEntityAnnotation(MGraph g, UriRef entityAnnotation) {
Iterator<Triple> relationToTextAnnotationIterator = g.filter(
- entityAnnotation, Properties.DC_RELATION, null);
+ 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();
- assertTrue(g.filter(referredTextAnnotation, Properties.RDF_TYPE,
- TechnicalClasses.FISE_TEXTANNOTATION).hasNext());
+ assertTrue(g.filter(referredTextAnnotation, RDF_TYPE,
+ FISE_TEXTANNOTATION).hasNext());
}
// test if an entity is referred
Iterator<Triple> entityReferenceIterator = g.filter(entityAnnotation,
- Properties.FISE_ENTITY_REFERENCE, null);
+ FISE_ENTITY_REFERENCE, null);
assertTrue(entityReferenceIterator.hasNext());
// test if the reference is an URI
assertTrue(entityReferenceIterator.next().getObject() instanceof UriRef);
@@ -178,7 +176,7 @@ public class TestEntityLinkingEnhancemen
// finally test if the entity label is set
Iterator<Triple> entityLabelIterator = g.filter(entityAnnotation,
- Properties.FISE_ENTITY_LABEL, null);
+ FISE_ENTITY_LABEL, null);
assertTrue(entityLabelIterator.hasNext());
}
Modified: incubator/stanbol/trunk/fise/engines/geonames/src/main/java/eu/iksproject/fise/engines/geonames/impl/LocationEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/geonames/src/main/java/eu/iksproject/fise/engines/geonames/impl/LocationEnhancementEngine.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/geonames/src/main/java/eu/iksproject/fise/engines/geonames/impl/LocationEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/fise/engines/geonames/src/main/java/eu/iksproject/fise/engines/geonames/impl/LocationEnhancementEngine.java Sun Dec 12 16:10:48 2010
@@ -241,8 +241,8 @@ public class LocationEnhancementEngine i
MGraph graph = ci.getMetadata();
LiteralFactory literalFactory = LiteralFactory.getInstance();
//get all the textAnnotations
- /*
- * this Map holds the name as key and all the text annotations of
+ /*
+ * this Map holds the name as key and all the text annotations of
* dc:type dbPedia:Place that select this name as value
* this map is used to avoid multiple lookups for text annotations
* selecting the same name.
Modified: incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java (original)
+++ incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java Sun Dec 12 16:10:48 2010
@@ -35,31 +35,31 @@ import eu.iksproject.fise.servicesapi.rd
public class TestLocationEnhancementEngine {
- private Logger log = LoggerFactory.getLogger(TestLocationEnhancementEngine.class);
+ private Logger log = LoggerFactory.getLogger(TestLocationEnhancementEngine.class);
- /**
- * The context for the tests (same as in TestOpenNLPEnhancementEngine)
- */
- public static final String CONTEXT = "Dr. Patrick Marshall (1869 - November 1950) was a"
+ /**
+ * The context for the tests (same as in TestOpenNLPEnhancementEngine)
+ */
+ public static final String CONTEXT = "Dr. Patrick Marshall (1869 - November 1950) was a"
+ " geologist who lived in New Zealand and worked at the University of Otago.";
- /**
- * The person for the tests (same as in TestOpenNLPEnhancementEngine)
- */
- public static final String PERSON = "Patrick Marshall";
-
- /**
- * The organisation for the tests (same as in TestOpenNLPEnhancementEngine)
- */
- public static final String ORGANISATION ="University of Otago";
-
- /**
- * The place for the tests (same as in TestOpenNLPEnhancementEngine)
- */
- public static final String PLACE = "New Zealand";
-
-
- static LocationEnhancementEngine locationEnhancementEngine = new LocationEnhancementEngine();
+ /**
+ * The person for the tests (same as in TestOpenNLPEnhancementEngine)
+ */
+ public static final String PERSON = "Patrick Marshall";
+
+ /**
+ * The organisation for the tests (same as in TestOpenNLPEnhancementEngine)
+ */
+ public static final String ORGANISATION ="University of Otago";
+
+ /**
+ * The place for the tests (same as in TestOpenNLPEnhancementEngine)
+ */
+ public static final String PLACE = "New Zealand";
+
+
+ static LocationEnhancementEngine locationEnhancementEngine = new LocationEnhancementEngine();
@BeforeClass
public static void setUpServices() throws IOException {
@@ -70,7 +70,7 @@ public class TestLocationEnhancementEngi
@AfterClass
public static void shutdownServices() {
- locationEnhancementEngine.deactivate(null);
+ locationEnhancementEngine.deactivate(null);
}
public static ContentItem getContentItem(final String id,
@@ -96,70 +96,70 @@ public class TestLocationEnhancementEngi
}
};
}
-
+
public static void getTextAnnotation(ContentItem ci, String name,String context,UriRef type){
- String content;
- try {
- content = IOUtils.toString(ci.getStream());
- } catch (IOException e) {
- //should never happen anyway!
- content = "";
- }
- RdfEntityFactory factory = RdfEntityFactory.createInstance(ci.getMetadata());
- TextAnnotation testAnnotation = factory.getProxy(new UriRef("urn:iks-project:fise:test:text-annotation:person"), TextAnnotation.class);
- testAnnotation.setCreator(new UriRef("urn:iks-project:fise:test:dummyEngine"));
- testAnnotation.setCreated(new Date());
- testAnnotation.setSelectedText(name);
- testAnnotation.setSelectionContext(context);
- testAnnotation.getDcType().add(type);
- Integer start = content.indexOf(name);
- if(start < 0){ //if not found in the content
- //set some random numbers for start/end
- start = (int)Math.random()*100;
- }
- testAnnotation.setStart(start);
- testAnnotation.setEnd(start+name.length());
+ String content;
+ try {
+ content = IOUtils.toString(ci.getStream());
+ } catch (IOException e) {
+ //should never happen anyway!
+ content = "";
+ }
+ RdfEntityFactory factory = RdfEntityFactory.createInstance(ci.getMetadata());
+ TextAnnotation testAnnotation = factory.getProxy(new UriRef("urn:iks-project:fise:test:text-annotation:person"), TextAnnotation.class);
+ testAnnotation.setCreator(new UriRef("urn:iks-project:fise:test:dummyEngine"));
+ testAnnotation.setCreated(new Date());
+ testAnnotation.setSelectedText(name);
+ testAnnotation.setSelectionContext(context);
+ testAnnotation.getDcType().add(type);
+ Integer start = content.indexOf(name);
+ if(start < 0){ //if not found in the content
+ //set some random numbers for start/end
+ start = (int)Math.random()*100;
+ }
+ testAnnotation.setStart(start);
+ testAnnotation.setEnd(start+name.length());
}
@Test
public void testLocationEnhancementEngine() {//throws Exception{
- //create a content item
- ContentItem ci = getContentItem("urn:iks-project:fise:text:content-item:person", CONTEXT);
- //add three text annotations to be consumed by this test
- getTextAnnotation(ci, PERSON, CONTEXT, OntologicalClasses.DBPEDIA_PERSON);
- getTextAnnotation(ci, ORGANISATION, CONTEXT, OntologicalClasses.DBPEDIA_ORGANISATION);
- getTextAnnotation(ci, PLACE, CONTEXT, OntologicalClasses.DBPEDIA_PLACE);
- //perform the computation of the enhancements
- try {
- locationEnhancementEngine.computeEnhancements(ci);
- } catch (EngineException e) {
- if(e.getCause() instanceof UnknownHostException) {
- log.warn("Unable to test LocationEnhancemetEngine when offline! -> skipping this test",e.getCause());
- return;
- } else if(e.getCause() instanceof SocketTimeoutException){
- log.warn("Seams like the geonames.org webservice is currently unavailable -> skipping this test",e.getCause());
- return;
- }
- }
- // ... and test the results
- /*
- * TODO: rw 20100617
- * - Expected results depend on the used Index.
- * - Use an example where the Organisation, Person and Place is part
- * of the index
- */
- int entityAnnotationCount = checkAllEntityAnnotations(ci.getMetadata());
- //two suggestions for New Zealand and one hierarchy entry for the first
- //suggestion
- assertEquals(3, entityAnnotationCount);
+ //create a content item
+ ContentItem ci = getContentItem("urn:iks-project:fise:text:content-item:person", CONTEXT);
+ //add three text annotations to be consumed by this test
+ getTextAnnotation(ci, PERSON, CONTEXT, OntologicalClasses.DBPEDIA_PERSON);
+ getTextAnnotation(ci, ORGANISATION, CONTEXT, OntologicalClasses.DBPEDIA_ORGANISATION);
+ getTextAnnotation(ci, PLACE, CONTEXT, OntologicalClasses.DBPEDIA_PLACE);
+ //perform the computation of the enhancements
+ try {
+ locationEnhancementEngine.computeEnhancements(ci);
+ } catch (EngineException e) {
+ if(e.getCause() instanceof UnknownHostException) {
+ log.warn("Unable to test LocationEnhancemetEngine when offline! -> skipping this test",e.getCause());
+ return;
+ } else if(e.getCause() instanceof SocketTimeoutException){
+ log.warn("Seams like the geonames.org webservice is currently unavailable -> skipping this test",e.getCause());
+ return;
+ }
+ }
+ // ... and test the results
+ /*
+ * TODO: rw 20100617
+ * - Expected results depend on the used Index.
+ * - Use an example where the Organisation, Person and Place is part
+ * of the index
+ */
+ int entityAnnotationCount = checkAllEntityAnnotations(ci.getMetadata());
+ //two suggestions for New Zealand and one hierarchy entry for the first
+ //suggestion
+ assertEquals(3, entityAnnotationCount);
}
-
+
/*
* -----------------------------------------------------------------------
* Helper Methods to check Text and EntityAnnotations
* -----------------------------------------------------------------------
*/
-
+
/**
* @param g
* @return
Modified: incubator/stanbol/trunk/fise/engines/langid/src/test/java/eu/iksproject/fise/engines/langid/core/TextCatTest.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/langid/src/test/java/eu/iksproject/fise/engines/langid/core/TextCatTest.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/langid/src/test/java/eu/iksproject/fise/engines/langid/core/TextCatTest.java (original)
+++ incubator/stanbol/trunk/fise/engines/langid/src/test/java/eu/iksproject/fise/engines/langid/core/TextCatTest.java Sun Dec 12 16:10:48 2010
@@ -13,7 +13,7 @@ import static org.junit.Assert.assertNot
/**
* {@link TextCatTest} is a test class for {@link TextCategorizer}.
- *
+ *
* @author Joerg Steffen, DFKI
* @version $Id$
*/
@@ -34,14 +34,14 @@ public class TextCatTest {
/**
* This test the language identification.
- *
+ *
* @throws IOException
* if there is an error when reading the text
*/
@Test
public void testTextCat() throws IOException {
String testFileName = "en.txt";
-
+
InputStream in =
this.getClass().getClassLoader().getResourceAsStream(
testFileName);
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/MetaxaCore.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/MetaxaCore.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/MetaxaCore.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/MetaxaCore.java Sun Dec 12 16:10:48 2010
@@ -25,7 +25,7 @@ import org.semanticdesktop.aperture.voca
/**
* {@link MetaxaCore} provides the functionality to extract metadata and text
* for a number of different document formats (pdf, html, etc.).
- *
+ *
* @author Joerg Steffen, DFKI
* @version $Id$
*/
@@ -39,7 +39,7 @@ public class MetaxaCore {
/**
* This creates a new instance of {@code ApertureExtractor} using the given
* configuration.
- *
+ *
* @param configFileName
* a {@link String} with the config file name.
* @throws IOException
@@ -56,7 +56,7 @@ public class MetaxaCore {
/**
* This return {@code true} if the given MIME type is supported by the
* extractor.
- *
+ *
* @param mimeType
* a {@link String} with the MIME type
* @return a {@code boolean}
@@ -71,7 +71,7 @@ public class MetaxaCore {
/**
* This returns a model containing all the metadata that could be extracted
* by reading the given input stream using the given MIME type.
- *
+ *
* @param in
* an {@link InputStream} where to read the document from
* @param docId
@@ -115,7 +115,7 @@ public class MetaxaCore {
/**
* This returns a documents plain text if contained in the given extracted
* metadata.
- *
+ *
* @param model
* a {@link Model} with the extracted metadata
* @return a {@link String} with the plain text content or {@code null} if
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/CharsetRecognizer.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/CharsetRecognizer.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/CharsetRecognizer.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/CharsetRecognizer.java Sun Dec 12 16:10:48 2010
@@ -15,9 +15,9 @@ import com.ibm.icu.text.CharsetMatch;
/**
* EncodingDetector.java
- *
+ *
* @author <a href="mailto:kasper@dfki.de">Walter Kasper</a>
- *
+ *
*/
public class CharsetRecognizer {
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/DOMUtils.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/DOMUtils.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/DOMUtils.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/DOMUtils.java Sun Dec 12 16:10:48 2010
@@ -2,7 +2,7 @@ package eu.iksproject.fise.engines.metax
/*
* Copyright 2002 Sun Microsystems, Inc. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: -
* Redistributions of source code must retain the above copyright notice, this
@@ -10,11 +10,11 @@ package eu.iksproject.fise.engines.metax
* form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided
* with the distribution.
- *
+ *
* Neither the name of Sun Microsystems, Inc. or the names of contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
* IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
@@ -26,7 +26,7 @@ package eu.iksproject.fise.engines.metax
* CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
* OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGES.
- *
+ *
* You acknowledge that Software is not designed, licensed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
@@ -66,7 +66,7 @@ import org.xml.sax.SAXParseException;
/**
* <code>DOMUtils</code> provides convenience methods for working with DOM
* documents.
- *
+ *
* @author Walter Kasper, DFKI
* @author Joerg Steffen, DFKI
* @version $Id$
@@ -82,7 +82,7 @@ public final class DOMUtils {
/**
* This prints the specified node and all of its children to System.out.
- *
+ *
* @param node
* a DOM <code>Node</code>
*/
@@ -164,7 +164,7 @@ public final class DOMUtils {
/**
* This prints the given DOM document to System.out with indentation and
* iso-8859 encoding.
- *
+ *
* @param doc
* a DOM <code>Document</code>
*/
@@ -216,7 +216,7 @@ public final class DOMUtils {
/**
* This returns a string representation of the given document.
- *
+ *
* @param doc
* an XML <code>Document</code>
* @param encoding
@@ -282,7 +282,7 @@ public final class DOMUtils {
/**
* This method writes a DOM document to the given output stream.
- *
+ *
* @param doc
* a DOM <code>Document</code>
* @param encoding
@@ -345,7 +345,7 @@ public final class DOMUtils {
/**
* This parses the given XML string and creates a DOM Document.
- *
+ *
* @param fileName
* a <code>String</code> with the source file name
* @param encoding
@@ -386,7 +386,7 @@ public final class DOMUtils {
/**
* This parses the given XML file and creates a DOM Document.
- *
+ *
* @param fileName
* a <code>String</code> with the source file name
* @param validation
@@ -450,7 +450,7 @@ public final class DOMUtils {
/**
* This counts the elements in the given document by tag name.
- *
+ *
* @param tag
* a <code>String</code> with a tag name
* @param doc
@@ -467,7 +467,7 @@ public final class DOMUtils {
/**
* This realizes the <code>indexOf</code> method of the
* <code>java.util.List</code> interface for <code>NodeList</code>.
- *
+ *
* @param list
* a <code>NodeList</code> value
* @param node
@@ -491,7 +491,7 @@ public final class DOMUtils {
* children of the given node. If <code>node</code> is a text or attribute
* node, its value is returned. Otherwise <code>null</code> is returned
* (improvement potential!).
- *
+ *
* @param node
* a <code>Node</code> value
* @return a <code>String</code> with the concatenated text
@@ -521,7 +521,7 @@ public final class DOMUtils {
/**
* This selects all direct children of the given element with the given
* name. If the name is <code>null</code>, all children are returned.
- *
+ *
* @param ele
* an <code>Element</code> value
* @param name
@@ -545,7 +545,7 @@ public final class DOMUtils {
/**
* This selects all direct children of type 'Element' of the given element.
- *
+ *
* @param ele
* an <code>Element</code> value
* @return a <code>List</code> of <code>Elmenet</code>s with the element
@@ -567,7 +567,7 @@ public final class DOMUtils {
/**
* This returns the first child element with the given name found at the
* given element.
- *
+ *
* @param ele
* an <code>Element</code> value
* @param name
@@ -588,7 +588,7 @@ public final class DOMUtils {
/**
* This adds a new child with the given name to the given element.
- *
+ *
* @param ele
* an <code>Element</code>
* @param name
@@ -602,4 +602,4 @@ public final class DOMUtils {
return child;
}
-}
\ No newline at end of file
+}
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractionComponent.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractionComponent.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractionComponent.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractionComponent.java Sun Dec 12 16:10:48 2010
@@ -8,9 +8,9 @@ import org.w3c.dom.Document;
/**
* HtmlExtractionComponent.java
- *
+ *
* @author <a href="mailto:kasper@dfki.de">Walter Kasper</a>
- *
+ *
*/
public interface HtmlExtractionComponent {
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractionRegistry.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractionRegistry.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractionRegistry.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractionRegistry.java Sun Dec 12 16:10:48 2010
@@ -27,7 +27,7 @@ import org.xml.sax.SAXException;
/**
* HtmlExtractionRegistry.java
- *
+ *
* @author <a href="mailto:kasper@dfki.de">Walter Kasper</a>
*/
public class HtmlExtractionRegistry {
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractorFactory.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractorFactory.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractorFactory.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlExtractorFactory.java Sun Dec 12 16:10:48 2010
@@ -4,9 +4,9 @@ import org.semanticdesktop.aperture.extr
/**
* HtmlExtractorFactory.java
- *
+ *
* @author <a href="mailto:kasper@dfki.de">Walter Kasper</a>
- *
+ *
*/
public class HtmlExtractorFactory extends
org.semanticdesktop.aperture.extractor.html.HtmlExtractorFactory {
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlParser.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlParser.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlParser.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/HtmlParser.java Sun Dec 12 16:10:48 2010
@@ -14,9 +14,9 @@ import org.w3c.dom.Document;
/**
* HtmlParser.java
- *
+ *
* @author <a href="mailto:kasper@dfki.de">Walter Kasper</a>
- *
+ *
*/
public class HtmlParser {
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/IksHtmlExtractor.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/IksHtmlExtractor.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/IksHtmlExtractor.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/IksHtmlExtractor.java Sun Dec 12 16:10:48 2010
@@ -23,17 +23,12 @@ import org.w3c.dom.Document;
/**
* IksHtmlExtractor.java
- *
+ *
* @author <a href="mailto:kasper@dfki.de">Walter Kasper</a>
- *
*/
public class IksHtmlExtractor implements Extractor {
- /**
- * This contains the logger.
- */
- private static final Logger LOG =
- LoggerFactory.getLogger(IksHtmlExtractor.class);
+ private static final Logger LOG = LoggerFactory.getLogger(IksHtmlExtractor.class);
public static String DEFAULT_CONFIGURATION = "htmlextractors.xml";
@@ -55,7 +50,7 @@ public class IksHtmlExtractor implements
public IksHtmlExtractor(String configFileName)
throws InitializationException {
this();
- this.registry = new HtmlExtractionRegistry(configFileName);
+ registry = new HtmlExtractionRegistry(configFileName);
}
public void extract(URI id,
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/InitializationException.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/InitializationException.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/InitializationException.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/InitializationException.java Sun Dec 12 16:10:48 2010
@@ -3,7 +3,7 @@ package eu.iksproject.fise.engines.metax
/**
* <code>InitializationException</code> is thrown when an initialization step
* fails.
- *
+ *
* @author Joerg Steffen, DFKI
* @version $Id$
*/
@@ -20,7 +20,7 @@ public class InitializationException ext
/**
* This creates a new instance of <code>InitializationException</code> with
* the given detail message. The cause is not initialized.
- *
+ *
* @param message
* a <code>String</code> with the detail message
*/
@@ -33,7 +33,7 @@ public class InitializationException ext
* the specified cause and a detail message of (cause==null ? null :
* cause.toString()) (which typically contains the class and detail message
* of cause).
- *
+ *
* @param cause
* a <code>Throwable</code> with the cause of the exception
* (which is saved for later retrieval by the {@link #getCause()}
@@ -48,7 +48,7 @@ public class InitializationException ext
/**
* This creates a new instance of <code>InitializationException</code> with
* the given detail message and the given cause.
- *
+ *
* @param message
* a <code>String</code> with the detail message
* @param cause
Modified: incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/XsltExtractor.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/XsltExtractor.java?rev=1044841&r1=1044840&r2=1044841&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/XsltExtractor.java (original)
+++ incubator/stanbol/trunk/fise/engines/metaxa/src/main/java/eu/iksproject/fise/engines/metaxa/core/html/XsltExtractor.java Sun Dec 12 16:10:48 2010
@@ -1,6 +1,5 @@
package eu.iksproject.fise.engines.metaxa.core.html;
-import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
@@ -29,9 +28,8 @@ import org.w3c.dom.Document;
/**
* XsltExtractor.java
- *
+ *
* @author <a href="mailto:kasper@dfki.de">Walter Kasper</a>
- *
*/
public class XsltExtractor implements HtmlExtractionComponent {
@@ -59,7 +57,7 @@ public class XsltExtractor implements Ht
try {
URI location =
getClass().getClassLoader().getResource(fileName).toURI();
- this.source = location;
+ source = location;
} catch (URISyntaxException e) {
throw new InitializationException(e.getMessage(), e);
}