Modified: stanbol/trunk/commons/web/sparql/src/main/resources/templates/imports/sparql.ftl URL: http://svn.apache.org/viewvc/stanbol/trunk/commons/web/sparql/src/main/resources/templates/imports/sparql.ftl?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/commons/web/sparql/src/main/resources/templates/imports/sparql.ftl (original) +++ stanbol/trunk/commons/web/sparql/src/main/resources/templates/imports/sparql.ftl Tue May 17 22:20:49 2016 @@ -16,23 +16,23 @@ --> <#macro form> <fieldset> - <legend>Registered TripleCollections</legend> + <legend>Registered Graphs</legend> <#-- graph list --> - <#if it.tripleCollectionList?size > 0> + <#if it.graphList?size > 0> <select id="graphList" onChange='javascript:graphChangeHandler();'> - <#list it.tripleCollectionList as tcInfo> + <#list it.graphList as tcInfo> <option value="${tcInfo.graphUri}">${tcInfo.graphUri}</option> </#list> </select> <#else> - There is no registered TripleCollection. + There is no registered Graph. </#if> </fieldset> -<#if it.tripleCollectionList?size > 0> +<#if it.graphList?size > 0> <fieldset> <legend>Details of Selected Graph</legend> - <#list it.tripleCollectionList as tcInfo> + <#list it.graphList as tcInfo> <ul id="${tcInfo.graphUri}" class="graphDetailInvisible"> <li>Graph Name: ${tcInfo.graphName}</li> <li>Graph Description: ${tcInfo.graphDescription}</li>
Modified: stanbol/trunk/development/archetypes/enhancement-engine/src/main/resources/archetype-resources/src/main/java/ExampleEnhancer.java URL: http://svn.apache.org/viewvc/stanbol/trunk/development/archetypes/enhancement-engine/src/main/resources/archetype-resources/src/main/java/ExampleEnhancer.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/development/archetypes/enhancement-engine/src/main/resources/archetype-resources/src/main/java/ExampleEnhancer.java (original) +++ stanbol/trunk/development/archetypes/enhancement-engine/src/main/resources/archetype-resources/src/main/java/ExampleEnhancer.java Tue May 17 22:20:49 2016 @@ -9,10 +9,10 @@ import java.util.Dictionary; import java.util.Map; import java.util.Map.Entry; -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.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.ontologies.DCTERMS; import org.apache.clerezza.rdf.ontologies.RDFS; import org.apache.felix.scr.annotations.Activate; @@ -138,7 +138,7 @@ public class ExampleEnhancer extends Abs public int canEnhance(ContentItem ci) throws EngineException { // check if a Content in the supported type is available //NOTE: you can parse multiple content types - Entry<UriRef,Blob> textBlob = ContentItemHelper.getBlob( + Entry<IRI,Blob> textBlob = ContentItemHelper.getBlob( ci, Collections.singleton("text/plain")); if(textBlob == null) { return CANNOT_ENHANCE; @@ -168,15 +168,15 @@ public class ExampleEnhancer extends Abs //(3) write the enhancement results // get the metadata graph - MGraph metadata = ci.getMetadata(); + Graph metadata = ci.getMetadata(); //NOTE: as we allow synchronous calls we need to use read/write // locks on the ContentItem ci.getLock().writeLock().lock(); try { // TODO: replace this with real enhancements - UriRef textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); metadata.add(new TripleImpl(textAnnotation, DCTERMS.type, - new UriRef("http://example.org/ontology/LengthEnhancement"))); + new IRI("http://example.org/ontology/LengthEnhancement"))); metadata.add(new TripleImpl(textAnnotation, RDFS.comment, new PlainLiteralImpl("A text of " + contentLength + " charaters"))); } finally { Modified: stanbol/trunk/development/archetypes/statefull-webmodule/src/main/resources/archetype-resources/src/main/java/Ontology.java URL: http://svn.apache.org/viewvc/stanbol/trunk/development/archetypes/statefull-webmodule/src/main/resources/archetype-resources/src/main/java/Ontology.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/development/archetypes/statefull-webmodule/src/main/resources/archetype-resources/src/main/java/Ontology.java (original) +++ stanbol/trunk/development/archetypes/statefull-webmodule/src/main/resources/archetype-resources/src/main/java/Ontology.java Tue May 17 22:20:49 2016 @@ -3,7 +3,7 @@ #set( $symbol_escape = '\' ) package ${package}; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; /** @@ -17,26 +17,26 @@ public class Ontology { * of the resource of which the IRI is specified in the "iri" query parameter. * */ - public static final UriRef ResourceResolver = new UriRef("http://example.org/service-description${symbol_pound}ResourceResolver"); + public static final IRI ResourceResolver = new IRI("http://example.org/service-description${symbol_pound}ResourceResolver"); /** * Point to the resource resolved by the subject. */ - public static final UriRef describes = new UriRef("http://example.org/service-description${symbol_pound}describes"); + public static final IRI describes = new IRI("http://example.org/service-description${symbol_pound}describes"); /** * The description of a Request in the log. */ - public static final UriRef LoggedRequest = new UriRef("http://example.org/service-description${symbol_pound}LoggedRequest"); + public static final IRI LoggedRequest = new IRI("http://example.org/service-description${symbol_pound}LoggedRequest"); /** * The User Agent performing the requested described by the subject. */ - public static final UriRef userAgent = new UriRef("http://example.org/service-description${symbol_pound}userAgent"); + public static final IRI userAgent = new IRI("http://example.org/service-description${symbol_pound}userAgent"); /** * The Entity of which a description was requested in the request * described by the subject. */ - public static final UriRef requestedEntity = new UriRef("http://example.org/service-description${symbol_pound}requestedEntity"); + public static final IRI requestedEntity = new IRI("http://example.org/service-description${symbol_pound}requestedEntity"); } Modified: stanbol/trunk/development/archetypes/statefull-webmodule/src/main/resources/archetype-resources/src/main/java/ResourceResolver.java URL: http://svn.apache.org/viewvc/stanbol/trunk/development/archetypes/statefull-webmodule/src/main/resources/archetype-resources/src/main/java/ResourceResolver.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/development/archetypes/statefull-webmodule/src/main/resources/archetype-resources/src/main/java/ResourceResolver.java (original) +++ stanbol/trunk/development/archetypes/statefull-webmodule/src/main/resources/archetype-resources/src/main/java/ResourceResolver.java Tue May 17 22:20:49 2016 @@ -15,26 +15,26 @@ import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; import org.apache.clerezza.jaxrs.utils.TrailingSlash; -import org.apache.clerezza.rdf.core.BNode; -import org.apache.clerezza.rdf.core.MGraph; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.BlankNode; +import org.apache.clerezza.commons.rdf.Graph; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.clerezza.rdf.core.access.EntityAlreadyExistsException; import org.apache.clerezza.rdf.core.access.TcManager; import org.apache.clerezza.rdf.core.access.security.TcAccessController; import org.apache.clerezza.rdf.core.access.security.TcPermission; -import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl; +import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl; import org.apache.clerezza.rdf.ontologies.DC; import org.apache.clerezza.rdf.ontologies.RDF; import org.apache.clerezza.rdf.ontologies.RDFS; import org.apache.clerezza.rdf.utils.GraphNode; -import org.apache.clerezza.rdf.utils.UnionMGraph; +import org.apache.clerezza.rdf.utils.UnionGraph; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.Service; -import org.apache.stanbol.commons.indexedgraph.IndexedMGraph; +import org.apache.stanbol.commons.indexedgraph.IndexedGraph; import org.apache.stanbol.commons.web.viewable.RdfViewable; import org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory; import org.apache.stanbol.entityhub.servicesapi.model.Entity; @@ -75,13 +75,13 @@ public class ResourceResolver { /** * This is the name of the graph in which we "log" the requests */ - private UriRef REQUEST_LOG_GRAPH_NAME = new UriRef("http://example.org/resource-resolver-log.graph"); + private IRI REQUEST_LOG_GRAPH_NAME = new IRI("http://example.org/resource-resolver-log.graph"); @Activate protected void activate(ComponentContext context) { log.info("The example service is being activated"); try { - tcManager.createMGraph(REQUEST_LOG_GRAPH_NAME); + tcManager.createGraph(REQUEST_LOG_GRAPH_NAME); //now make sure everybody can read from the graph //or more precisly, anybody who can read the content-graph TcAccessController tca = tcManager.getTcAccessController(); @@ -105,7 +105,7 @@ public class ResourceResolver { */ @GET public RdfViewable serviceEntry(@Context final UriInfo uriInfo, - @QueryParam("iri") final UriRef iri, + @QueryParam("iri") final IRI iri, @HeaderParam("user-agent") String userAgent) throws Exception { //this maks sure we are nt invoked with a trailing slash which would affect //relative resolution of links (e.g. css) @@ -113,18 +113,18 @@ public class ResourceResolver { final String resourcePath = uriInfo.getAbsolutePath().toString(); //The URI at which this service was accessed accessed, this will be the //central serviceUri in the response - final UriRef serviceUri = new UriRef(resourcePath); + final IRI serviceUri = new IRI(resourcePath); //the in memory graph to which the triples for the response are added - final MGraph responseGraph = new IndexedMGraph(); + final Graph responseGraph = new IndexedGraph(); //A union graph containing both the response specif triples as well //as the log-graph - final UnionMGraph resultGraph = new UnionMGraph(responseGraph, getRequestLogGraph()); + final UnionGraph resultGraph = new UnionGraph(responseGraph, getRequestLogGraph()); //This GraphNode represents the service within our result graph final GraphNode node = new GraphNode(serviceUri, resultGraph); //The triples will be added to the first graph of the union //i.e. to the in-memory responseGraph node.addProperty(RDF.type, Ontology.ResourceResolver); - node.addProperty(RDFS.comment, new PlainLiteralImpl("A Resource Resolver")); + node.addProperty(RDFS.comment, new PlainLiteralImpl("A RDFTerm Resolver")); if (iri != null) { node.addProperty(Ontology.describes, iri); addResourceDescription(iri, responseGraph); @@ -136,11 +136,11 @@ public class ResourceResolver { /** - * Add the description of a serviceUri to the specified MGraph using SiteManager. + * Add the description of a serviceUri to the specified Graph using SiteManager. * The description includes the metadata provided by the SiteManager. * */ - private void addResourceDescription(UriRef iri, MGraph mGraph) { + private void addResourceDescription(IRI iri, Graph mGraph) { final Entity entity = siteManager.getEntity(iri.getUnicodeString()); if (entity != null) { final RdfValueFactory valueFactory = new RdfValueFactory(mGraph); @@ -158,15 +158,15 @@ public class ResourceResolver { /** * Logs a request to the log-graph */ - private void logRequest(final UriRef iri, final String userAgent) { + private void logRequest(final IRI iri, final String userAgent) { //writing to a persistent graph requires some special permission //by executing the code in a do-priviledged section //the user doesn't need this permissions, anonymous users are thus not //asked to log in AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { - final MGraph logGraph = getRequestLogGraph(); - GraphNode loggedRequest = new GraphNode(new BNode(), logGraph); + final Graph logGraph = getRequestLogGraph(); + GraphNode loggedRequest = new GraphNode(new BlankNode(), logGraph); loggedRequest.addProperty(RDF.type, Ontology.LoggedRequest); loggedRequest.addPropertyValue(DC.date, new Date()); loggedRequest.addPropertyValue(Ontology.userAgent, userAgent); @@ -178,12 +178,12 @@ public class ResourceResolver { } /** - * This returns the existing MGraph for the log . + * This returns the existing Graph for the log . * - * @return the MGraph to which the requests are logged + * @return the Graph to which the requests are logged */ - private MGraph getRequestLogGraph() { - return tcManager.getMGraph(REQUEST_LOG_GRAPH_NAME); + private Graph getRequestLogGraph() { + return tcManager.getGraph(REQUEST_LOG_GRAPH_NAME); } } Modified: stanbol/trunk/development/archetypes/stateless-webmodule/src/main/resources/archetype-resources/src/main/java/MultiEnhancer.java URL: http://svn.apache.org/viewvc/stanbol/trunk/development/archetypes/stateless-webmodule/src/main/resources/archetype-resources/src/main/java/MultiEnhancer.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/development/archetypes/stateless-webmodule/src/main/resources/archetype-resources/src/main/java/MultiEnhancer.java (original) +++ stanbol/trunk/development/archetypes/stateless-webmodule/src/main/resources/archetype-resources/src/main/java/MultiEnhancer.java Tue May 17 22:20:49 2016 @@ -29,9 +29,9 @@ import javax.ws.rs.core.UriInfo; import org.apache.clerezza.jaxrs.utils.TrailingSlash; import org.apache.clerezza.jaxrs.utils.form.FormFile; import org.apache.clerezza.jaxrs.utils.form.MultiPartBody; -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.commons.rdf.Graph; +import org.apache.clerezza.commons.rdf.IRI; +import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl; import org.apache.clerezza.rdf.ontologies.RDF; import org.apache.clerezza.rdf.ontologies.RDFS; import org.apache.clerezza.rdf.utils.GraphNode; @@ -41,7 +41,7 @@ import org.apache.felix.scr.annotations. import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Reference; import org.apache.felix.scr.annotations.Service; -import org.apache.stanbol.commons.indexedgraph.IndexedMGraph; +import org.apache.stanbol.commons.indexedgraph.IndexedGraph; import org.apache.stanbol.commons.web.viewable.RdfViewable; import org.apache.stanbol.enhancer.servicesapi.Chain; import org.apache.stanbol.enhancer.servicesapi.ChainManager; @@ -101,9 +101,9 @@ public class MultiEnhancer { final String resourcePath = uriInfo.getAbsolutePath().toString(); //The URI at which this service was accessed accessed, this will be the //central serviceUri in the response - final UriRef serviceUri = new UriRef(resourcePath); + final IRI serviceUri = new IRI(resourcePath); //the in memory graph to which the triples for the response are added - final MGraph responseGraph = new IndexedMGraph(); + final Graph responseGraph = new IndexedGraph(); //This GraphNode represents the service within our result graph final GraphNode node = new GraphNode(serviceUri, responseGraph); //The triples will be added to the first graph of the union @@ -137,9 +137,9 @@ public class MultiEnhancer { enhancementJobManager.enhanceContent(contentItem, chain); } //this contains the enhancement results - final MGraph resultGraph = contentItem.getMetadata(); + final Graph resultGraph = contentItem.getMetadata(); //this is the IRI assigned to the subitted content - final UriRef contentIri = contentItem.getUri(); + final IRI contentIri = contentItem.getUri(); //this represent the submitted Content within the resultGraph final GraphNode node = new GraphNode(contentIri, resultGraph); //node is the "root" for rendering the results Modified: stanbol/trunk/development/archetypes/stateless-webmodule/src/main/resources/archetype-resources/src/main/java/Ontology.java URL: http://svn.apache.org/viewvc/stanbol/trunk/development/archetypes/stateless-webmodule/src/main/resources/archetype-resources/src/main/java/Ontology.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/development/archetypes/stateless-webmodule/src/main/resources/archetype-resources/src/main/java/Ontology.java (original) +++ stanbol/trunk/development/archetypes/stateless-webmodule/src/main/resources/archetype-resources/src/main/java/Ontology.java Tue May 17 22:20:49 2016 @@ -19,7 +19,7 @@ #set( $symbol_escape = '\' ) package ${package}; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; /** @@ -33,6 +33,6 @@ public class Ontology { * containing the content to be enhance as one field and optionally the * requested enhancment chain in the other. */ - public static final UriRef MultiEnhancer = new UriRef("http://example.org/service-description${symbol_pound}MultiEnhancer"); + public static final IRI MultiEnhancer = new IRI("http://example.org/service-description${symbol_pound}MultiEnhancer"); } Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/CeliConstants.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/CeliConstants.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/CeliConstants.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/CeliConstants.java Tue May 17 22:20:49 2016 @@ -16,7 +16,7 @@ */ package org.apache.stanbol.enhancer.engines.celi; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; @@ -64,10 +64,10 @@ public interface CeliConstants { * Concept used to annotate sentiment expressions within text * TODO: Find standard ontology for reference or check if it is OK to define new properties in the FISE namespace */ - UriRef SENTIMENT_EXPRESSION = new UriRef("http://fise.iks-project.eu/ontology/Sentiment Expression"); + IRI SENTIMENT_EXPRESSION = new IRI("http://fise.iks-project.eu/ontology/Sentiment Expression"); /** * Datatype property (targets double literals) used to represent the polarity of a sentiment expression * TODO: Find standard ontology for reference or check if it is OK to define new properties in the FISE namespace */ - UriRef HAS_SENTIMENT_EXPRESSION_POLARITY=new UriRef("http://fise.iks-project.eu/ontology/hasSentimentPolarityValue"); + IRI HAS_SENTIMENT_EXPRESSION_POLARITY=new IRI("http://fise.iks-project.eu/ontology/hasSentimentPolarityValue"); } Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/CeliMorphoFeatures.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/CeliMorphoFeatures.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/CeliMorphoFeatures.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/CeliMorphoFeatures.java Tue May 17 22:20:49 2016 @@ -23,11 +23,11 @@ import java.util.List; import java.util.Map.Entry; import java.util.Vector; -import org.apache.clerezza.rdf.core.Language; -import org.apache.clerezza.rdf.core.Triple; -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.clerezza.commons.rdf.Language; +import org.apache.clerezza.commons.rdf.Triple; +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.stanbol.enhancer.engines.celi.lemmatizer.impl.CeliLemmatizerEnhancementEngine; import org.apache.stanbol.enhancer.engines.celi.lemmatizer.impl.Reading; import org.apache.stanbol.enhancer.nlp.model.Token; @@ -61,13 +61,13 @@ public final class CeliMorphoFeatures ex private static CeliTagSetRegistry tagRegistry = CeliTagSetRegistry.getInstance(); - public static final UriRef HAS_NUMBER = new UriRef("http://purl.org/olia/olia.owl#hasNumber"); - public static final UriRef HAS_GENDER = new UriRef("http://purl.org/olia/olia.owl#hasGender"); - public static final UriRef HAS_PERSON = new UriRef("http://purl.org/olia/olia.owl#hasPerson"); - public static final UriRef HAS_CASE = new UriRef("http://purl.org/olia/olia.owl#hasCase"); - public static final UriRef HAS_DEFINITENESS = new UriRef("http://purl.org/olia/olia.owl#hasDefiniteness"); - public static final UriRef HAS_MOOD = new UriRef("http://purl.org/olia/olia.owl#hasMood"); - public static final UriRef HAS_TENSE = new UriRef("http://purl.org/olia/olia.owl#hasTense"); + public static final IRI HAS_NUMBER = new IRI("http://purl.org/olia/olia.owl#hasNumber"); + public static final IRI HAS_GENDER = new IRI("http://purl.org/olia/olia.owl#hasGender"); + public static final IRI HAS_PERSON = new IRI("http://purl.org/olia/olia.owl#hasPerson"); + public static final IRI HAS_CASE = new IRI("http://purl.org/olia/olia.owl#hasCase"); + public static final IRI HAS_DEFINITENESS = new IRI("http://purl.org/olia/olia.owl#hasDefiniteness"); + public static final IRI HAS_MOOD = new IRI("http://purl.org/olia/olia.owl#hasMood"); + public static final IRI HAS_TENSE = new IRI("http://purl.org/olia/olia.owl#hasTense"); public static CeliMorphoFeatures parseFrom(Reading reading, String lang){ if(reading == null){ @@ -105,7 +105,7 @@ public final class CeliMorphoFeatures ex super(lemma); } - public Collection<? extends Triple> featuresAsTriples(UriRef textAnnotation, Language lang) { + public Collection<? extends Triple> featuresAsTriples(IRI textAnnotation, Language lang) { Collection<TripleImpl> result = new Vector<TripleImpl>(); result.add(new TripleImpl(textAnnotation, CeliLemmatizerEnhancementEngine.hasLemmaForm, new PlainLiteralImpl(getLemma(), lang))); Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/CeliClassificationEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/CeliClassificationEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/CeliClassificationEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/CeliClassificationEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -37,12 +37,12 @@ import java.util.Vector; import javax.xml.soap.SOAPException; -import org.apache.clerezza.rdf.core.Literal; +import org.apache.clerezza.commons.rdf.Literal; 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.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.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; @@ -116,7 +116,7 @@ public class CeliClassificationEnhanceme /** * Currently used as fise:entity-type for TopicAnnotations */ - private static final UriRef OWL_CLASS = new UriRef("http://www.w3.org/2002/07/owl#Class"); + private static final IRI OWL_CLASS = new IRI("http://www.w3.org/2002/07/owl#Class"); private Logger log = LoggerFactory.getLogger(getClass()); @@ -204,7 +204,7 @@ public class CeliClassificationEnhanceme + "in the canEnhance method! -> This indicated an Bug in the " + "implementation of the " + "EnhancementJobManager!"); } - Entry<UriRef, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); + Entry<IRI, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); if (contentPart == null) { throw new IllegalStateException("No ContentPart with Mimetype '" + TEXT_PLAIN_MIMETYPE + "' found for ContentItem " @@ -248,20 +248,20 @@ public class CeliClassificationEnhanceme if(lista.isEmpty()){ //not topics found return; //nothing to do } - MGraph g = ci.getMetadata(); + Graph g = ci.getMetadata(); //NOTE: EnhancementEngines that use "ENHANCE_ASYNC" need to acquire a // writeLock before modifications to the enhancement metadata ci.getLock().writeLock().lock(); try { //see STANBOL-617 for rules how to encode extracted topics //we need a single TextAnnotation to link all TopicAnnotations - UriRef textAnnotation = createTextEnhancement(ci, this); + IRI textAnnotation = createTextEnhancement(ci, this); // add the dc:type skos:Concept g.add(new TripleImpl(textAnnotation, DC_TYPE, SKOS_CONCEPT)); //not create the fise:TopicAnnotations for (Concept ne : lista) { - UriRef topicAnnotation = EnhancementEngineHelper.createTopicEnhancement(ci, this); + IRI topicAnnotation = EnhancementEngineHelper.createTopicEnhancement(ci, this); g.add(new TripleImpl(topicAnnotation, ENHANCER_ENTITY_REFERENCE, ne.getUri())); g.add(new TripleImpl(topicAnnotation, ENHANCER_ENTITY_LABEL, new PlainLiteralImpl(ne.getLabel()))); Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/ClassificationClientHTTP.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/ClassificationClientHTTP.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/ClassificationClientHTTP.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/ClassificationClientHTTP.java Tue May 17 22:20:49 2016 @@ -36,7 +36,7 @@ import javax.xml.soap.SOAPMessage; import javax.xml.soap.SOAPPart; import javax.xml.transform.stream.StreamSource; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.clerezza.rdf.core.impl.util.Base64; import org.apache.commons.lang.StringEscapeUtils; import org.apache.stanbol.enhancer.engines.celi.utils.Utils; @@ -148,7 +148,7 @@ public class ClassificationClientHTTP { // to the most specific dbpedia ontology class is best suited. String model = result.getElementsByTagNameNS("*","label").item(0).getTextContent(); model=model.substring(1, model.length()-1); - UriRef modelConcept = selectClassificationClass(model); + IRI modelConcept = selectClassificationClass(model); String conf=result.getElementsByTagNameNS("*","score").item(0).getTextContent(); Double confidence= new Double(conf); extractedConcepts.add(new Concept(model,modelConcept,confidence)); @@ -168,7 +168,7 @@ public class ClassificationClientHTTP { * @param classificationLabels the label string * @return the selected label */ - private UriRef selectClassificationClass(String classificationLabels) { + private IRI selectClassificationClass(String classificationLabels) { //NOTE: (rwesten) In general it would be better if CELI could provide // de-referenceable URLs for those suggestions. // If that is possible one would no longer need to link to the @@ -184,7 +184,7 @@ public class ClassificationClientHTTP { int end = classificationLabels.charAt(classificationLabels.length()-1) == ']' ? classificationLabels.length() - 1 : classificationLabels.length(); String[] tmps = classificationLabels.substring(start, end).split(" "); - return new UriRef(NamespaceEnum.dbpedia_ont.getNamespace()+ //the namespace + return new IRI(NamespaceEnum.dbpedia_ont.getNamespace()+ //the namespace (tmps.length > 1 ? tmps[1] : tmps[0])); //the Class for the label } Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/Concept.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/Concept.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/Concept.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/Concept.java Tue May 17 22:20:49 2016 @@ -16,15 +16,15 @@ */ package org.apache.stanbol.enhancer.engines.celi.classification.impl; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; public class Concept { private final String label; - private final UriRef uri; + private final IRI uri; private final Double confidence; - public Concept(String label, UriRef uri,Double confidence) { + public Concept(String label, IRI uri,Double confidence) { super(); this.label = label; this.uri = uri; @@ -42,7 +42,7 @@ public class Concept { } - public UriRef getUri() { + public IRI getUri() { return uri; } Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -34,10 +34,10 @@ import java.util.Set; import javax.xml.soap.SOAPException; 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.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.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; @@ -158,7 +158,7 @@ public class CeliLanguageIdentifierEnhan @Override public void computeEnhancements(ContentItem ci) throws EngineException { - Entry<UriRef, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); + Entry<IRI, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); if (contentPart == null) { throw new IllegalStateException("No ContentPart with Mimetype '" + TEXT_PLAIN_MIMETYPE + "' found for ContentItem " + ci.getUri() + ": This is also checked in the canEnhance method! -> This " + "indicated an Bug in the implementation of the " + "EnhancementJobManager!"); @@ -183,12 +183,12 @@ public class CeliLanguageIdentifierEnhan else lista = this.client.guessQueryLanguage(text); - MGraph g = ci.getMetadata(); + Graph g = ci.getMetadata(); //in ENHANCE_ASYNC we need to use read/write locks on the ContentItem ci.getLock().writeLock().lock(); try { GuessedLanguage gl = lista.get(0); - UriRef textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this); g.add(new TripleImpl(textEnhancement, DC_LANGUAGE, new PlainLiteralImpl(gl.getLang()))); g.add(new TripleImpl(textEnhancement, ENHANCER_CONFIDENCE, literalFactory.createTypedLiteral(gl.getConfidence()))); g.add(new TripleImpl(textEnhancement, DC_TYPE, DCTERMS_LINGUISTIC_SYSTEM)); Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliLemmatizerEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliLemmatizerEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliLemmatizerEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliLemmatizerEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -34,13 +34,13 @@ import java.util.Vector; import javax.xml.soap.SOAPException; -import org.apache.clerezza.rdf.core.Language; -import org.apache.clerezza.rdf.core.Literal; +import org.apache.clerezza.commons.rdf.Language; +import org.apache.clerezza.commons.rdf.Literal; 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.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.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; @@ -86,7 +86,7 @@ import org.slf4j.LoggerFactory; }) public class CeliLemmatizerEnhancementEngine extends AbstractEnhancementEngine<IOException, RuntimeException> implements EnhancementEngine, ServiceProperties { // TODO: check if it is OK to define new properties in the FISE namespace - public static final UriRef hasLemmaForm = new UriRef("http://fise.iks-project.eu/ontology/hasLemmaForm"); + public static final IRI hasLemmaForm = new IRI("http://fise.iks-project.eu/ontology/hasLemmaForm"); /** * This ensures that no connections to external services are made if Stanbol is started in offline mode as the OnlineMode service will only be available if OfflineMode is deactivated. @@ -185,7 +185,7 @@ public class CeliLemmatizerEnhancementEn + "implementation of the " + "EnhancementJobManager!"); } - Entry<UriRef, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); + Entry<IRI, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); if (contentPart == null) { throw new IllegalStateException("No ContentPart with Mimetype '" + TEXT_PLAIN_MIMETYPE + "' found for ContentItem " + ci.getUri() + ": This is also checked in the canEnhance method! -> This " + "indicated an Bug in the implementation of the " + "EnhancementJobManager!"); @@ -201,7 +201,7 @@ public class CeliLemmatizerEnhancementEn return; } - MGraph graph = ci.getMetadata(); + Graph graph = ci.getMetadata(); if (this.completeMorphoAnalysis) { this.addMorphoAnalysisEnhancement(ci, text, language, graph); @@ -210,7 +210,7 @@ public class CeliLemmatizerEnhancementEn } } - private void addMorphoAnalysisEnhancement(ContentItem ci, String text, String language, MGraph g) throws EngineException { + private void addMorphoAnalysisEnhancement(ContentItem ci, String text, String language, Graph g) throws EngineException { Language lang = new Language(language); // clerezza language for PlainLiterals List<LexicalEntry> terms; try { @@ -229,7 +229,7 @@ public class CeliLemmatizerEnhancementEn List<CeliMorphoFeatures> mFeatures = this.convertLexicalEntryToMorphFeatures(le, language); for (CeliMorphoFeatures feat : mFeatures) { // Create a text annotation for each interpretation produced by the morphological analyzer - UriRef textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTED_TEXT, new PlainLiteralImpl(le.getWordForm(), lang))); if (le.from >= 0 && le.to > 0) { g.add(new TripleImpl(textAnnotation, ENHANCER_START, literalFactory.createTypedLiteral(le.from))); @@ -244,7 +244,7 @@ public class CeliLemmatizerEnhancementEn } } - private void addLemmatizationEnhancement(ContentItem ci, String text, String language, MGraph g) throws EngineException { + private void addLemmatizationEnhancement(ContentItem ci, String text, String language, Graph g) throws EngineException { Language lang = new Language(language); // clerezza language for PlainLiterals String lemmatizedContents; try { @@ -257,7 +257,7 @@ public class CeliLemmatizerEnhancementEn // get a write lock before writing the enhancements ci.getLock().writeLock().lock(); try { - UriRef textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this); g.add(new TripleImpl(textEnhancement, CeliLemmatizerEnhancementEngine.hasLemmaForm, new PlainLiteralImpl(lemmatizedContents, lang))); } finally { ci.getLock().writeLock().unlock(); Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/ner/impl/CeliNamedEntityExtractionEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/ner/impl/CeliNamedEntityExtractionEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/ner/impl/CeliNamedEntityExtractionEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/ner/impl/CeliNamedEntityExtractionEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -39,15 +39,15 @@ import java.util.Set; import javax.xml.soap.SOAPException; -import org.apache.clerezza.rdf.core.Language; -import org.apache.clerezza.rdf.core.Literal; +import org.apache.clerezza.commons.rdf.Language; +import org.apache.clerezza.commons.rdf.Literal; import org.apache.clerezza.rdf.core.LiteralFactory; -import org.apache.clerezza.rdf.core.MGraph; +import org.apache.clerezza.commons.rdf.Graph; import org.apache.clerezza.rdf.core.NoConvertorException; -import org.apache.clerezza.rdf.core.Resource; -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.clerezza.commons.rdf.RDFTerm; +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.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; @@ -98,7 +98,7 @@ public class CeliNamedEntityExtractionEn */ public static final Literal LANG_ID_ENGINE_NAME = LiteralFactory.getInstance().createTypedLiteral("org.apache.stanbol.enhancer.engines.celi.langid.impl.CeliLanguageIdentifierEnhancementEngine"); - private static Map<String, UriRef> entityTypes = new HashMap<String, UriRef>(); + private static Map<String, IRI> entityTypes = new HashMap<String, IRI>(); static { entityTypes.put("pers", OntologicalClasses.DBPEDIA_PERSON); entityTypes.put("PER", OntologicalClasses.DBPEDIA_PERSON); @@ -248,7 +248,7 @@ public class CeliNamedEntityExtractionEn @Override public void computeEnhancements(ContentItem ci) throws EngineException { - Entry<UriRef, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); + Entry<IRI, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); if (contentPart == null) { throw new IllegalStateException("No ContentPart with Mimetype '" + TEXT_PLAIN_MIMETYPE + "' found for ContentItem " + ci.getUri() + ": This is also checked in the canEnhance method! -> This " + "indicated an Bug in the implementation of the " + "EnhancementJobManager!"); @@ -272,11 +272,11 @@ public class CeliNamedEntityExtractionEn List<NamedEntity> lista = this.client.extractEntities(text, language); LiteralFactory literalFactory = LiteralFactory.getInstance(); - MGraph g = ci.getMetadata(); + Graph g = ci.getMetadata(); for (NamedEntity ne : lista) { try { - UriRef textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); //add selected text as PlainLiteral in the language extracted from the text g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTED_TEXT, new PlainLiteralImpl(ne.getFormKind(),lang))); @@ -307,7 +307,7 @@ public class CeliNamedEntityExtractionEn return supportedLangs.contains(language); } - private Resource getEntityRefForType(String type) { + private RDFTerm getEntityRefForType(String type) { if (!entityTypes.containsKey(type)) return OntologicalClasses.SKOS_CONCEPT; else Modified: stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliSentimentAnalysisEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliSentimentAnalysisEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliSentimentAnalysisEngine.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/main/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliSentimentAnalysisEngine.java Tue May 17 22:20:49 2016 @@ -37,13 +37,13 @@ import java.util.Set; import javax.xml.soap.SOAPException; -import org.apache.clerezza.rdf.core.Language; +import org.apache.clerezza.commons.rdf.Language; import org.apache.clerezza.rdf.core.LiteralFactory; -import org.apache.clerezza.rdf.core.MGraph; +import org.apache.clerezza.commons.rdf.Graph; import org.apache.clerezza.rdf.core.NoConvertorException; -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.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.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Deactivate; @@ -209,7 +209,7 @@ public class CeliSentimentAnalysisEngine @Override public void computeEnhancements(ContentItem ci) throws EngineException { - Entry<UriRef, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); + Entry<IRI, Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMTYPES); if (contentPart == null) { throw new IllegalStateException("No ContentPart with Mimetype '" + TEXT_PLAIN_MIMETYPE + "' found for ContentItem " + ci.getUri() + ": This is also checked in the canEnhance method! -> This " + "indicated an Bug in the implementation of the " + "EnhancementJobManager!"); @@ -233,11 +233,11 @@ public class CeliSentimentAnalysisEngine List<SentimentExpression> lista = this.client.extractSentimentExpressions(text, language); LiteralFactory literalFactory = LiteralFactory.getInstance(); - MGraph g = ci.getMetadata(); + Graph g = ci.getMetadata(); for (SentimentExpression se : lista) { try { - UriRef textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); //add selected text as PlainLiteral in the language extracted from the text g.add(new TripleImpl(textAnnotation, ENHANCER_SELECTED_TEXT, new PlainLiteralImpl(se.getSnippetStr(),lang))); g.add(new TripleImpl(textAnnotation, DC_TYPE, CeliConstants.SENTIMENT_EXPRESSION)); Modified: stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/CeliClassificationEnhancementEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/CeliClassificationEnhancementEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/CeliClassificationEnhancementEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/classification/impl/CeliClassificationEnhancementEngineTest.java Tue May 17 22:20:49 2016 @@ -29,10 +29,10 @@ import java.util.HashMap; import java.util.Hashtable; import org.apache.clerezza.rdf.core.LiteralFactory; -import org.apache.clerezza.rdf.core.Resource; -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.clerezza.commons.rdf.RDFTerm; +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.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.engines.celi.CeliConstants; import org.apache.stanbol.enhancer.engines.celi.testutils.MockComponentContext; @@ -98,7 +98,7 @@ public class CeliClassificationEnhanceme classificationEngine.computeEnhancements(ci); TestUtils.logEnhancements(ci); - HashMap<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>(); + HashMap<IRI,RDFTerm> expectedValues = new HashMap<IRI,RDFTerm>(); expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri()); expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral( classificationEngine.getClass().getName())); Modified: stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/langid/impl/CeliLanguageIdentifierEnhancementEngineTest.java Tue May 17 22:20:49 2016 @@ -26,8 +26,8 @@ import java.util.HashMap; import java.util.Hashtable; import org.apache.clerezza.rdf.core.LiteralFactory; -import org.apache.clerezza.rdf.core.Resource; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.RDFTerm; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.engines.celi.CeliConstants; import org.apache.stanbol.enhancer.engines.celi.testutils.MockComponentContext; @@ -84,7 +84,7 @@ public class CeliLanguageIdentifierEnhan TestUtils.logEnhancements(ci); - HashMap<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>(); + HashMap<IRI,RDFTerm> expectedValues = new HashMap<IRI,RDFTerm>(); expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri()); expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral( langIdentifier.getClass().getName())); Modified: stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliAnalyzedTextLemmatizerEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliAnalyzedTextLemmatizerEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliAnalyzedTextLemmatizerEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliAnalyzedTextLemmatizerEngineTest.java Tue May 17 22:20:49 2016 @@ -28,8 +28,8 @@ import java.util.List; import junit.framework.Assert; -import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl; -import org.apache.clerezza.rdf.core.impl.TripleImpl; +import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl; +import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl; import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.engines.celi.CeliConstants; import org.apache.stanbol.enhancer.engines.celi.testutils.MockComponentContext; Modified: stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliLemmatizerEnhancementEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliLemmatizerEnhancementEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliLemmatizerEnhancementEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/lemmatizer/impl/CeliLemmatizerEnhancementEngineTest.java Tue May 17 22:20:49 2016 @@ -37,15 +37,14 @@ import java.util.Hashtable; import java.util.Iterator; import org.apache.clerezza.rdf.core.LiteralFactory; -import org.apache.clerezza.rdf.core.NonLiteral; -import org.apache.clerezza.rdf.core.PlainLiteral; -import org.apache.clerezza.rdf.core.Resource; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.TripleCollection; -import org.apache.clerezza.rdf.core.TypedLiteral; -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.clerezza.commons.rdf.BlankNodeOrIRI; +import org.apache.clerezza.commons.rdf.RDFTerm; +import org.apache.clerezza.commons.rdf.Triple; +import org.apache.clerezza.commons.rdf.Graph; +import org.apache.clerezza.commons.rdf.IRI; +import org.apache.clerezza.commons.rdf.Literal; +import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl; +import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl; import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.engines.celi.CeliConstants; import org.apache.stanbol.enhancer.engines.celi.CeliMorphoFeatures; @@ -118,17 +117,17 @@ public class CeliLemmatizerEnhancementEn TestUtils.logEnhancements(ci); //validate enhancement - HashMap<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>(); + HashMap<IRI,RDFTerm> expectedValues = new HashMap<IRI,RDFTerm>(); expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri()); expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral( morphoAnalysisEngine.getClass().getName())); Iterator<Triple> lemmaTextAnnotationIterator = ci.getMetadata().filter(null, RDF_TYPE, ENHANCER_TEXTANNOTATION); assertTrue("A TextAnnotation is expected by this Test", lemmaTextAnnotationIterator.hasNext()); - NonLiteral lemmaTextAnnotation = lemmaTextAnnotationIterator.next().getSubject(); - assertTrue("TextAnnoations MUST BE UriRefs!",lemmaTextAnnotation instanceof UriRef); + BlankNodeOrIRI lemmaTextAnnotation = lemmaTextAnnotationIterator.next().getSubject(); + assertTrue("TextAnnoations MUST BE IRIs!",lemmaTextAnnotation instanceof IRI); assertFalse("Only a single TextAnnotation is expected by this Test", lemmaTextAnnotationIterator.hasNext()); //validate the enhancement metadata - validateEnhancement(ci.getMetadata(), (UriRef)lemmaTextAnnotation, expectedValues); + validateEnhancement(ci.getMetadata(), (IRI)lemmaTextAnnotation, expectedValues); //validate the lemma form TextAnnotation int lemmaForms = validateLemmaFormProperty(ci.getMetadata(), lemmaTextAnnotation,"it"); assertTrue("Only a single LemmaForm property is expected if '"+ MORPHOLOGICAL_ANALYSIS+"=false'",lemmaForms == 1); @@ -154,7 +153,7 @@ public class CeliLemmatizerEnhancementEn TestUtils.logEnhancements(ci); //validate enhancements - HashMap<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>(); + HashMap<IRI,RDFTerm> expectedValues = new HashMap<IRI,RDFTerm>(); expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri()); expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral( morphoAnalysisEngine.getClass().getName())); @@ -166,7 +165,7 @@ public class CeliLemmatizerEnhancementEn // -> this might be used to test that there are no TextAnnotations int textAnnotationCount = 0; while (textAnnotationIterator.hasNext()) { - UriRef textAnnotation = (UriRef) textAnnotationIterator.next().getSubject(); + IRI textAnnotation = (IRI) textAnnotationIterator.next().getSubject(); // test if selected Text is added validateTextAnnotation(ci.getMetadata(), textAnnotation,TERM,expectedValues); textAnnotationCount++; @@ -187,18 +186,18 @@ public class CeliLemmatizerEnhancementEn * @param lang the language of the analyzed text * @return The number of lemma forms found */ - private int validateLemmaFormProperty(TripleCollection enhancements, NonLiteral textAnnotation, String lang) { + private int validateLemmaFormProperty(Graph enhancements, BlankNodeOrIRI textAnnotation, String lang) { Iterator<Triple> lemmaFormsIterator = enhancements.filter(textAnnotation, hasLemmaForm, null); assertTrue("No lemma form value found for TextAnnotation "+textAnnotation+"!", lemmaFormsIterator.hasNext()); int lemmaFormCount = 0; while(lemmaFormsIterator.hasNext()){ lemmaFormCount++; - Resource lemmaForms = lemmaFormsIterator.next().getObject(); - assertTrue("Lemma Forms value are expected of type PlainLiteral", lemmaForms instanceof PlainLiteral); - assertFalse("Lemma forms MUST NOT be empty",((PlainLiteral)lemmaForms).getLexicalForm().isEmpty()); - assertNotNull("Language of the Lemma Form literal MUST BE not null",((PlainLiteral)lemmaForms).getLanguage()); + RDFTerm lemmaForms = lemmaFormsIterator.next().getObject(); + assertTrue("Lemma Forms value are expected of type Literal", lemmaForms instanceof Literal); + assertFalse("Lemma forms MUST NOT be empty",((Literal)lemmaForms).getLexicalForm().isEmpty()); + assertNotNull("Language of the Lemma Form literal MUST BE not null",((Literal)lemmaForms).getLanguage()); assertEquals("Language of the Lemma Form literal MUST BE the same as for the parsed text", - lang, ((PlainLiteral)lemmaForms).getLanguage().toString()); + lang, ((Literal)lemmaForms).getLanguage().toString()); } return lemmaFormCount; } @@ -207,14 +206,14 @@ public class CeliLemmatizerEnhancementEn * @param enhancements The graph with the enhancements * @param textAnnotation the TextAnnotation to check */ - private void validateMorphoFeatureProperty(TripleCollection enhancements, NonLiteral textAnnotation) { + private void validateMorphoFeatureProperty(Graph enhancements, BlankNodeOrIRI textAnnotation) { //This taste checks for known morpho features of a given input (constant TERM) Iterator<Triple> morphoFeatureIterator = enhancements.filter(textAnnotation, RDF_TYPE, null); assertTrue("No POS Morpho Feature value found for TextAnnotation "+textAnnotation+"!", morphoFeatureIterator.hasNext()); while(morphoFeatureIterator.hasNext()){ - Resource morphoFeature = morphoFeatureIterator.next().getObject(); - assertTrue("Morpho Feature value are expected of typed literal", morphoFeature instanceof UriRef); - String feature=((UriRef)morphoFeature).getUnicodeString(); + RDFTerm morphoFeature = morphoFeatureIterator.next().getObject(); + assertTrue("Morpho Feature value are expected of typed literal", morphoFeature instanceof IRI); + String feature=((IRI)morphoFeature).getUnicodeString(); assertFalse("Morpho Feature MUST NOT be empty",feature.isEmpty()); if(feature.startsWith(OLIA_NAMESPACE)){ String key=feature.substring(OLIA_NAMESPACE.length()); @@ -225,9 +224,9 @@ public class CeliLemmatizerEnhancementEn morphoFeatureIterator = enhancements.filter(textAnnotation, CeliMorphoFeatures.HAS_GENDER, null); assertTrue("No Gender Morpho Feature value found for TextAnnotation "+textAnnotation+"!", morphoFeatureIterator.hasNext()); if(morphoFeatureIterator.hasNext()){ - Resource morphoFeature = morphoFeatureIterator.next().getObject(); - assertTrue("Morpho Feature value are expected of typed literal", morphoFeature instanceof UriRef); - String feature=((UriRef)morphoFeature).getUnicodeString(); + RDFTerm morphoFeature = morphoFeatureIterator.next().getObject(); + assertTrue("Morpho Feature value are expected of typed literal", morphoFeature instanceof IRI); + String feature=((IRI)morphoFeature).getUnicodeString(); assertFalse("Morpho Feature MUST NOT be empty",feature.isEmpty()); if(feature.startsWith(OLIA_NAMESPACE)){ String key=feature.substring(OLIA_NAMESPACE.length()); @@ -238,9 +237,9 @@ public class CeliLemmatizerEnhancementEn morphoFeatureIterator = enhancements.filter(textAnnotation, CeliMorphoFeatures.HAS_NUMBER, null); assertTrue("No Number Morpho Feature value found for TextAnnotation "+textAnnotation+"!", morphoFeatureIterator.hasNext()); if(morphoFeatureIterator.hasNext()){ - Resource morphoFeature = morphoFeatureIterator.next().getObject(); - assertTrue("Morpho Feature value are expected of typed literal", morphoFeature instanceof UriRef); - String feature=((UriRef)morphoFeature).getUnicodeString(); + RDFTerm morphoFeature = morphoFeatureIterator.next().getObject(); + assertTrue("Morpho Feature value are expected of typed literal", morphoFeature instanceof IRI); + String feature=((IRI)morphoFeature).getUnicodeString(); assertFalse("Morpho Feature MUST NOT be empty",feature.isEmpty()); if(feature.startsWith(OLIA_NAMESPACE)){ String key=feature.substring(OLIA_NAMESPACE.length()); @@ -251,10 +250,10 @@ public class CeliLemmatizerEnhancementEn morphoFeatureIterator = enhancements.filter(textAnnotation, CeliLemmatizerEnhancementEngine.hasLemmaForm, null); assertTrue("No Number Morpho Feature value found for TextAnnotation "+textAnnotation+"!", morphoFeatureIterator.hasNext()); if(morphoFeatureIterator.hasNext()){ - Resource morphoFeature = morphoFeatureIterator.next().getObject(); - assertTrue("Lemma Forms value are expected of type PlainLiteral", morphoFeature instanceof PlainLiteral); - assertFalse("Lemma forms MUST NOT be empty",((PlainLiteral)morphoFeature).getLexicalForm().isEmpty()); - String feature=((PlainLiteral)morphoFeature).getLexicalForm(); + RDFTerm morphoFeature = morphoFeatureIterator.next().getObject(); + assertTrue("Lemma Forms value are expected of type Literal", morphoFeature instanceof Literal); + assertFalse("Lemma forms MUST NOT be empty",((Literal)morphoFeature).getLexicalForm().isEmpty()); + String feature=((Literal)morphoFeature).getLexicalForm(); assertTrue("Lemma of "+TERM+" should be "+TERM , (feature.equals(TERM))); } Modified: stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/ner/impl/CeliNamedEntityExtractionEnhancementEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/ner/impl/CeliNamedEntityExtractionEnhancementEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/ner/impl/CeliNamedEntityExtractionEnhancementEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/ner/impl/CeliNamedEntityExtractionEnhancementEngineTest.java Tue May 17 22:20:49 2016 @@ -26,10 +26,10 @@ import java.util.HashMap; import java.util.Hashtable; import org.apache.clerezza.rdf.core.LiteralFactory; -import org.apache.clerezza.rdf.core.Resource; -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.clerezza.commons.rdf.RDFTerm; +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.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.engines.celi.CeliConstants; import org.apache.stanbol.enhancer.engines.celi.classification.impl.CeliClassificationEnhancementEngine; @@ -103,7 +103,7 @@ public class CeliNamedEntityExtractionEn TestUtils.logEnhancements(ci); - HashMap<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>(); + HashMap<IRI,RDFTerm> expectedValues = new HashMap<IRI,RDFTerm>(); expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri()); expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral( nerEngine.getClass().getName())); @@ -125,23 +125,23 @@ public class CeliNamedEntityExtractionEn //this.testInput(CeliNamedEntityExtractionEnhancementEngineTest.TEXT_fr2, "fr"); } -// private int checkAllEntityAnnotations(MGraph g) { +// private int checkAllEntityAnnotations(Graph g) { // Iterator<Triple> entityAnnotationIterator = g.filter(null, RDF_TYPE, ENHANCER_ENTITYANNOTATION); // int entityAnnotationCount = 0; // while (entityAnnotationIterator.hasNext()) { -// UriRef entityAnnotation = (UriRef) entityAnnotationIterator.next().getSubject(); +// IRI entityAnnotation = (IRI) entityAnnotationIterator.next().getSubject(); // entityAnnotationCount++; // } // return entityAnnotationCount; // } // -// private int checkAllTextAnnotations(MGraph g, String content) { +// private int checkAllTextAnnotations(Graph g, String content) { // Iterator<Triple> textAnnotationIterator = g.filter(null, RDF_TYPE, ENHANCER_TEXTANNOTATION); // // test if a textAnnotation is present // assertTrue(textAnnotationIterator.hasNext()); // int textAnnotationCount = 0; // while (textAnnotationIterator.hasNext()) { -// UriRef textAnnotation = (UriRef) textAnnotationIterator.next().getSubject(); +// IRI textAnnotation = (IRI) textAnnotationIterator.next().getSubject(); // textAnnotationCount++; // } // return textAnnotationCount; Modified: stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliAnalyzedTextSentimentAnalysisEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliAnalyzedTextSentimentAnalysisEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliAnalyzedTextSentimentAnalysisEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliAnalyzedTextSentimentAnalysisEngineTest.java Tue May 17 22:20:49 2016 @@ -26,8 +26,8 @@ import java.util.List; import junit.framework.Assert; -import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl; -import org.apache.clerezza.rdf.core.impl.TripleImpl; +import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl; +import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl; import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.engines.celi.CeliConstants; import org.apache.stanbol.enhancer.engines.celi.lemmatizer.impl.CeliAnalyzedTextLemmatizerEngineTest; Modified: stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliSentimentAnalysisEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliSentimentAnalysisEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliSentimentAnalysisEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/celi/src/test/java/org/apache/stanbol/enhancer/engines/celi/sentimentanalysis/impl/CeliSentimentAnalysisEngineTest.java Tue May 17 22:20:49 2016 @@ -27,10 +27,10 @@ import java.util.HashMap; import java.util.Hashtable; import org.apache.clerezza.rdf.core.LiteralFactory; -import org.apache.clerezza.rdf.core.Resource; -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.clerezza.commons.rdf.RDFTerm; +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.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.engines.celi.CeliConstants; import org.apache.stanbol.enhancer.engines.celi.testutils.MockComponentContext; @@ -92,7 +92,7 @@ public class CeliSentimentAnalysisEngine TestUtils.logEnhancements(ci); - HashMap<UriRef, Resource> expectedValues = new HashMap<UriRef, Resource>(); + HashMap<IRI, RDFTerm> expectedValues = new HashMap<IRI, RDFTerm>(); expectedValues.put(Properties.ENHANCER_EXTRACTED_FROM, ci.getUri()); expectedValues.put(Properties.DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral(sentimentAnalysisEngine.getClass().getName())); expectedValues.put(DC_TYPE, CeliConstants.SENTIMENT_EXPRESSION); Modified: stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/Constants.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/Constants.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/Constants.java (original) +++ stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/Constants.java Tue May 17 22:20:49 2016 @@ -22,7 +22,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.felix.scr.annotations.Property; /** @@ -60,17 +60,17 @@ public interface Constants { * Definition of some Spotlight specific properties added to * fise:EntityAnnotations created by this Engine */ - UriRef PROPERTY_CONTEXTUAL_SCORE = new UriRef( + IRI PROPERTY_CONTEXTUAL_SCORE = new IRI( SPOTLIGHT_NAME_SPACE + "contextualScore"); - UriRef PROPERTY_PERCENTAGE_OF_SECOND_RANK = new UriRef( + IRI PROPERTY_PERCENTAGE_OF_SECOND_RANK = new IRI( SPOTLIGHT_NAME_SPACE + "percentageOfSecondRank"); - UriRef PROPERTY_SUPPORT = new UriRef( + IRI PROPERTY_SUPPORT = new IRI( SPOTLIGHT_NAME_SPACE + "support"); - UriRef PROPERTY_PRIOR_SCORE = new UriRef( + IRI PROPERTY_PRIOR_SCORE = new IRI( SPOTLIGHT_NAME_SPACE + "priorScore"); - UriRef PROPERTY_FINAL_SCORE = new UriRef( + IRI PROPERTY_FINAL_SCORE = new IRI( SPOTLIGHT_NAME_SPACE + "finalScore"); - UriRef PROPERTY_SIMILARITY_SCORE = new UriRef( + IRI PROPERTY_SIMILARITY_SCORE = new IRI( SPOTLIGHT_NAME_SPACE + "similarityScore"); Charset UTF8 = Charset.forName("UTF-8"); Modified: stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/annotate/DBPSpotlightAnnotateEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/annotate/DBPSpotlightAnnotateEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/annotate/DBPSpotlightAnnotateEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/annotate/DBPSpotlightAnnotateEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -42,8 +42,8 @@ import java.util.Dictionary; import java.util.HashMap; import java.util.Map; -import org.apache.clerezza.rdf.core.Language; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.Language; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.clerezza.rdf.core.serializedform.Serializer; import org.apache.commons.io.IOUtils; import org.apache.felix.scr.annotations.Component; @@ -195,7 +195,7 @@ public class DBPSpotlightAnnotateEnhance String text = SpotlightEngineUtils.getPlainContent(ci); Collection<Annotation> dbpslGraph = doPostRequest(text,ci.getUri()); - Map<SurfaceForm,UriRef> surfaceForm2TextAnnotation = new HashMap<SurfaceForm,UriRef>(); + Map<SurfaceForm,IRI> surfaceForm2TextAnnotation = new HashMap<SurfaceForm,IRI>(); if (dbpslGraph != null) { // Acquire a write lock on the ContentItem when adding the // enhancements @@ -235,9 +235,9 @@ public class DBPSpotlightAnnotateEnhance */ protected void createEnhancements(Collection<Annotation> occs, ContentItem ci, String text, Language language, - Map<SurfaceForm,UriRef> surfaceForm2TextAnnotation) { + Map<SurfaceForm,IRI> surfaceForm2TextAnnotation) { for (Annotation occ : occs) { - UriRef textAnnotation = surfaceForm2TextAnnotation.get(occ.surfaceForm); + IRI textAnnotation = surfaceForm2TextAnnotation.get(occ.surfaceForm); if(textAnnotation == null){ //not yet written ... create a new textAnnotation = SpotlightEngineUtils.createTextEnhancement( occ.surfaceForm, this, ci, text, language); @@ -260,7 +260,7 @@ public class DBPSpotlightAnnotateEnhance * @throws EngineException * if the request cannot be sent */ - protected Collection<Annotation> doPostRequest(String text, UriRef contentItemUri) + protected Collection<Annotation> doPostRequest(String text, IRI contentItemUri) throws EngineException { HttpURLConnection connection = null; BufferedWriter wr = null; Modified: stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/candidates/DBPSpotlightCandidatesEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/candidates/DBPSpotlightCandidatesEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/candidates/DBPSpotlightCandidatesEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/candidates/DBPSpotlightCandidatesEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -44,10 +44,10 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import org.apache.clerezza.rdf.core.Language; -import org.apache.clerezza.rdf.core.MGraph; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.impl.TripleImpl; +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.TripleImpl; import org.apache.clerezza.rdf.core.serializedform.Serializer; import org.apache.commons.io.IOUtils; import org.apache.felix.scr.annotations.Component; @@ -236,16 +236,16 @@ public class DBPSpotlightCandidatesEnhan ContentItem ci, String text, Language language) { // TODO create TextEnhancement (form, start, end, type?) - HashMap<String, UriRef> entityAnnotationMap = new HashMap<String, UriRef>(); + HashMap<String, IRI> entityAnnotationMap = new HashMap<String, IRI>(); - MGraph model = ci.getMetadata(); + Graph model = ci.getMetadata(); for (SurfaceForm occ : occs) { - UriRef textAnnotation = SpotlightEngineUtils.createTextEnhancement( + IRI textAnnotation = SpotlightEngineUtils.createTextEnhancement( occ, this, ci, text, language); Iterator<CandidateResource> resources = occ.resources.iterator(); while (resources.hasNext()) { CandidateResource resource = resources.next(); - UriRef entityAnnotation = SpotlightEngineUtils.createEntityAnnotation( + IRI entityAnnotation = SpotlightEngineUtils.createEntityAnnotation( resource, this, ci, textAnnotation); entityAnnotationMap.put(resource.localName, entityAnnotation); } @@ -269,7 +269,7 @@ public class DBPSpotlightCandidatesEnhan * @throws EngineException * if the request cannot be sent */ - protected Collection<SurfaceForm> doPostRequest(String text,UriRef contentItemUri) + protected Collection<SurfaceForm> doPostRequest(String text,IRI contentItemUri) throws EngineException { HttpURLConnection connection = null; BufferedWriter wr = null; Modified: stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/disambiguate/DBPSpotlightDisambiguateEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/disambiguate/DBPSpotlightDisambiguateEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/disambiguate/DBPSpotlightDisambiguateEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/disambiguate/DBPSpotlightDisambiguateEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -49,14 +49,14 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.Map; -import org.apache.clerezza.rdf.core.Language; -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.PlainLiteralImpl; -import org.apache.clerezza.rdf.core.impl.TripleImpl; +import org.apache.clerezza.commons.rdf.Language; +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.PlainLiteralImpl; +import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl; import org.apache.clerezza.rdf.core.serializedform.Serializer; import org.apache.commons.io.IOUtils; import org.apache.felix.scr.annotations.Component; @@ -137,7 +137,7 @@ public class DBPSpotlightDisambiguateEnh * holds the existing TextAnnotations, which are used as input for DBpedia * Spotlight, and later for linking of the results */ - private Hashtable<String, UriRef> textAnnotationsMap; + private Hashtable<String, IRI> textAnnotationsMap; private int connectionTimeout; /** @@ -207,7 +207,7 @@ public class DBPSpotlightDisambiguateEnh // Retrieve the existing text annotations (requires read lock) - MGraph graph = ci.getMetadata(); + Graph graph = ci.getMetadata(); String xmlTextAnnotations = this.getSpottedXml(text, graph); Collection<Annotation> dbpslGraph = doPostRequest(text, xmlTextAnnotations, ci.getUri()); @@ -247,14 +247,14 @@ public class DBPSpotlightDisambiguateEnh */ public void createEnhancements(Collection<Annotation> occs, ContentItem ci, Language language) { - HashMap<Resource, UriRef> entityAnnotationMap = new HashMap<Resource, UriRef>(); + HashMap<RDFTerm, IRI> entityAnnotationMap = new HashMap<RDFTerm, IRI>(); for (Annotation occ : occs) { if (textAnnotationsMap.get(occ.surfaceForm) != null) { - UriRef textAnnotation = textAnnotationsMap.get(occ.surfaceForm); - MGraph model = ci.getMetadata(); - UriRef entityAnnotation = EnhancementEngineHelper + IRI textAnnotation = textAnnotationsMap.get(occ.surfaceForm); + Graph model = ci.getMetadata(); + IRI entityAnnotation = EnhancementEngineHelper .createEntityEnhancement(ci, this); entityAnnotationMap.put(occ.uri, entityAnnotation); Literal label = new PlainLiteralImpl(occ.surfaceForm.name, language); @@ -268,7 +268,7 @@ public class DBPSpotlightDisambiguateEnh Iterator<String> it = t.iterator(); while (it.hasNext()) model.add(new TripleImpl(entityAnnotation, - ENHANCER_ENTITY_TYPE, new UriRef(it.next()))); + ENHANCER_ENTITY_TYPE, new IRI(it.next()))); } model.add(new TripleImpl(entityAnnotation, ENHANCER_ENTITY_REFERENCE, occ.uri)); @@ -290,7 +290,7 @@ public class DBPSpotlightDisambiguateEnh * if the request cannot be sent */ protected Collection<Annotation> doPostRequest(String text, - String xmlTextAnnotations, UriRef contentItemUri) throws EngineException { + String xmlTextAnnotations, IRI contentItemUri) throws EngineException { HttpURLConnection connection = null; BufferedWriter wr = null; try { @@ -381,16 +381,16 @@ public class DBPSpotlightDisambiguateEnh return Annotation.parseAnnotations(xmlDoc); } - private String getSpottedXml(String text, MGraph graph) { + private String getSpottedXml(String text, Graph graph) { StringBuilder xml = new StringBuilder(); - textAnnotationsMap = new Hashtable<String, UriRef>(); + textAnnotationsMap = new Hashtable<String, IRI>(); xml.append(String.format("<annotation text=\"%s\">", text)); try { for (Iterator<Triple> it = graph.filter(null, RDF_TYPE, TechnicalClasses.ENHANCER_TEXTANNOTATION); it.hasNext();) { // Triple tAnnotation = it.next(); - UriRef uri = (UriRef) it.next().getSubject(); + IRI uri = (IRI) it.next().getSubject(); String surfaceForm = EnhancementEngineHelper.getString(graph, uri, ENHANCER_SELECTED_TEXT); if (surfaceForm != null) { Modified: stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/model/Annotation.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/model/Annotation.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/model/Annotation.java (original) +++ stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/model/Annotation.java Tue May 17 22:20:49 2016 @@ -25,8 +25,8 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.clerezza.rdf.core.Resource; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.RDFTerm; +import org.apache.clerezza.commons.rdf.IRI; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -72,7 +72,7 @@ public class Annotation { IGNORED_DBP_TYPES = Collections.unmodifiableSet(ignored); } - public Resource uri; + public RDFTerm uri; //TODO: change this to a list with the parsed types // Processing of XML results should be done during parsing public String types; @@ -134,13 +134,13 @@ public class Annotation { * @return a Collection<DBPSLAnnotation> with all annotations */ public static Collection<Annotation> parseAnnotations(Document xmlDoc) { - NodeList nList = getElementsByTagName(xmlDoc, "Resource"); + NodeList nList = getElementsByTagName(xmlDoc, "RDFTerm"); Collection<Annotation> dbpslAnnos = new HashSet<Annotation>(); for (int temp = 0; temp < nList.getLength(); temp++) { Annotation dbpslann = new Annotation(); Element node = (Element) nList.item(temp); - dbpslann.uri = new UriRef(node.getAttribute("URI")); + dbpslann.uri = new IRI(node.getAttribute("URI")); dbpslann.support = (new Integer(node.getAttribute("support"))) .intValue(); dbpslann.types = node.getAttribute("types"); Modified: stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/model/CandidateResource.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/model/CandidateResource.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/model/CandidateResource.java (original) +++ stanbol/trunk/enhancement-engines/dbpedia-spotlight/src/main/java/org/apache/stanbol/enhancer/engines/dbpspotlight/model/CandidateResource.java Tue May 17 22:20:49 2016 @@ -21,13 +21,13 @@ import static org.apache.stanbol.enhance import java.util.Collection; import java.util.HashSet; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -//import org.apache.clerezza.rdf.core.Resource; +//import org.apache.clerezza.commons.rdf.RDFTerm; /** * Stores the candidate ressources given by DBPedia Spotlight Candidates. @@ -52,8 +52,8 @@ public class CandidateResource { support, priorScore, finalScore); } - public UriRef getUri(){ - return new UriRef(new StringBuilder("http://dbpedia.org/resource/") + public IRI getUri(){ + return new IRI(new StringBuilder("http://dbpedia.org/resource/") .append(localName).toString()); }
