Modified: stanbol/trunk/enhancement-engines/htmlextractor/src/test/java/org/apache/stanbol/enhancer/engines/htmlextractor/TestHtmlExtractor.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/htmlextractor/src/test/java/org/apache/stanbol/enhancer/engines/htmlextractor/TestHtmlExtractor.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/htmlextractor/src/test/java/org/apache/stanbol/enhancer/engines/htmlextractor/TestHtmlExtractor.java (original) +++ stanbol/trunk/enhancement-engines/htmlextractor/src/test/java/org/apache/stanbol/enhancer/engines/htmlextractor/TestHtmlExtractor.java Tue May 17 22:20:49 2016 @@ -24,11 +24,11 @@ import java.io.IOException; import java.io.InputStream; import java.util.Set; -import org.apache.clerezza.rdf.core.MGraph; -import org.apache.clerezza.rdf.core.NonLiteral; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.impl.SimpleMGraph; +import org.apache.clerezza.commons.rdf.Graph; +import org.apache.clerezza.commons.rdf.BlankNodeOrIRI; +import org.apache.clerezza.commons.rdf.Triple; +import org.apache.clerezza.commons.rdf.IRI; +import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph; import org.apache.stanbol.enhancer.engines.htmlextractor.impl.ClerezzaRDFUtils; import org.apache.stanbol.enhancer.engines.htmlextractor.impl.ExtractorException; import org.apache.stanbol.enhancer.engines.htmlextractor.impl.HtmlExtractionRegistry; @@ -78,7 +78,7 @@ public class TestHtmlExtractor { @Test public void testRdfaExtraction() throws Exception { HtmlExtractor extractor = new HtmlExtractor(registry, parser); - MGraph model = new SimpleMGraph(); + Graph model = new SimpleGraph(); String testFile = "test-rdfa.html"; // extract text from RDFa annotated html InputStream in = getResourceAsStream(testFile); @@ -91,7 +91,7 @@ public class TestHtmlExtractor { LOG.debug("RDFa triples: {}",tripleCounter); printTriples(model); assertEquals(8, tripleCounter); - ClerezzaRDFUtils.makeConnected(model, new UriRef("file://" + testFile), new UriRef(NIE_NS+"contains")); + ClerezzaRDFUtils.makeConnected(model, new IRI("file://" + testFile), new IRI(NIE_NS+"contains")); } /** This tests some Microformat extraction @@ -102,7 +102,7 @@ public class TestHtmlExtractor { @Test public void testMFExtraction() throws Exception { HtmlExtractor extractor = new HtmlExtractor(registry, parser); - MGraph model = new SimpleMGraph(); + Graph model = new SimpleGraph(); String testFile = "test-MF.html"; // extract text from RDFa annotated html @@ -116,7 +116,7 @@ public class TestHtmlExtractor { LOG.debug("Microformat triples: {}",tripleCounter); printTriples(model); assertEquals(127, tripleCounter); - ClerezzaRDFUtils.makeConnected(model, new UriRef("file://" + testFile), new UriRef(NIE_NS+"contains")); + ClerezzaRDFUtils.makeConnected(model, new IRI("file://" + testFile), new IRI(NIE_NS+"contains")); } /** This test some extraction of microdata from an HTML-5 document @@ -126,7 +126,7 @@ public class TestHtmlExtractor { @Test public void testMicrodataExtraction() throws Exception { HtmlExtractor extractor = new HtmlExtractor(registry, parser); - MGraph model = new SimpleMGraph(); + Graph model = new SimpleGraph(); String testFile = "test-microdata.html"; // extract text from RDFa annotated html @@ -140,7 +140,7 @@ public class TestHtmlExtractor { LOG.debug("Microdata triples: {}",tripleCounter); printTriples(model); assertEquals(91, tripleCounter); - ClerezzaRDFUtils.makeConnected(model, new UriRef("file://" + testFile), new UriRef(NIE_NS+"contains")); + ClerezzaRDFUtils.makeConnected(model, new IRI("file://" + testFile), new IRI(NIE_NS+"contains")); } /** This tests the merging of disconnected graphs under a single root @@ -150,7 +150,7 @@ public class TestHtmlExtractor { @Test public void testRootExtraction() throws Exception { HtmlExtractor extractor = new HtmlExtractor(registry, parser); - MGraph model = new SimpleMGraph(); + Graph model = new SimpleGraph(); String testFile = "test-MultiRoot.html"; // extract text from RDFa annotated html @@ -163,9 +163,9 @@ public class TestHtmlExtractor { int tripleCounter = model.size(); LOG.debug("Triples: {}",tripleCounter); printTriples(model); - Set<NonLiteral> roots = ClerezzaRDFUtils.findRoots(model); + Set<BlankNodeOrIRI> roots = ClerezzaRDFUtils.findRoots(model); assertTrue(roots.size() > 1); - ClerezzaRDFUtils.makeConnected(model, new UriRef("file://" + testFile), new UriRef(NIE_NS+"contains")); + ClerezzaRDFUtils.makeConnected(model, new IRI("file://" + testFile), new IRI(NIE_NS+"contains")); roots = ClerezzaRDFUtils.findRoots(model); assertEquals(1,roots.size()); } @@ -175,7 +175,7 @@ public class TestHtmlExtractor { testResultFile); } - private void printTriples(MGraph model) { + private void printTriples(Graph model) { for (Triple t: model) { LOG.debug(t.toString()); }
Modified: stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java (original) +++ stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngine.java Tue May 17 22:20:49 2016 @@ -30,13 +30,13 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -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.commons.lang.StringUtils; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; @@ -350,7 +350,7 @@ public class KeywordLinkingEngine if(isOfflineMode() && !entitySearcher.supportsOfflineMode()){ throw new EngineException("Offline mode is not supported by the Component used to lookup Entities"); } - Entry<UriRef,Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMETYPES); + Entry<IRI,Blob> contentPart = ContentItemHelper.getBlob(ci, SUPPORTED_MIMETYPES); if(contentPart == null){ throw new IllegalStateException("No ContentPart with a supported Mime Type" + "found for ContentItem "+ci.getUri()+"(supported: '" @@ -416,12 +416,12 @@ public class KeywordLinkingEngine if(language != null && !language.isEmpty()){ languageObject = new Language(language); } - MGraph metadata = ci.getMetadata(); + Graph metadata = ci.getMetadata(); for(LinkedEntity linkedEntity : linkedEntities){ - Collection<UriRef> textAnnotations = new ArrayList<UriRef>(linkedEntity.getOccurrences().size()); + Collection<IRI> textAnnotations = new ArrayList<IRI>(linkedEntity.getOccurrences().size()); //first create the TextAnnotations for the Occurrences for(Occurrence occurrence : linkedEntity.getOccurrences()){ - UriRef textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textAnnotation = EnhancementEngineHelper.createTextEnhancement(ci, this); textAnnotations.add(textAnnotation); metadata.add(new TripleImpl(textAnnotation, Properties.ENHANCER_START, @@ -438,14 +438,14 @@ public class KeywordLinkingEngine metadata.add(new TripleImpl(textAnnotation, Properties.ENHANCER_CONFIDENCE, literalFactory.createTypedLiteral(linkedEntity.getScore()))); - for(UriRef dcType : linkedEntity.getTypes()){ + for(IRI dcType : linkedEntity.getTypes()){ metadata.add(new TripleImpl( textAnnotation, Properties.DC_TYPE, dcType)); } } //now the EntityAnnotations for the Suggestions for(Suggestion suggestion : linkedEntity.getSuggestions()){ - UriRef entityAnnotation = EnhancementEngineHelper.createEntityEnhancement(ci, this); + IRI entityAnnotation = EnhancementEngineHelper.createEntityEnhancement(ci, this); //should we use the label used for the match, or search the //representation for the best label ... currently its the matched one Text label = suggestion.getBestLabel(linkerConfig.getNameField(),language); @@ -457,21 +457,21 @@ public class KeywordLinkingEngine new Language(label.getLanguage())))); metadata.add(new TripleImpl(entityAnnotation, Properties.ENHANCER_ENTITY_REFERENCE, - new UriRef(suggestion.getRepresentation().getId()))); + new IRI(suggestion.getRepresentation().getId()))); Iterator<Reference> suggestionTypes = suggestion.getRepresentation().getReferences(linkerConfig.getTypeField()); while(suggestionTypes.hasNext()){ metadata.add(new TripleImpl(entityAnnotation, - Properties.ENHANCER_ENTITY_TYPE, new UriRef(suggestionTypes.next().getReference()))); + Properties.ENHANCER_ENTITY_TYPE, new IRI(suggestionTypes.next().getReference()))); } metadata.add(new TripleImpl(entityAnnotation, Properties.ENHANCER_CONFIDENCE, literalFactory.createTypedLiteral(suggestion.getScore()))); - for(UriRef textAnnotation : textAnnotations){ + for(IRI textAnnotation : textAnnotations){ metadata.add(new TripleImpl(entityAnnotation, Properties.DC_RELATION, textAnnotation)); } //add the name of the ReferencedSite providing this suggestion metadata.add(new TripleImpl(entityAnnotation, - new UriRef(RdfResourceEnum.site.getUri()), + new IRI(RdfResourceEnum.site.getUri()), new PlainLiteralImpl(referencedSiteName))); //in case dereferencing of Entities is enabled we need also to //add the RDF data for entities @@ -493,7 +493,7 @@ public class KeywordLinkingEngine private String extractLanguage(ContentItem ci) { String lang = EnhancementEngineHelper.getLanguage(ci); // if(lang != null){ -// MGraph metadata = ci.getMetadata(); +// Graph metadata = ci.getMetadata(); // Iterator<Triple> langaugeEnhancementCreatorTriples = // metadata.filter(null, Properties.DC_CREATOR, LANG_ID_ENGINE_NAME); // if(langaugeEnhancementCreatorTriples.hasNext()){ @@ -867,14 +867,14 @@ public class KeywordLinkingEngine sourceTypes[0],o); continue configs; } - UriRef targetUri = new UriRef(targetType); + IRI targetUri = new IRI(targetType); for(String sourceType : sourceTypes){ if(!sourceType.isEmpty()){ sourceType = NamespaceMappingUtils.getConfiguredUri( nsPrefixService,TYPE_MAPPINGS,sourceType.trim()); //support for ns:localName try { //validate new URI(sourceType); - UriRef old = linkerConfig.setTypeMapping(sourceType, targetUri); + IRI old = linkerConfig.setTypeMapping(sourceType, targetUri); if(old == null){ log.info(" > add type mapping {} > {}", sourceType,targetType); } else { Modified: stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/EntityLinker.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/EntityLinker.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/EntityLinker.java (original) +++ stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/EntityLinker.java Tue May 17 22:20:49 2016 @@ -27,7 +27,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.stanbol.commons.opennlp.TextAnalyzer.AnalysedText.Token; import org.apache.stanbol.enhancer.engines.keywordextraction.impl.EntityLinkerConfig.RedirectProcessingMode; import org.apache.stanbol.enhancer.engines.keywordextraction.impl.Suggestion.MATCH; @@ -205,17 +205,17 @@ public class EntityLinker { * @param conceptTypes The list of suggestions * @return the types values for the {@link LinkedEntity} */ - private Set<UriRef> getLinkedEntityTypes(Collection<Suggestion> suggestions){ + private Set<IRI> getLinkedEntityTypes(Collection<Suggestion> suggestions){ Collection<String> conceptTypes = new HashSet<String>(); for(Suggestion suggestion : suggestions){ for(Iterator<Reference> types = suggestion.getRepresentation().getReferences(config.getTypeField()); types.hasNext();conceptTypes.add(types.next().getReference())); } - Map<String,UriRef> typeMappings = config.getTypeMappings(); - Set<UriRef> dcTypes = new HashSet<UriRef>(); + Map<String,IRI> typeMappings = config.getTypeMappings(); + Set<IRI> dcTypes = new HashSet<IRI>(); for(String conceptType : conceptTypes){ - UriRef dcType = typeMappings.get(conceptType); + IRI dcType = typeMappings.get(conceptType); if(dcType != null){ dcTypes.add(dcType); } Modified: stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/EntityLinkerConfig.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/EntityLinkerConfig.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/EntityLinkerConfig.java (original) +++ stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/EntityLinkerConfig.java Tue May 17 22:20:49 2016 @@ -25,7 +25,7 @@ import java.util.Set; import opennlp.tools.chunker.Chunker; import opennlp.tools.postag.POSTagger; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.stanbol.commons.opennlp.TextAnalyzer.AnalysedText; import org.apache.stanbol.commons.opennlp.TextAnalyzer.AnalysedText.Chunk; import org.apache.stanbol.commons.opennlp.TextAnalyzer.AnalysedText.Token; @@ -95,10 +95,10 @@ public class EntityLinkerConfig { * Default mapping for Concept types to dc:type values added for * TextAnnotations. */ - public static final Map<String,UriRef> DEFAULT_ENTITY_TYPE_MAPPINGS; + public static final Map<String,IRI> DEFAULT_ENTITY_TYPE_MAPPINGS; static { //the default mappings for the three types used by the Stanbol Enhancement Structure - Map<String,UriRef> mappings = new HashMap<String,UriRef>(); + Map<String,IRI> mappings = new HashMap<String,IRI>(); mappings.put(OntologicalClasses.DBPEDIA_ORGANISATION.getUnicodeString(), OntologicalClasses.DBPEDIA_ORGANISATION); mappings.put("http://dbpedia.org/ontology/Newspaper", OntologicalClasses.DBPEDIA_ORGANISATION); @@ -120,22 +120,22 @@ public class EntityLinkerConfig { mappings.put(OntologicalClasses.DBPEDIA_ORGANISATION.getUnicodeString(), OntologicalClasses.DBPEDIA_ORGANISATION); -// UriRef DRUG = new UriRef(NamespaceEnum.drugbank+"drugs"); +// IRI DRUG = new IRI(NamespaceEnum.drugbank+"drugs"); // mappings.put(DRUG.getUnicodeString(), DRUG); // mappings.put(NamespaceEnum.dbpediaOnt+"Drug", DRUG); // mappings.put(NamespaceEnum.dailymed+"drugs", DRUG); // mappings.put(NamespaceEnum.sider+"drugs", DRUG); // mappings.put(NamespaceEnum.tcm+"Medicine", DRUG); // -// UriRef DISEASE = new UriRef(NamespaceEnum.diseasome+"diseases"); +// IRI DISEASE = new IRI(NamespaceEnum.diseasome+"diseases"); // mappings.put(DISEASE.getUnicodeString(), DISEASE); // mappings.put(NamespaceEnum.linkedct+"condition", DISEASE); // mappings.put(NamespaceEnum.tcm+"Disease", DISEASE); // -// UriRef SIDE_EFFECT = new UriRef(NamespaceEnum.sider+"side_effects"); +// IRI SIDE_EFFECT = new IRI(NamespaceEnum.sider+"side_effects"); // mappings.put(SIDE_EFFECT.getUnicodeString(), SIDE_EFFECT); // -// UriRef INGREDIENT = new UriRef(NamespaceEnum.dailymed+"ingredients"); +// IRI INGREDIENT = new IRI(NamespaceEnum.dailymed+"ingredients"); // mappings.put(INGREDIENT.getUnicodeString(), INGREDIENT); DEFAULT_ENTITY_TYPE_MAPPINGS = Collections.unmodifiableMap(mappings); @@ -198,8 +198,8 @@ public class EntityLinkerConfig { * Holds the mappings of rdf:type used by concepts to dc:type values used * by TextAnnotations. */ - private Map<String,UriRef> typeMappings; - private Map<String, UriRef> unmodTypeMappings; + private Map<String,IRI> typeMappings; + private Map<String, IRI> unmodTypeMappings; /** * The mode on how to process redirect for Entities. */ @@ -207,7 +207,7 @@ public class EntityLinkerConfig { /** * the default DC Type */ - private UriRef defaultDcType; + private IRI defaultDcType; private String nameField; private String redirectField; private String typeField; @@ -265,7 +265,7 @@ public class EntityLinkerConfig { setMaxSuggestions(DEFAULT_SUGGESTIONS); setMaxSearchTokens(DEFAULT_MAX_SEARCH_TOKENS); setRedirectProcessingMode(DEFAULT_REDIRECT_PROCESSING_MODE); - typeMappings = new HashMap<String,UriRef>(DEFAULT_ENTITY_TYPE_MAPPINGS); + typeMappings = new HashMap<String,IRI>(DEFAULT_ENTITY_TYPE_MAPPINGS); unmodTypeMappings = Collections.unmodifiableMap(typeMappings); setDefaultDcType(typeMappings.remove(null)); setNameField(DEFAULT_NAME_FIELD); @@ -445,23 +445,23 @@ public class EntityLinkerConfig { * @return the previously mapped dc:type value or <code>null</code> if * no mapping for the parsed concept type was present */ - public UriRef removeTypeMapping(String conceptType){ + public IRI removeTypeMapping(String conceptType){ return typeMappings.remove(conceptType); } /** * * @param conceptType the type of the concept or <code>null</code> to - * add the default dc:type mapping. See also {@link #setDefaultDcType(UriRef)} + * add the default dc:type mapping. See also {@link #setDefaultDcType(IRI)} * @param dcType the dc:type for the parsed concept type * @return the previously mapped dc:type value if an existing mapping * was updated or <code>null</code> if a new mapping was added. */ - public UriRef setTypeMapping(String conceptType, UriRef dcType){ + public IRI setTypeMapping(String conceptType, IRI dcType){ if(dcType == null) { throw new IllegalArgumentException("The parsed dc:type URI MUST NOT be NULL!"); } if(conceptType == null){ //handle setting of the default dc:type value - UriRef oldDefault = getDefaultDcType(); + IRI oldDefault = getDefaultDcType(); setDefaultDcType(dcType); return oldDefault; } @@ -475,7 +475,7 @@ public class EntityLinkerConfig { * cases. * @param defaultDcType the defaultDcType to set */ - public void setDefaultDcType(UriRef defaultDcType) { + public void setDefaultDcType(IRI defaultDcType) { this.defaultDcType = defaultDcType; } /** @@ -484,7 +484,7 @@ public class EntityLinkerConfig { * explicit mapping exists * @return the defaultDcType */ - public UriRef getDefaultDcType() { + public IRI getDefaultDcType() { return defaultDcType; } /** @@ -505,7 +505,7 @@ public class EntityLinkerConfig { * Getter for the read only mappings of type mappings * @return the type mappings (read only) */ - public Map<String,UriRef> getTypeMappings() { + public Map<String,IRI> getTypeMappings() { return unmodTypeMappings; } /** Modified: stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/LinkedEntity.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/LinkedEntity.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/LinkedEntity.java (original) +++ stanbol/trunk/enhancement-engines/keywordextraction/src/main/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/LinkedEntity.java Tue May 17 22:20:49 2016 @@ -24,7 +24,7 @@ import java.util.Set; import opennlp.tools.util.Span; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.stanbol.commons.opennlp.TextAnalyzer.AnalysedText; /** @@ -131,7 +131,7 @@ public class LinkedEntity { } } private final String selectedText; - private final Set<UriRef> types; + private final Set<IRI> types; private final List<Suggestion> suggestions; private final Collection<Occurrence> occurrences = new ArrayList<Occurrence>(); private final Collection<Occurrence> unmodOccurrences = Collections.unmodifiableCollection(occurrences); @@ -141,7 +141,7 @@ public class LinkedEntity { * @param suggestions the entity suggestions * @param types the types of the linked entity. */ - protected LinkedEntity(String selectedText, List<Suggestion> suggestions, Set<UriRef> types) { + protected LinkedEntity(String selectedText, List<Suggestion> suggestions, Set<IRI> types) { this.suggestions = Collections.unmodifiableList(suggestions); this.selectedText = selectedText; this.types = Collections.unmodifiableSet(types); @@ -155,7 +155,7 @@ public class LinkedEntity { * @param types the types of the linked entity. */ protected LinkedEntity(AnalysedText sentence,int startToken,int tokenSpan, - List<Suggestion> suggestions, Set<UriRef> types) { + List<Suggestion> suggestions, Set<IRI> types) { this(sentence.getText().substring( sentence.getTokens().get(startToken).getStart(), sentence.getTokens().get(tokenSpan).getEnd()),suggestions,types); @@ -173,7 +173,7 @@ public class LinkedEntity { * Getter for read only list of types * @return the types */ - public Set<UriRef> getTypes() { + public Set<IRI> getTypes() { return types; } /** Modified: stanbol/trunk/enhancement-engines/keywordextraction/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/keywordextraction/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/keywordextraction/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/keywordextraction/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/engine/KeywordLinkingEngineTest.java Tue May 17 22:20:49 2016 @@ -39,14 +39,13 @@ import java.util.Map; import opennlp.tools.tokenize.SimpleTokenizer; -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.Resource; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.TypedLiteral; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl; -import org.apache.clerezza.rdf.core.impl.TripleImpl; +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.stanbol.commons.opennlp.OpenNLP; import org.apache.stanbol.commons.opennlp.TextAnalyzer.TextAnalyzerConfig; import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; @@ -168,7 +167,7 @@ public class KeywordLinkingEngineTest { } public static ContentItem getContentItem(final String id, final String text) throws IOException { - return ciFactory.createContentItem(new UriRef(id),new StringSource(text)); + return ciFactory.createContentItem(new IRI(id),new StringSource(text)); } /** * This tests the EntityLinker functionality (if the expected Entities @@ -237,7 +236,7 @@ public class KeywordLinkingEngineTest { //compute the enhancements engine.computeEnhancements(ci); //validate the enhancement results - Map<UriRef,Resource> expectedValues = new HashMap<UriRef,Resource>(); + Map<IRI,RDFTerm> expectedValues = new HashMap<IRI,RDFTerm>(); expectedValues.put(ENHANCER_EXTRACTED_FROM, ci.getUri()); expectedValues.put(DC_CREATOR,LiteralFactory.getInstance().createTypedLiteral( engine.getClass().getName())); @@ -251,18 +250,18 @@ public class KeywordLinkingEngineTest { assertEquals("Five fise:EntityAnnotations are expected by this Test", 5, numEntityAnnotations); } /** - * Similar to {@link EnhancementStructureHelper#validateAllEntityAnnotations(org.apache.clerezza.rdf.core.TripleCollection, Map)} + * Similar to {@link EnhancementStructureHelper#validateAllEntityAnnotations(org.apache.clerezza.commons.rdf.Graph, Map)} * but in addition checks fise:confidence [0..1] and entityhub:site properties * @param ci * @param expectedValues * @return */ - private static int validateAllEntityAnnotations(ContentItem ci, Map<UriRef,Resource> expectedValues){ + private static int validateAllEntityAnnotations(ContentItem ci, Map<IRI,RDFTerm> expectedValues){ Iterator<Triple> entityAnnotationIterator = ci.getMetadata().filter(null, RDF_TYPE, ENHANCER_ENTITYANNOTATION); int entityAnnotationCount = 0; while (entityAnnotationIterator.hasNext()) { - UriRef entityAnnotation = (UriRef) entityAnnotationIterator.next().getSubject(); + IRI entityAnnotation = (IRI) entityAnnotationIterator.next().getSubject(); // test if selected Text is added validateEntityAnnotation(ci.getMetadata(), entityAnnotation, expectedValues); //validate also that the confidence is between [0..1] @@ -279,12 +278,12 @@ public class KeywordLinkingEngineTest { // +"',entityAnnotation "+entityAnnotation+")", // 0.0 <= confidence.doubleValue()); //Test the entityhub:site property (STANBOL-625) - UriRef ENTITYHUB_SITE = new UriRef(RdfResourceEnum.site.getUri()); + IRI ENTITYHUB_SITE = new IRI(RdfResourceEnum.site.getUri()); Iterator<Triple> entitySiteIterator = ci.getMetadata().filter(entityAnnotation, ENTITYHUB_SITE, null); assertTrue("Expected entityhub:site value is missing (entityAnnotation " +entityAnnotation+")",entitySiteIterator.hasNext()); - Resource siteResource = entitySiteIterator.next().getObject(); + RDFTerm siteResource = entitySiteIterator.next().getObject(); assertTrue("entityhub:site values MUST BE Literals", siteResource instanceof Literal); assertEquals("'"+TEST_REFERENCED_SITE_NAME+"' is expected as " + "entityhub:site value", TEST_REFERENCED_SITE_NAME, Modified: stanbol/trunk/enhancement-engines/keywordextraction/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/ClasspathDataFileProvider.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/keywordextraction/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/ClasspathDataFileProvider.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/keywordextraction/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/ClasspathDataFileProvider.java (original) +++ stanbol/trunk/enhancement-engines/keywordextraction/src/test/java/org/apache/stanbol/enhancer/engines/keywordextraction/impl/ClasspathDataFileProvider.java Tue May 17 22:20:49 2016 @@ -68,7 +68,7 @@ public class ClasspathDataFileProvider i // load default OpenNLP models from classpath (embedded in the defaultdata bundle) final String resourcePath = RESOURCE_BASE_PATH + filename; final URL dataFile = getClass().getClassLoader().getResource(resourcePath); - //log.debug("Resource {} found: {}", (in == null ? "NOT" : ""), resourcePath); + //log.debug("RDFTerm {} found: {}", (in == null ? "NOT" : ""), resourcePath); return dataFile; } } Modified: stanbol/trunk/enhancement-engines/kuromoji-nlp/src/main/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/KuromojiNlpEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/kuromoji-nlp/src/main/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/KuromojiNlpEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/kuromoji-nlp/src/main/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/KuromojiNlpEngine.java (original) +++ stanbol/trunk/enhancement-engines/kuromoji-nlp/src/main/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/KuromojiNlpEngine.java Tue May 17 22:20:49 2016 @@ -37,12 +37,12 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -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.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.commons.io.input.CharSequenceReader; import org.apache.felix.scr.annotations.Activate; import org.apache.felix.scr.annotations.Component; @@ -185,7 +185,7 @@ public class KuromojiNlpEngine extends A @Override public int canEnhance(ContentItem ci) throws EngineException { // check if content is present - Map.Entry<UriRef,Blob> entry = NlpEngineHelper.getPlainText(this, ci, false); + Map.Entry<IRI,Blob> entry = NlpEngineHelper.getPlainText(this, ci, false); if(entry == null || entry.getValue() == null) { return CANNOT_ENHANCE; } @@ -323,12 +323,12 @@ public class KuromojiNlpEngine extends A } catch (IOException e) {/* ignore */} } //finally write the NER annotations to the metadata of the ContentItem - final MGraph metadata = ci.getMetadata(); + final Graph metadata = ci.getMetadata(); ci.getLock().writeLock().lock(); try { Language lang = new Language("ja"); for(NerData nerData : nerList){ - UriRef ta = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI ta = EnhancementEngineHelper.createTextEnhancement(ci, this); metadata.add(new TripleImpl(ta, ENHANCER_SELECTED_TEXT, new PlainLiteralImpl( at.getSpan().substring(nerData.start, nerData.end),lang))); metadata.add(new TripleImpl(ta, DC_TYPE, nerData.tag.getType())); Modified: stanbol/trunk/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/ClasspathDataFileProvider.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/ClasspathDataFileProvider.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/ClasspathDataFileProvider.java (original) +++ stanbol/trunk/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/ClasspathDataFileProvider.java Tue May 17 22:20:49 2016 @@ -73,7 +73,7 @@ public class ClasspathDataFileProvider i // load default OpenNLP models from classpath (embedded in the defaultdata bundle) final String resourcePath = RESOURCE_BASE_PATH + filename; final URL dataFile = getClass().getClassLoader().getResource(resourcePath); - //log.debug("Resource {} found: {}", (in == null ? "NOT" : ""), resourcePath); + //log.debug("RDFTerm {} found: {}", (in == null ? "NOT" : ""), resourcePath); return dataFile; } } Modified: stanbol/trunk/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/TestKuromojiNlpEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/TestKuromojiNlpEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/TestKuromojiNlpEngine.java (original) +++ stanbol/trunk/enhancement-engines/kuromoji-nlp/src/test/java/org/apache/stanbol/enhancer/engines/kuromoji/impl/TestKuromojiNlpEngine.java Tue May 17 22:20:49 2016 @@ -24,10 +24,10 @@ import java.util.List; import java.util.Map; 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.commons.solr.utils.DataFileResourceLoader; import org.apache.stanbol.commons.stanboltools.datafileprovider.DataFileProvider; import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; @@ -62,7 +62,7 @@ public class TestKuromojiNlpEngine { private static ContentItemFactory contentItemFactory; - private static UriRef id = new UriRef("http://www.example.org/contentItem1"); + private static IRI id = new IRI("http://www.example.org/contentItem1"); /** * Test text taken from the <a href ="http://ja.wikipedia.org/wiki/%E3%83%AD%E3%83%B3%E3%83%89%E3%83%B3"> * Japanese wikipedia side for London</a>. @@ -107,7 +107,7 @@ public class TestKuromojiNlpEngine { Assert.assertEquals(EnhancementEngine.ENHANCE_ASYNC, engine.canEnhance(contentItem)); engine.computeEnhancements(contentItem); //assert the results - Map<UriRef,Resource> expected = new HashMap<UriRef,Resource>(); + Map<IRI,RDFTerm> expected = new HashMap<IRI,RDFTerm>(); expected.put(Properties.DC_CREATOR, lf.createTypedLiteral(engine.getClass().getName())); expected.put(Properties.ENHANCER_EXTRACTED_FROM,contentItem.getUri()); Assert.assertEquals(16, EnhancementStructureHelper.validateAllTextAnnotations( Modified: stanbol/trunk/enhancement-engines/langdetect/src/main/java/org/apache/stanbol/enhancer/engines/langdetect/LanguageDetectionEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/langdetect/src/main/java/org/apache/stanbol/enhancer/engines/langdetect/LanguageDetectionEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/langdetect/src/main/java/org/apache/stanbol/enhancer/engines/langdetect/LanguageDetectionEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/langdetect/src/main/java/org/apache/stanbol/enhancer/engines/langdetect/LanguageDetectionEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -32,10 +32,10 @@ import java.util.Map.Entry; import java.util.Set; 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.commons.io.IOUtils; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Properties; @@ -201,7 +201,7 @@ public class LanguageDetectionEnhancemen } 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() @@ -253,13 +253,13 @@ public class LanguageDetectionEnhancemen // add language to metadata if (languages != null) { - MGraph g = ci.getMetadata(); + Graph g = ci.getMetadata(); ci.getLock().writeLock().lock(); try { for(int i=0;i<maxSuggestedLanguages && i<languages.size();i++){ // add a hypothesis Language hypothesis = languages.get(i); - UriRef textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this); g.add(new TripleImpl(textEnhancement, DC_LANGUAGE, new PlainLiteralImpl(hypothesis.lang))); g.add(new TripleImpl(textEnhancement, ENHANCER_CONFIDENCE, literalFactory.createTypedLiteral(hypothesis.prob))); g.add(new TripleImpl(textEnhancement, DC_TYPE, DCTERMS_LINGUISTIC_SYSTEM)); Modified: stanbol/trunk/enhancement-engines/langdetect/src/test/java/org/apache/stanbol/enhancer/engines/langdetect/LanguageDetectionEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/langdetect/src/test/java/org/apache/stanbol/enhancer/engines/langdetect/LanguageDetectionEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/langdetect/src/test/java/org/apache/stanbol/enhancer/engines/langdetect/LanguageDetectionEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/langdetect/src/test/java/org/apache/stanbol/enhancer/engines/langdetect/LanguageDetectionEngineTest.java Tue May 17 22:20:49 2016 @@ -30,8 +30,8 @@ import java.util.HashMap; 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.commons.io.IOUtils; import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.servicesapi.ContentItem; @@ -119,7 +119,7 @@ public class LanguageDetectionEngineTest langIdEngine.activate(context); ContentItem ci = ciFactory.createContentItem(new StringSource(text)); langIdEngine.computeEnhancements(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( langIdEngine.getClass().getName())); Modified: stanbol/trunk/enhancement-engines/langid/src/main/java/org/apache/stanbol/enhancer/engines/langid/LangIdEnhancementEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/langid/src/main/java/org/apache/stanbol/enhancer/engines/langid/LangIdEnhancementEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/langid/src/main/java/org/apache/stanbol/enhancer/engines/langid/LangIdEnhancementEngine.java (original) +++ stanbol/trunk/enhancement-engines/langid/src/main/java/org/apache/stanbol/enhancer/engines/langid/LangIdEnhancementEngine.java Tue May 17 22:20:49 2016 @@ -27,10 +27,10 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; -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.Component; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; @@ -134,7 +134,7 @@ public class LangIdEnhancementEngine } 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() @@ -164,10 +164,10 @@ public class LangIdEnhancementEngine log.info("language identified as " + language); // add language to metadata - MGraph g = ci.getMetadata(); + Graph g = ci.getMetadata(); ci.getLock().writeLock().lock(); try { - UriRef textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this); + IRI textEnhancement = EnhancementEngineHelper.createTextEnhancement(ci, this); g.add(new TripleImpl(textEnhancement, DC_LANGUAGE, new PlainLiteralImpl(language))); g.add(new TripleImpl(textEnhancement, DC_TYPE, DCTERMS_LINGUISTIC_SYSTEM)); } finally { Modified: stanbol/trunk/enhancement-engines/langid/src/test/java/org/apache/stanbol/enhancer/engines/langid/LangIdEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/langid/src/test/java/org/apache/stanbol/enhancer/engines/langid/LangIdEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/langid/src/test/java/org/apache/stanbol/enhancer/engines/langid/LangIdEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/langid/src/test/java/org/apache/stanbol/enhancer/engines/langid/LangIdEngineTest.java Tue May 17 22:20:49 2016 @@ -28,8 +28,8 @@ import java.util.HashMap; 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.commons.io.IOUtils; import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory; import org.apache.stanbol.enhancer.engines.langid.LangIdEnhancementEngine; @@ -98,7 +98,7 @@ public class LangIdEngineTest { langIdEngine.activate(context); ContentItem ci = ciFactory.createContentItem(new StringSource(text)); langIdEngine.computeEnhancements(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( langIdEngine.getClass().getName())); Modified: stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngine.java (original) +++ stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngine.java Tue May 17 22:20:49 2016 @@ -39,14 +39,14 @@ import java.util.NavigableMap; import java.util.Set; import java.util.TreeMap; -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.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.Graph; +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.commons.io.input.CharSequenceReader; import org.apache.commons.lang.StringUtils; import org.apache.lucene.analysis.TokenStream; @@ -89,9 +89,9 @@ public class FstLinkingEngine implements private static final Map<String,Object> SERVICE_PROPERTIES = Collections.unmodifiableMap(Collections .singletonMap(ServiceProperties.ENHANCEMENT_ENGINE_ORDERING, (Object) ENGINE_ORDERING)); - private static final UriRef ENHANCER_ENTITY_RANKING = new UriRef(NamespaceEnum.fise + "entity-ranking"); + private static final IRI ENHANCER_ENTITY_RANKING = new IRI(NamespaceEnum.fise + "entity-ranking"); - public static final UriRef FISE_ORIGIN = new UriRef(NamespaceEnum.fise + "origin"); + public static final IRI FISE_ORIGIN = new IRI(NamespaceEnum.fise + "origin"); private final LiteralFactory literalFactory = LiteralFactory.getInstance(); @@ -419,7 +419,7 @@ public class FstLinkingEngine implements * @param neTypes the types of the named entity * @return */ - private boolean filterByNamedEntityType(Iterator<UriRef> eTypes, Set<String> neTypes) { + private boolean filterByNamedEntityType(Iterator<IRI> eTypes, Set<String> neTypes) { //first collect the allowed entity types Set<String> entityTypes = new HashSet<String>(); for(String neType : neTypes){ @@ -440,7 +440,7 @@ public class FstLinkingEngine implements } //second check the actual entity types against the allowed while(eTypes.hasNext()){ - UriRef typeUri = eTypes.next(); + IRI typeUri = eTypes.next(); if(typeUri != null && entityTypes.contains(typeUri.getUnicodeString())){ return false; //we found an match .. do not filter } @@ -454,13 +454,13 @@ public class FstLinkingEngine implements * @param entityTypes * @return */ - private boolean filterEntityByType(Iterator<UriRef> entityTypes){ - Map<UriRef, Integer> whiteList = elConfig.getWhitelistedTypes(); - Map<UriRef, Integer> blackList = elConfig.getBlacklistedTypes(); + private boolean filterEntityByType(Iterator<IRI> entityTypes){ + Map<IRI, Integer> whiteList = elConfig.getWhitelistedTypes(); + Map<IRI, Integer> blackList = elConfig.getBlacklistedTypes(); Integer w = null; Integer b = null; while(entityTypes.hasNext()){ - UriRef type = entityTypes.next(); + IRI type = entityTypes.next(); Integer act = whiteList.get(type); if(act != null){ if(w == null || act.compareTo(w) < 0){ @@ -670,20 +670,20 @@ public class FstLinkingEngine implements languageObject = new Language(language); } - MGraph metadata = ci.getMetadata(); + Graph metadata = ci.getMetadata(); for(Tag tag : tags){ - Collection<UriRef> textAnnotations = new ArrayList<UriRef>(tags.size()); + Collection<IRI> textAnnotations = new ArrayList<IRI>(tags.size()); //first create the TextAnnotations for the Occurrences Literal startLiteral = literalFactory.createTypedLiteral(tag.getStart()); Literal endLiteral = literalFactory.createTypedLiteral(tag.getEnd()); //search for existing text annotation Iterator<Triple> it = metadata.filter(null, ENHANCER_START, startLiteral); - UriRef textAnnotation = null; + IRI textAnnotation = null; while(it.hasNext()){ Triple t = it.next(); if(metadata.filter(t.getSubject(), ENHANCER_END, endLiteral).hasNext() && metadata.filter(t.getSubject(), RDF_TYPE, ENHANCER_TEXTANNOTATION).hasNext()){ - textAnnotation = (UriRef)t.getSubject(); + textAnnotation = (IRI)t.getSubject(); break; } } @@ -710,20 +710,20 @@ public class FstLinkingEngine implements new PlainLiteralImpl(this.getClass().getName()))); } //add dc:types (even to existing) - for(UriRef dcType : getDcTypes(tag.getSuggestions())){ + for(IRI dcType : getDcTypes(tag.getSuggestions())){ metadata.add(new TripleImpl( textAnnotation, Properties.DC_TYPE, dcType)); } textAnnotations.add(textAnnotation); //now the EntityAnnotations for the Suggestions for(Match match : tag.getSuggestions()){ - UriRef entityAnnotation = EnhancementEngineHelper.createEntityEnhancement(ci, this); + IRI entityAnnotation = EnhancementEngineHelper.createEntityEnhancement(ci, this); //should we use the label used for the match, or search the //representation for the best label ... currently its the matched one metadata.add(new TripleImpl(entityAnnotation, Properties.ENHANCER_ENTITY_LABEL, match.getMatchLabel())); metadata.add(new TripleImpl(entityAnnotation,ENHANCER_ENTITY_REFERENCE, - new UriRef(match.getUri()))); - for(UriRef type : match.getTypes()){ + new IRI(match.getUri()))); + for(IRI type : match.getTypes()){ metadata.add(new TripleImpl(entityAnnotation, Properties.ENHANCER_ENTITY_TYPE, type)); } @@ -736,8 +736,8 @@ public class FstLinkingEngine implements metadata.add(new TripleImpl(entityAnnotation, FISE_ORIGIN, indexConfig.getOrigin())); } //TODO: add origin information of the EntiySearcher -// for(Entry<UriRef,Collection<Resource>> originInfo : entitySearcher.getOriginInformation().entrySet()){ -// for(Resource value : originInfo.getValue()){ +// for(Entry<IRI,Collection<RDFTerm>> originInfo : entitySearcher.getOriginInformation().entrySet()){ +// for(RDFTerm value : originInfo.getValue()){ // metadata.add(new TripleImpl(entityAnnotation, // originInfo.getKey(),value)); // } @@ -773,11 +773,11 @@ public class FstLinkingEngine implements * @param conceptTypes The list of suggestions * @return the types values for the {@link LinkedEntity} */ - private Set<UriRef> getDcTypes(List<Match> matches){ + private Set<IRI> getDcTypes(List<Match> matches){ if(matches == null || matches.isEmpty()){ return Collections.emptySet(); } - Collection<UriRef> conceptTypes = new HashSet<UriRef>(); + Collection<IRI> conceptTypes = new HashSet<IRI>(); double score = -1; //only consider types of the best ranked Entities for(Match match : matches){ double actScore = match.getScore(); @@ -785,13 +785,13 @@ public class FstLinkingEngine implements break; } score = actScore; - for(Iterator<UriRef> types = match.getTypes().iterator(); + for(Iterator<IRI> types = match.getTypes().iterator(); types.hasNext(); conceptTypes.add(types.next())); } - Map<UriRef,UriRef> typeMappings = elConfig.getTypeMappings(); - Set<UriRef> dcTypes = new HashSet<UriRef>(); - for(UriRef conceptType : conceptTypes){ - UriRef dcType = typeMappings.get(conceptType); + Map<IRI,IRI> typeMappings = elConfig.getTypeMappings(); + Set<IRI> dcTypes = new HashSet<IRI>(); + for(IRI conceptType : conceptTypes){ + IRI dcType = typeMappings.get(conceptType); if(dcType != null){ dcTypes.add(dcType); } Modified: stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngineComponent.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngineComponent.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngineComponent.java (original) +++ stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngineComponent.java Tue May 17 22:20:49 2016 @@ -48,10 +48,10 @@ import java.util.concurrent.ExecutorServ import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.apache.clerezza.rdf.core.Literal; -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.commons.rdf.Literal; +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.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; @@ -177,7 +177,7 @@ public class FstLinkingEngineComponent { * The origin information for all Entities provided by the configured SolrCore and * FST. Origin information are added to all <code>fise:EntityAnnotation</code> * by using the <code>fise:origin</code> property. Configured values can be both - * {@link UriRef URI}s or {@link Literal}s. Configured Strings are checked if + * {@link IRI URI}s or {@link Literal}s. Configured Strings are checked if * they are valid {@link URI}s and {@link URI#isAbsolute() absolute}. If not * a {@link Literal} is parsed. */ @@ -240,7 +240,7 @@ public class FstLinkingEngineComponent { /** * The origin information of Entities. */ - private Resource origin; + private RDFTerm origin; /** * used to resolve '{prefix}:{local-name}' used within the engines configuration @@ -470,13 +470,13 @@ public class FstLinkingEngineComponent { //(4) parse Origin information value = properties.get(ORIGIN); - if(value instanceof Resource){ - origin = (Resource)origin; + if(value instanceof RDFTerm){ + origin = (RDFTerm)origin; } else if (value instanceof String){ try { URI originUri = new URI((String)value); if(originUri.isAbsolute()){ - origin = new UriRef((String)value); + origin = new IRI((String)value); } else { origin = new PlainLiteralImpl((String)value); } @@ -485,7 +485,7 @@ public class FstLinkingEngineComponent { } log.info(" - origin: {}", origin); } else if(value != null){ - log.warn("Values of the {} property MUST BE of type Resource or String " + log.warn("Values of the {} property MUST BE of type RDFTerm or String " + "(parsed: {} (type:{}))", new Object[]{ORIGIN,value,value.getClass()}); } //else no ORIGIN information provided Modified: stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/IndexConfiguration.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/IndexConfiguration.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/IndexConfiguration.java (original) +++ stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/IndexConfiguration.java Tue May 17 22:20:49 2016 @@ -30,9 +30,9 @@ import java.util.concurrent.ExecutorServ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.apache.clerezza.rdf.core.Literal; -import org.apache.clerezza.rdf.core.Resource; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.Literal; +import org.apache.clerezza.commons.rdf.RDFTerm; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.commons.io.FileUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.filefilter.WildcardFileFilter; @@ -125,10 +125,10 @@ public class IndexConfiguration { /** * The origin is added to <code>fise:TextAnnotation</code> created for * linked Entities. It is intended to be used for providing a reference to - * dataset of the Entity. Both {@link UriRef URI}s and {@link Literal}s can + * dataset of the Entity. Both {@link IRI URI}s and {@link Literal}s can * be used here */ - private Resource origin; + private RDFTerm origin; /** * If alternate tokens (<code>posInc == 0</code>) can be skipped or if such @@ -421,7 +421,7 @@ public class IndexConfiguration { this.fstDirectory = fstDirectory; } - public void setOrigin(Resource origin) { + public void setOrigin(RDFTerm origin) { this.origin = origin; } /** @@ -434,7 +434,7 @@ public class IndexConfiguration { * * @return the origin or <code>null</code> if none is configured */ - public Resource getOrigin() { + public RDFTerm getOrigin() { return origin; } Modified: stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/Match.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/Match.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/Match.java (original) +++ stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/Match.java Tue May 17 22:20:49 2016 @@ -22,8 +22,8 @@ import java.util.Collections; import java.util.Comparator; import java.util.Map; -import org.apache.clerezza.rdf.core.Literal; -import org.apache.clerezza.rdf.core.UriRef; +import org.apache.clerezza.commons.rdf.Literal; +import org.apache.clerezza.commons.rdf.IRI; import org.apache.stanbol.enhancer.engines.entitylinking.impl.Suggestion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,11 +77,11 @@ public class Match { return getValues(FieldType.label); } - public Collection<UriRef> getTypes(){ + public Collection<IRI> getTypes(){ return getValues(FieldType.type); } - public Collection<UriRef> getRedirects(){ + public Collection<IRI> getRedirects(){ return getValues(FieldType.redirect); } public Double getRanking(){ @@ -157,8 +157,8 @@ public class Match { static enum FieldType { id(String.class), label(Literal.class, true), - type(UriRef.class,true), - redirect(UriRef.class,true), + type(IRI.class,true), + redirect(IRI.class,true), ranking(Double.class); Class<?> valueType; Modified: stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/TaggingSession.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/TaggingSession.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/TaggingSession.java (original) +++ stanbol/trunk/enhancement-engines/lucenefstlinking/src/main/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/TaggingSession.java Tue May 17 22:20:49 2016 @@ -33,10 +33,10 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import org.apache.clerezza.rdf.core.Language; -import org.apache.clerezza.rdf.core.Literal; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl; +import org.apache.clerezza.commons.rdf.Language; +import org.apache.clerezza.commons.rdf.Literal; +import org.apache.clerezza.commons.rdf.IRI; +import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl; import org.apache.commons.lang.StringUtils; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; @@ -572,17 +572,17 @@ public class TaggingSession implements C values.put(FieldType.label, labels); //load the types if(typeField != null){ - Set<UriRef> types = new HashSet<UriRef>(); + Set<IRI> types = new HashSet<IRI>(); for(String type : doc.getValues(typeField)){ - types.add(new UriRef(type)); + types.add(new IRI(type)); } values.put(FieldType.type, types); } //load the redirects if(redirectField != null){ - Set<UriRef> redirects = new HashSet<UriRef>(); + Set<IRI> redirects = new HashSet<IRI>(); for(String redirect : doc.getValues(redirectField)){ - redirects.add(new UriRef(redirect)); + redirects.add(new IRI(redirect)); } values.put(FieldType.redirect, redirects); } Modified: stanbol/trunk/enhancement-engines/lucenefstlinking/src/test/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngineTest.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/lucenefstlinking/src/test/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngineTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/lucenefstlinking/src/test/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngineTest.java (original) +++ stanbol/trunk/enhancement-engines/lucenefstlinking/src/test/java/org/apache/stanbol/enhancer/engines/lucenefstlinking/FstLinkingEngineTest.java Tue May 17 22:20:49 2016 @@ -48,13 +48,13 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -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.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.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.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer; import org.apache.solr.core.SolrCore; @@ -158,9 +158,9 @@ public class FstLinkingEngineTest { * Used with the {@link EnhancementStructureHelper} to validate Enhancement * results */ - private static Map<UriRef,Resource> EXPECTED_ENHANCEMENT_VALUES; + private static Map<IRI,RDFTerm> EXPECTED_ENHANCEMENT_VALUES; static{ - EXPECTED_ENHANCEMENT_VALUES = new HashMap<UriRef,Resource>(); + EXPECTED_ENHANCEMENT_VALUES = new HashMap<IRI,RDFTerm>(); EXPECTED_ENHANCEMENT_VALUES.put(DC_CREATOR, LiteralFactory.getInstance().createTypedLiteral( FstLinkingEngine.class.getName())); //adding null as expected for confidence makes it a required property @@ -346,13 +346,13 @@ public class FstLinkingEngineTest { //iterate over all fise:TextAnnotations //NOTE this assumes all textAnnotations are from the FST linking engine log.info(" ... validated fise:TextAnnotations:"); - Map<UriRef,Resource> expected = new HashMap<UriRef,Resource>(EXPECTED_ENHANCEMENT_VALUES); + Map<IRI,RDFTerm> expected = new HashMap<IRI,RDFTerm>(EXPECTED_ENHANCEMENT_VALUES); expected.put(ENHANCER_EXTRACTED_FROM, ci.getUri()); int[] num = new int[]{0,0}; Iterator<Triple> textAnnotations = ci.getMetadata().filter( null, Properties.RDF_TYPE, TechnicalClasses.ENHANCER_TEXTANNOTATION); while(textAnnotations.hasNext()){ - UriRef textAnnotation = (UriRef)textAnnotations.next().getSubject(); + IRI textAnnotation = (IRI)textAnnotations.next().getSubject(); //validate this test annotation against the Stanbol EnhancementStructure EnhancementStructureHelper.validateTextAnnotation( ci.getMetadata(), textAnnotation, content, expected); @@ -374,11 +374,11 @@ public class FstLinkingEngineTest { Iterator<Triple> entityAnnotations = ci.getMetadata().filter( null, Properties.RDF_TYPE, TechnicalClasses.ENHANCER_ENTITYANNOTATION); while(entityAnnotations.hasNext()){ - UriRef entityAnnotation = (UriRef)entityAnnotations.next().getSubject(); + IRI entityAnnotation = (IRI)entityAnnotations.next().getSubject(); //validate this test annotation against the Stanbol EnhancementStructure EnhancementStructureHelper.validateEntityAnnotation( ci.getMetadata(), entityAnnotation, expected); - UriRef entityUri = EnhancementEngineHelper.getReference( + IRI entityUri = EnhancementEngineHelper.getReference( ci.getMetadata(), entityAnnotation, Properties.ENHANCER_ENTITY_REFERENCE); log.info(" {}. {}",num[1]+1,entityUri); Assert.assertNotNull(entityUri); Modified: stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/MetaxaEngine.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/MetaxaEngine.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/MetaxaEngine.java (original) +++ stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/MetaxaEngine.java Tue May 17 22:20:49 2016 @@ -30,15 +30,15 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.apache.clerezza.rdf.core.BNode; -import org.apache.clerezza.rdf.core.MGraph; -import org.apache.clerezza.rdf.core.NonLiteral; -import org.apache.clerezza.rdf.core.Resource; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl; -import org.apache.clerezza.rdf.core.impl.SimpleMGraph; -import org.apache.clerezza.rdf.core.impl.TripleImpl; +import org.apache.clerezza.commons.rdf.BlankNode; +import org.apache.clerezza.commons.rdf.Graph; +import org.apache.clerezza.commons.rdf.BlankNodeOrIRI; +import org.apache.clerezza.commons.rdf.RDFTerm; +import org.apache.clerezza.commons.rdf.Triple; +import org.apache.clerezza.commons.rdf.IRI; +import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl; +import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph; +import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl; import org.apache.clerezza.rdf.core.impl.TypedLiteralImpl; import org.apache.commons.io.IOUtils; import org.apache.felix.scr.annotations.Component; @@ -98,7 +98,7 @@ public class MetaxaEngine /** * Plain text content of a content item. */ - public static final UriRef NIE_PLAINTEXTCONTENT = new UriRef(NamespaceEnum.nie + "plainTextContent"); + public static final IRI NIE_PLAINTEXTCONTENT = new IRI(NamespaceEnum.nie + "plainTextContent"); private static final URIImpl NIE_PLAINTEXT_PROPERTY = new URIImpl(NIE_PLAINTEXTCONTENT.getUnicodeString()); /** * The default value for the Execution of this Engine. Currently set to @@ -230,7 +230,7 @@ public class MetaxaEngine } finally { ci.getLock().readLock().unlock(); } - // Convert the RDF2go model to a Clerezza Graph and also extract + // Convert the RDF2go model to a Clerezza ImmutableGraph and also extract // the extracted plain text from the model if (null == m) { log.debug("Unable to preocess ContentItem {} (mime type {}) with Metaxa", @@ -245,14 +245,14 @@ public class MetaxaEngine throw new EngineException("Unable to initialise Blob for storing" + "the plain text content",e); } - HashMap<BlankNode, BNode> blankNodeMap = new HashMap<BlankNode, BNode>(); + HashMap<BlankNode, BlankNode> blankNodeMap = new HashMap<BlankNode, BlankNode>(); RDF2GoUtils.urifyBlankNodes(m); ClosableIterator<Statement> it = m.iterator(); BufferedWriter out = new BufferedWriter(new OutputStreamWriter( plainTextSink.getOutputStream(), UTF8)); boolean textExtracted = false; //used to detect if some text was extracted try { - MGraph g = new SimpleMGraph(); //first add to a temporary graph + Graph g = new SimpleGraph(); //first add to a temporary graph while (it.hasNext()) { Statement oneStmt = it.next(); //we need to treat triples that provide the plain/text @@ -271,16 +271,16 @@ public class MetaxaEngine } textExtracted = true; if (includeText) { - NonLiteral subject = (NonLiteral) asClerezzaResource(oneStmt.getSubject(), blankNodeMap); - UriRef predicate = (UriRef) asClerezzaResource(oneStmt.getPredicate(), blankNodeMap); - Resource object = asClerezzaResource(oneStmt.getObject(), blankNodeMap); + BlankNodeOrIRI subject = (BlankNodeOrIRI) asClerezzaResource(oneStmt.getSubject(), blankNodeMap); + IRI predicate = (IRI) asClerezzaResource(oneStmt.getPredicate(), blankNodeMap); + RDFTerm object = asClerezzaResource(oneStmt.getObject(), blankNodeMap); g.add(new TripleImpl(subject, predicate, object)); } } } else { //add metadata to the metadata of the contentItem - NonLiteral subject = (NonLiteral) asClerezzaResource(oneStmt.getSubject(), blankNodeMap); - UriRef predicate = (UriRef) asClerezzaResource(oneStmt.getPredicate(), blankNodeMap); - Resource object = asClerezzaResource(oneStmt.getObject(), blankNodeMap); + BlankNodeOrIRI subject = (BlankNodeOrIRI) asClerezzaResource(oneStmt.getSubject(), blankNodeMap); + IRI predicate = (IRI) asClerezzaResource(oneStmt.getPredicate(), blankNodeMap); + RDFTerm object = asClerezzaResource(oneStmt.getObject(), blankNodeMap); if (null != subject && null != predicate && null != object) { Triple t = new TripleImpl(subject, predicate, object); @@ -304,7 +304,7 @@ public class MetaxaEngine } if(textExtracted){ //add plain text to the content item - UriRef blobUri = new UriRef("urn:metaxa:plain-text:"+randomUUID()); + IRI blobUri = new IRI("urn:metaxa:plain-text:"+randomUUID()); ci.addPart(blobUri, plainTextSink.getBlob()); } } @@ -313,22 +313,22 @@ public class MetaxaEngine * Converts the given RDF2Go node into a corresponding Clerezza object. * * @param node a {@link Node} - * @return a {@link Resource} + * @return a {@link RDFTerm} */ - public static Resource asClerezzaResource(Node node, HashMap<BlankNode, BNode> blankNodeMap) { + public static RDFTerm asClerezzaResource(Node node, HashMap<BlankNode, BlankNode> blankNodeMap) { if (node instanceof URI) { - return new UriRef(node.asURI().toString()); + return new IRI(node.asURI().toString()); } else if (node instanceof BlankNode) { - BNode bNode = blankNodeMap.get(node); + BlankNode bNode = blankNodeMap.get(node); if (bNode == null) { - bNode = new BNode(); + bNode = new BlankNode(); blankNodeMap.put(node.asBlankNode(), bNode); } return bNode; } else if (node instanceof DatatypeLiteral) { DatatypeLiteral dtl = node.asDatatypeLiteral(); - return new TypedLiteralImpl(dtl.getValue(), new UriRef(dtl.getDatatype().asURI().toString())); + return new TypedLiteralImpl(dtl.getValue(), new IRI(dtl.getDatatype().asURI().toString())); } else if (node instanceof PlainLiteral) { return new PlainLiteralImpl(node.asLiteral().getValue()); } Modified: stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/RDF2GoUtils.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/RDF2GoUtils.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/RDF2GoUtils.java (original) +++ stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/RDF2GoUtils.java Tue May 17 22:20:49 2016 @@ -27,7 +27,7 @@ import org.ontoware.rdf2go.model.impl.Di import org.ontoware.rdf2go.model.impl.URIGenerator; import org.ontoware.rdf2go.model.node.BlankNode; import org.ontoware.rdf2go.model.node.Node; -import org.ontoware.rdf2go.model.node.Resource; +import org.ontoware.rdf2go.model.node.RDFTerm; import org.ontoware.rdf2go.model.node.URI; /** @@ -45,7 +45,7 @@ public class RDF2GoUtils { Model remove = RDF2Go.getModelFactory().createModel(); remove.open(); for (Statement stmt : model) { - Resource subj = stmt.getSubject(); + RDFTerm subj = stmt.getSubject(); URI pred = stmt.getPredicate(); Node obj = stmt.getObject(); boolean match = false; Modified: stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/html/BundleURIResolver.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/html/BundleURIResolver.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/html/BundleURIResolver.java (original) +++ stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/html/BundleURIResolver.java Tue May 17 22:20:49 2016 @@ -55,7 +55,7 @@ public class BundleURIResolver implement String path = baseURI.getPath(); resource = path.substring(1, path.lastIndexOf('/') + 1) + href; newUrl = BUNDLE.getEntry(resource); - LOG.debug("Resource: " + resource); + LOG.debug("RDFTerm: " + resource); if (newUrl != null) { return new StreamSource(newUrl.openStream(), newUrl.toString()); } else { Modified: stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/mp3/MP3FileExtractor.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/mp3/MP3FileExtractor.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/mp3/MP3FileExtractor.java (original) +++ stanbol/trunk/enhancement-engines/metaxa/src/main/java/org/apache/stanbol/enhancer/engines/metaxa/core/mp3/MP3FileExtractor.java Tue May 17 22:20:49 2016 @@ -21,7 +21,7 @@ import java.io.IOException; import java.nio.charset.Charset; import org.ontoware.rdf2go.model.Model; -import org.ontoware.rdf2go.model.node.Resource; +import org.ontoware.rdf2go.model.node.RDFTerm; import org.ontoware.rdf2go.model.node.URI; import org.ontoware.rdf2go.vocabulary.RDF; import org.semanticdesktop.aperture.extractor.AbstractFileExtractor; @@ -112,7 +112,7 @@ public class MP3FileExtractor extends Ab protected void addSimpleContact(URI property, String fullname, RDFContainer container) { Model model = container.getModel(); - Resource resource = ModelUtil.generateRandomResource(model); + RDFTerm resource = ModelUtil.generateRandomResource(model); model.addStatement(resource, RDF.type, NCO.Contact); model.addStatement(resource, NCO.fullname, fullname); model.addStatement(container.getDescribedUri(), property, resource); Modified: stanbol/trunk/enhancement-engines/metaxa/src/test/java/org/apache/stanbol/enhancer/engines/metaxa/core/TestMetaxaCore.java URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancement-engines/metaxa/src/test/java/org/apache/stanbol/enhancer/engines/metaxa/core/TestMetaxaCore.java?rev=1744328&r1=1744327&r2=1744328&view=diff ============================================================================== --- stanbol/trunk/enhancement-engines/metaxa/src/test/java/org/apache/stanbol/enhancer/engines/metaxa/core/TestMetaxaCore.java (original) +++ stanbol/trunk/enhancement-engines/metaxa/src/test/java/org/apache/stanbol/enhancer/engines/metaxa/core/TestMetaxaCore.java Tue May 17 22:20:49 2016 @@ -20,12 +20,12 @@ import java.io.IOException; import java.io.InputStream; import java.util.HashMap; -import org.apache.clerezza.rdf.core.BNode; -import org.apache.clerezza.rdf.core.NonLiteral; -import org.apache.clerezza.rdf.core.Resource; -import org.apache.clerezza.rdf.core.Triple; -import org.apache.clerezza.rdf.core.UriRef; -import org.apache.clerezza.rdf.core.impl.TripleImpl; +import org.apache.clerezza.commons.rdf.BlankNode; +import org.apache.clerezza.commons.rdf.BlankNodeOrIRI; +import org.apache.clerezza.commons.rdf.RDFTerm; +import org.apache.clerezza.commons.rdf.Triple; +import org.apache.clerezza.commons.rdf.IRI; +import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl; import org.apache.commons.io.IOUtils; import org.apache.stanbol.enhancer.engines.metaxa.MetaxaEngine; import org.junit.BeforeClass; @@ -187,15 +187,15 @@ public class TestMetaxaCore { int tripleCounter = 0; - HashMap<BlankNode, BNode> blankNodeMap = new HashMap<BlankNode, BNode>(); + HashMap<BlankNode, BlankNode> blankNodeMap = new HashMap<BlankNode, BlankNode>(); ClosableIterator<Statement> it = m.iterator(); while (it.hasNext()) { Statement oneStmt = it.next(); - NonLiteral subject = (NonLiteral) MetaxaEngine.asClerezzaResource(oneStmt.getSubject(), blankNodeMap); - UriRef predicate = (UriRef) MetaxaEngine.asClerezzaResource(oneStmt.getPredicate(), blankNodeMap); - Resource object = MetaxaEngine.asClerezzaResource(oneStmt.getObject(), blankNodeMap); + BlankNodeOrIRI subject = (BlankNodeOrIRI) MetaxaEngine.asClerezzaResource(oneStmt.getSubject(), blankNodeMap); + IRI predicate = (IRI) MetaxaEngine.asClerezzaResource(oneStmt.getPredicate(), blankNodeMap); + RDFTerm object = MetaxaEngine.asClerezzaResource(oneStmt.getObject(), blankNodeMap); if (null != subject && null != predicate
