You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by re...@apache.org on 2016/05/17 22:20:55 UTC
svn commit: r1744328 [17/24] - in /stanbol/trunk: ./
commons/indexedgraph/src/main/java/org/apache/stanbol/commons/indexedgraph/
commons/indexedgraph/src/test/java/org/apache/stanbol/commons/indexedgraph/
commons/installer/bundleprovider/src/main/java/...
Modified: stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/function/ContentItemFunction.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/function/ContentItemFunction.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/function/ContentItemFunction.java (original)
+++ stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/function/ContentItemFunction.java Tue May 17 22:20:49 2016
@@ -18,7 +18,7 @@ package org.apache.stanbol.enhancer.ldpa
import java.util.Collection;
-import org.apache.clerezza.rdf.core.Resource;
+import org.apache.clerezza.commons.rdf.RDFTerm;
import org.apache.stanbol.enhancer.ldpath.backend.ContentItemBackend;
import org.apache.marmotta.ldpath.api.backend.RDFBackend;
import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
@@ -33,7 +33,7 @@ import org.apache.marmotta.ldpath.api.fu
* @author Rupert Westenthaler
*
*/
-public abstract class ContentItemFunction extends SelectorFunction<Resource> {
+public abstract class ContentItemFunction extends SelectorFunction<RDFTerm> {
private final String name;
@@ -44,7 +44,7 @@ public abstract class ContentItemFunctio
this.name = name;
}
- public final Collection<Resource> apply(RDFBackend<Resource> backend, Resource context, Collection<Resource>... args) throws IllegalArgumentException {
+ public final Collection<RDFTerm> apply(RDFBackend<RDFTerm> backend, RDFTerm context, Collection<RDFTerm>... args) throws IllegalArgumentException {
if(backend instanceof ContentItemBackend){
return apply((ContentItemBackend)backend, context, args);
} else {
@@ -55,7 +55,7 @@ public abstract class ContentItemFunctio
}
};
- public abstract Collection<Resource> apply(ContentItemBackend backend,Resource context, Collection<Resource>... args);
+ public abstract Collection<RDFTerm> apply(ContentItemBackend backend,RDFTerm context, Collection<RDFTerm>... args);
@Override
protected String getLocalName() {
Modified: stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/function/SuggestionFunction.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/function/SuggestionFunction.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/function/SuggestionFunction.java (original)
+++ stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/function/SuggestionFunction.java Tue May 17 22:20:49 2016
@@ -25,7 +25,7 @@ import java.util.Comparator;
import java.util.List;
import java.util.Map.Entry;
-import org.apache.clerezza.rdf.core.Resource;
+import org.apache.clerezza.commons.rdf.RDFTerm;
import org.apache.marmotta.ldpath.api.backend.RDFBackend;
import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
import org.apache.marmotta.ldpath.api.selectors.NodeSelector;
@@ -34,13 +34,13 @@ import org.apache.marmotta.ldpath.model.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class SuggestionFunction extends SelectorFunction<Resource> {
+public class SuggestionFunction extends SelectorFunction<RDFTerm> {
- private static final Comparator<Entry<Double,Resource>> SUGGESTION_COMPARATOR =
- new Comparator<Entry<Double,Resource>>() {
+ private static final Comparator<Entry<Double,RDFTerm>> SUGGESTION_COMPARATOR =
+ new Comparator<Entry<Double,RDFTerm>>() {
@Override
- public int compare(Entry<Double,Resource> e1, Entry<Double,Resource> e2) {
+ public int compare(Entry<Double,RDFTerm> e1, Entry<Double,RDFTerm> e2) {
return e2.getKey().compareTo(e1.getKey());
}
@@ -58,22 +58,22 @@ public class SuggestionFunction extends
Logger log = LoggerFactory.getLogger(SuggestionFunction.class);
private final String name;
- private final IntTransformer<Resource> intTransformer;
- private final StringTransformer<Resource> stringTransformer;
- private final NodeSelector<Resource> suggestionSelector;
- private final NodeSelector<Resource> confidenceSelector;
- private final NodeSelector<Resource> resultSelector;
+ private final IntTransformer<RDFTerm> intTransformer;
+ private final StringTransformer<RDFTerm> stringTransformer;
+ private final NodeSelector<RDFTerm> suggestionSelector;
+ private final NodeSelector<RDFTerm> confidenceSelector;
+ private final NodeSelector<RDFTerm> resultSelector;
public SuggestionFunction(String name,
- NodeSelector<Resource> suggestionSelector,
- NodeSelector<Resource> confidenceSelector){
+ NodeSelector<RDFTerm> suggestionSelector,
+ NodeSelector<RDFTerm> confidenceSelector){
this(name,null,suggestionSelector,confidenceSelector);
}
public SuggestionFunction(String name,
- NodeSelector<Resource> suggestionSelector,
- NodeSelector<Resource> confidenceSelector,
- NodeSelector<Resource> resultSelector) {
- intTransformer = new IntTransformer<Resource>();
- stringTransformer = new StringTransformer<Resource>();
+ NodeSelector<RDFTerm> suggestionSelector,
+ NodeSelector<RDFTerm> confidenceSelector,
+ NodeSelector<RDFTerm> resultSelector) {
+ intTransformer = new IntTransformer<RDFTerm>();
+ stringTransformer = new StringTransformer<RDFTerm>();
if(name == null || name.isEmpty()){
throw new IllegalArgumentException("The parsed function name MUST NOT be NULL nor empty!");
}
@@ -90,12 +90,12 @@ public class SuggestionFunction extends
}
@Override
- public Collection<Resource> apply(final RDFBackend<Resource> backend, Resource context, Collection<Resource>... args) throws IllegalArgumentException {
+ public Collection<RDFTerm> apply(final RDFBackend<RDFTerm> backend, RDFTerm context, Collection<RDFTerm>... args) throws IllegalArgumentException {
int paramIndex = 0;
- Collection<Resource> contexts = null;
+ Collection<RDFTerm> contexts = null;
if(args != null && args.length > 0 && args[0] != null && !args[0].isEmpty()){
- contexts = new ArrayList<Resource>();
- for(Resource r : args[0]){
+ contexts = new ArrayList<RDFTerm>();
+ for(RDFTerm r : args[0]){
if(backend.isURI(r)){
contexts.add(r);
paramIndex = 1;
@@ -108,11 +108,11 @@ public class SuggestionFunction extends
Integer limit = parseParamLimit(backend, args,paramIndex);
// final String processingMode = parseParamProcessingMode(backend, args,2);
final int missingConfidenceMode = parseParamMissingConfidenceMode(backend, args,paramIndex+1);
- List<Resource> result = new ArrayList<Resource>();
+ List<RDFTerm> result = new ArrayList<RDFTerm>();
// if(processingMode.equals(ANNOTATION_PROCESSING_MODE_UNION)){
processAnnotations(backend, contexts, limit, missingConfidenceMode, result);
// } else {
-// for(Resource context : args[0]){
+// for(RDFTerm context : args[0]){
// processAnnotations(backend, singleton(context),
// limit, missingConfidenceMode, result);
// }
@@ -131,16 +131,16 @@ public class SuggestionFunction extends
* @param missingConfidenceMode
* @param result results are added to this list.
*/
- private void processAnnotations(final RDFBackend<Resource> backend,
- Collection<Resource> annotations,
+ private void processAnnotations(final RDFBackend<RDFTerm> backend,
+ Collection<RDFTerm> annotations,
Integer limit,
final int missingConfidenceMode,
- List<Resource> result) {
- List<Entry<Double,Resource>> suggestions = new ArrayList<Entry<Double,Resource>>();
- for(Resource annotation : annotations){
+ List<RDFTerm> result) {
+ List<Entry<Double,RDFTerm>> suggestions = new ArrayList<Entry<Double,RDFTerm>>();
+ for(RDFTerm annotation : annotations){
//NOTE: no Path Tracking support possible for selectors wrapped in functions
- for(Resource suggestion : suggestionSelector.select(backend, annotation,null,null)){
- Collection<Resource> cs = confidenceSelector.select(backend, suggestion,null,null);
+ for(RDFTerm suggestion : suggestionSelector.select(backend, annotation,null,null)){
+ Collection<RDFTerm> cs = confidenceSelector.select(backend, suggestion,null,null);
Double confidence = !cs.isEmpty() ? backend.doubleValue(cs.iterator().next()) :
missingConfidenceMode == MISSING_CONFIDENCE_FILTER ?
null : missingConfidenceMode == MISSING_CONFIDENCE_FIRST ?
@@ -153,7 +153,7 @@ public class SuggestionFunction extends
}
Collections.sort(suggestions, SUGGESTION_COMPARATOR);
int resultSize = limit != null ? Math.min(limit, suggestions.size()) : suggestions.size();
- for(Entry<Double,Resource> suggestion : suggestions.subList(0, resultSize)){
+ for(Entry<Double,RDFTerm> suggestion : suggestions.subList(0, resultSize)){
if(resultSelector == null){
result.add(suggestion.getValue());
} else {
@@ -169,8 +169,8 @@ public class SuggestionFunction extends
* @param args
* @return
*/
- private int parseParamMissingConfidenceMode(final RDFBackend<Resource> backend,
- Collection<Resource>[] args, int index) {
+ private int parseParamMissingConfidenceMode(final RDFBackend<RDFTerm> backend,
+ Collection<RDFTerm>[] args, int index) {
final int missingConfidenceMode;
if(args.length > index && !args[index].isEmpty()){
String mode = stringTransformer.transform(backend, args[index].iterator().next(),
@@ -196,7 +196,7 @@ public class SuggestionFunction extends
// * @param args
// * @return
// */
-// private String parseParamProcessingMode(final RDFBackend<Resource> backend, Collection<Resource>[] args, int index) {
+// private String parseParamProcessingMode(final RDFBackend<RDFTerm> backend, Collection<RDFTerm>[] args, int index) {
// final String processingMode;
// if(args.length > index && !args[index].isEmpty()){
// String mode = stringTransformer.transform(backend, args[index].iterator().next());
@@ -219,10 +219,10 @@ public class SuggestionFunction extends
* @param args
* @return
*/
- private Integer parseParamLimit(final RDFBackend<Resource> backend, Collection<Resource>[] args,int index) {
+ private Integer parseParamLimit(final RDFBackend<RDFTerm> backend, Collection<RDFTerm>[] args,int index) {
Integer limit = null;
if(args.length > index && !args[index].isEmpty()){
- Resource value = args[index].iterator().next();
+ RDFTerm value = args[index].iterator().next();
try {
limit = intTransformer.transform(backend, value, Collections.<String,String>emptyMap());
if(limit < 1){
Modified: stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/utils/Utils.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/utils/Utils.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/utils/Utils.java (original)
+++ stanbol/trunk/enhancer/ldpath/src/main/java/org/apache/stanbol/enhancer/ldpath/utils/Utils.java Tue May 17 22:20:49 2016
@@ -21,8 +21,8 @@ import static org.apache.stanbol.enhance
import java.io.StringReader;
import java.util.Map;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
import org.apache.marmotta.ldpath.api.backend.RDFBackend;
import org.apache.marmotta.ldpath.api.selectors.NodeSelector;
import org.apache.marmotta.ldpath.parser.LdPathParser;
@@ -35,7 +35,7 @@ public final class Utils {
- public static RDFBackend<Resource> EMPTY_BACKEND;
+ public static RDFBackend<RDFTerm> EMPTY_BACKEND;
/**
* Returns an empty {@link RDFBackend} instance intended to be used to create
@@ -53,20 +53,20 @@ public final class Utils {
* used for the 2nd purpose and does contain no information!
* <li>
*/
- public static RDFBackend<Resource> getEmptyBackend(){
+ public static RDFBackend<RDFTerm> getEmptyBackend(){
if(EMPTY_BACKEND == null){
- EMPTY_BACKEND = new ClerezzaBackend(new SimpleMGraph());
+ EMPTY_BACKEND = new ClerezzaBackend(new SimpleGraph());
}
return EMPTY_BACKEND;
}
- public static NodeSelector<Resource> parseSelector(String path) throws ParseException {
+ public static NodeSelector<RDFTerm> parseSelector(String path) throws ParseException {
return parseSelector(path, null);
}
- public static NodeSelector<Resource> parseSelector(String path, Map<String,String> additionalNamespaceMappings) throws ParseException {
- LdPathParser<Resource> parser = new LdPathParser<Resource>(
+ public static NodeSelector<RDFTerm> parseSelector(String path, Map<String,String> additionalNamespaceMappings) throws ParseException {
+ LdPathParser<RDFTerm> parser = new LdPathParser<RDFTerm>(
getEmptyBackend(), getConfig(), new StringReader(path));
return parser.parseSelector(additionalNamespaceMappings);
}
Modified: stanbol/trunk/enhancer/ldpath/src/test/java/org/apache/stanbol/enhancer/ldpath/ContentItemBackendTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/ldpath/src/test/java/org/apache/stanbol/enhancer/ldpath/ContentItemBackendTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/ldpath/src/test/java/org/apache/stanbol/enhancer/ldpath/ContentItemBackendTest.java (original)
+++ stanbol/trunk/enhancer/ldpath/src/test/java/org/apache/stanbol/enhancer/ldpath/ContentItemBackendTest.java Tue May 17 22:20:49 2016
@@ -34,23 +34,21 @@ import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-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.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.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
import org.apache.clerezza.rdf.core.serializedform.ParsingProvider;
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
import org.apache.commons.io.IOUtils;
import org.apache.marmotta.ldpath.LDPath;
import org.apache.marmotta.ldpath.exception.LDPathParseException;
-import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.indexedgraph.IndexedGraph;
import org.apache.stanbol.enhancer.contentitem.inmemory.InMemoryContentItemFactory;
import org.apache.stanbol.enhancer.ldpath.backend.ContentItemBackend;
import org.apache.stanbol.enhancer.servicesapi.ContentItem;
@@ -88,20 +86,20 @@ public class ContentItemBackendTest {
private static String htmlContent;
private static ContentItem ci;
private ContentItemBackend backend;
- private LDPath<Resource> ldpath;
+ private LDPath<RDFTerm> ldpath;
@BeforeClass
public static void readTestData() throws IOException {
//add the metadata
ParsingProvider parser = new JenaParserProvider();
//create the content Item with the HTML content
- MGraph rdfData = parseRdfData(parser,"metadata.rdf.zip");
- UriRef contentItemId = null;
+ Graph rdfData = parseRdfData(parser,"metadata.rdf.zip");
+ IRI contentItemId = null;
Iterator<Triple> it = rdfData.filter(null, Properties.ENHANCER_EXTRACTED_FROM, null);
while(it.hasNext()){
- Resource r = it.next().getObject();
+ RDFTerm r = it.next().getObject();
if(contentItemId == null){
- if(r instanceof UriRef){
- contentItemId = (UriRef)r;
+ if(r instanceof IRI){
+ contentItemId = (IRI)r;
}
} else {
assertEquals("multiple ContentItems IDs contained in the RDF test data",
@@ -123,7 +121,7 @@ public class ContentItemBackendTest {
byte[] textData = IOUtils.toByteArray(in);
IOUtils.closeQuietly(in);
assertNotNull("Plain text content not found",in);
- ci.addPart(new UriRef(ci.getUri().getUnicodeString()+"_text"),
+ ci.addPart(new IRI(ci.getUri().getUnicodeString()+"_text"),
ciFactory.createBlob(new ByteArraySource(textData, "text/plain; charset=UTF-8")));
textContent = new String(textData, UTF8);
//add the metadata
@@ -135,8 +133,8 @@ public class ContentItemBackendTest {
* @return
* @throws IOException
*/
- protected static MGraph parseRdfData(ParsingProvider parser,String name) throws IOException {
- MGraph rdfData = new IndexedMGraph();
+ protected static Graph parseRdfData(ParsingProvider parser,String name) throws IOException {
+ Graph rdfData = new IndexedGraph();
InputStream in = getTestResource(name);
assertNotNull("File '"+name+"' not found",in);
ZipInputStream zipIn = new ZipInputStream(new BufferedInputStream(in));
@@ -166,17 +164,17 @@ public class ContentItemBackendTest {
backend = new ContentItemBackend(ci);
}
if(ldpath == null){
- ldpath = new LDPath<Resource>(backend, EnhancerLDPath.getConfig());
+ ldpath = new LDPath<RDFTerm>(backend, EnhancerLDPath.getConfig());
}
}
@Test
public void testContent() throws LDPathParseException {
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), "fn:content(\"text/plain\")", null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), "fn:content(\"text/plain\")", null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- Resource r = result.iterator().next();
+ RDFTerm r = result.iterator().next();
assertTrue(r instanceof Literal);
String content = ((Literal)r).getLexicalForm();
assertEquals(content, textContent);
@@ -194,20 +192,20 @@ public class ContentItemBackendTest {
@Test
public void testContentWithAdditionalMetadata() throws IOException, LDPathParseException {
byte[] content = "text content".getBytes();
- UriRef uri = ContentItemHelper.makeDefaultUrn(content);
+ IRI uri = ContentItemHelper.makeDefaultUrn(content);
ContentItem contentItem = ciFactory.createContentItem(uri, new ByteArraySource(content,
"text/plain; charset=UTF-8"));
- TripleCollection tc = new SimpleMGraph();
- TypedLiteral literal = LiteralFactory.getInstance().createTypedLiteral("Michael Jackson");
- UriRef subject = new UriRef("dummyUri");
- tc.add(new TripleImpl(subject, new UriRef("http://xmlns.com/foaf/0.1/givenName"), literal));
- contentItem.addPart(new UriRef(uri.getUnicodeString() + "_additionalMetadata"), tc);
+ Graph tc = new SimpleGraph();
+ Literal literal = LiteralFactory.getInstance().createTypedLiteral("Michael Jackson");
+ IRI subject = new IRI("dummyUri");
+ tc.add(new TripleImpl(subject, new IRI("http://xmlns.com/foaf/0.1/givenName"), literal));
+ contentItem.addPart(new IRI(uri.getUnicodeString() + "_additionalMetadata"), tc);
ContentItemBackend ciBackend = new ContentItemBackend(contentItem, true);
- LDPath<Resource> ldPath = new LDPath<Resource>(ciBackend, EnhancerLDPath.getConfig());
- Collection<Resource> result = ldPath.pathQuery(subject, "foaf:givenName", null);
+ LDPath<RDFTerm> ldPath = new LDPath<RDFTerm>(ciBackend, EnhancerLDPath.getConfig());
+ Collection<RDFTerm> result = ldPath.pathQuery(subject, "foaf:givenName", null);
assertTrue("Additional metadata cannot be found", result.contains(literal));
}
@@ -215,13 +213,13 @@ public class ContentItemBackendTest {
@Test
public void testTextAnnotationFunction() throws LDPathParseException {
String path = "fn:textAnnotation(.)/fise:selected-text";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 2);
Set<String> expectedValues = new HashSet<String>(
Arrays.asList("Bob Marley","Paris"));
- for(Resource r : result){
+ for(RDFTerm r : result){
assertTrue(r instanceof Literal);
assertTrue(expectedValues.remove(((Literal)r).getLexicalForm()));
}
@@ -235,7 +233,7 @@ public class ContentItemBackendTest {
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- Resource r = result.iterator().next();
+ RDFTerm r = result.iterator().next();
assertTrue(r instanceof Literal);
assertEquals(((Literal)r).getLexicalForm(), "Bob Marley");
@@ -243,13 +241,13 @@ public class ContentItemBackendTest {
@Test
public void testTextAnnotationFunctionWithoutParsedContext() throws LDPathParseException {
String path = "fn:textAnnotation()/fise:selected-text";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 2);
Set<String> expectedValues = new HashSet<String>(
Arrays.asList("Bob Marley","Paris"));
- for(Resource r : result){
+ for(RDFTerm r : result){
assertTrue(r instanceof Literal);
assertTrue(expectedValues.remove(((Literal)r).getLexicalForm()));
}
@@ -263,7 +261,7 @@ public class ContentItemBackendTest {
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- Resource r = result.iterator().next();
+ RDFTerm r = result.iterator().next();
assertTrue(r instanceof Literal);
assertEquals(((Literal)r).getLexicalForm(), "Bob Marley");
@@ -271,18 +269,18 @@ public class ContentItemBackendTest {
@Test
public void testEntityAnnotation() throws LDPathParseException {
String path = "fn:entityAnnotation(.)/fise:entity-reference";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 4);
- Set<UriRef> expectedValues = new HashSet<UriRef>(
+ Set<IRI> expectedValues = new HashSet<IRI>(
Arrays.asList(
- new UriRef("http://dbpedia.org/resource/Paris"),
- new UriRef("http://dbpedia.org/resource/Bob_Marley"),
- new UriRef("http://dbpedia.org/resource/Centre_Georges_Pompidou"),
- new UriRef("http://dbpedia.org/resource/Paris,_Texas")));
- for(Resource r : result){
- assertTrue(r instanceof UriRef);
+ new IRI("http://dbpedia.org/resource/Paris"),
+ new IRI("http://dbpedia.org/resource/Bob_Marley"),
+ new IRI("http://dbpedia.org/resource/Centre_Georges_Pompidou"),
+ new IRI("http://dbpedia.org/resource/Paris,_Texas")));
+ for(RDFTerm r : result){
+ assertTrue(r instanceof IRI);
log.info("Entity: {}",r);
assertTrue(expectedValues.remove(r));
}
@@ -293,23 +291,23 @@ public class ContentItemBackendTest {
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- assertTrue(result.contains(new UriRef("http://dbpedia.org/resource/Bob_Marley")));
+ assertTrue(result.contains(new IRI("http://dbpedia.org/resource/Bob_Marley")));
}
@Test
public void testEntityAnnotationWithoutParsedContext() throws LDPathParseException {
String path = "fn:entityAnnotation()/fise:entity-reference";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 4);
- Set<UriRef> expectedValues = new HashSet<UriRef>(
+ Set<IRI> expectedValues = new HashSet<IRI>(
Arrays.asList(
- new UriRef("http://dbpedia.org/resource/Paris"),
- new UriRef("http://dbpedia.org/resource/Bob_Marley"),
- new UriRef("http://dbpedia.org/resource/Centre_Georges_Pompidou"),
- new UriRef("http://dbpedia.org/resource/Paris,_Texas")));
- for(Resource r : result){
- assertTrue(r instanceof UriRef);
+ new IRI("http://dbpedia.org/resource/Paris"),
+ new IRI("http://dbpedia.org/resource/Bob_Marley"),
+ new IRI("http://dbpedia.org/resource/Centre_Georges_Pompidou"),
+ new IRI("http://dbpedia.org/resource/Paris,_Texas")));
+ for(RDFTerm r : result){
+ assertTrue(r instanceof IRI);
log.info("Entity: {}",r);
assertTrue(expectedValues.remove(r));
}
@@ -320,17 +318,17 @@ public class ContentItemBackendTest {
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- assertTrue(result.contains(new UriRef("http://dbpedia.org/resource/Bob_Marley")));
+ assertTrue(result.contains(new IRI("http://dbpedia.org/resource/Bob_Marley")));
}
@Test
public void testEnhancements() throws LDPathParseException {
String path = "fn:enhancement(.)";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 7);
- for(Resource r : result){
- assertTrue(r instanceof UriRef);
+ for(RDFTerm r : result){
+ assertTrue(r instanceof IRI);
log.info("Entity: {}",r);
}
//and with a filter
@@ -339,25 +337,25 @@ public class ContentItemBackendTest {
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 3);
-// assertTrue(result.contains(new UriRef("http://dbpedia.org/resource/Bob_Marley")));
+// assertTrue(result.contains(new IRI("http://dbpedia.org/resource/Bob_Marley")));
path = "fn:enhancement(.)/dc:language";
result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- Resource r = result.iterator().next();
+ RDFTerm r = result.iterator().next();
assertTrue(r instanceof Literal);
assertEquals("en",((Literal)r).getLexicalForm());
}
@Test
public void testEnhancementsWithoutParsedContext() throws LDPathParseException {
String path = "fn:enhancement()";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 7);
- for(Resource r : result){
- assertTrue(r instanceof UriRef);
+ for(RDFTerm r : result){
+ assertTrue(r instanceof IRI);
log.info("Entity: {}",r);
}
//and with a filter
@@ -366,13 +364,13 @@ public class ContentItemBackendTest {
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 3);
-// assertTrue(result.contains(new UriRef("http://dbpedia.org/resource/Bob_Marley")));
+// assertTrue(result.contains(new IRI("http://dbpedia.org/resource/Bob_Marley")));
path = "fn:enhancement()/dc:language";
result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- Resource r = result.iterator().next();
+ RDFTerm r = result.iterator().next();
assertTrue(r instanceof Literal);
assertEquals("en",((Literal)r).getLexicalForm());
}
@@ -386,27 +384,27 @@ public class ContentItemBackendTest {
// are returned and later that a limit of 2 only returns the two top
// most.
String path = "fn:textAnnotation(.)[dc:type is dbpedia-ont:Place]/fn:suggestion(.)";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 3);
Double lowestConfidence = null;
//stores the lowest confidence suggestion for the 2nd part of this test
- UriRef lowestConfidenceSuggestion = null;
+ IRI lowestConfidenceSuggestion = null;
path = "fise:confidence :: xsd:double";
- for(Resource r : result){
- assertTrue(r instanceof UriRef);
+ for(RDFTerm r : result){
+ assertTrue(r instanceof IRI);
log.info("confidence: {}",r);
Double current = (Double)ldpath.pathTransform(r, path, null).iterator().next();
assertNotNull(current);
if(lowestConfidence == null || lowestConfidence > current){
lowestConfidence = current;
- lowestConfidenceSuggestion = (UriRef) r;
+ lowestConfidenceSuggestion = (IRI) r;
}
}
assertNotNull(lowestConfidenceSuggestion);
path = "fn:textAnnotation(.)[dc:type is dbpedia-ont:Place]/fn:suggestion(.,\"2\")";
- Collection<Resource> result2 = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result2 = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result2);
assertFalse(result2.isEmpty());
assertTrue(result2.size() == 2);
@@ -425,27 +423,27 @@ public class ContentItemBackendTest {
// are returned and later that a limit of 2 only returns the two top
// most.
String path = "fn:textAnnotation()[dc:type is dbpedia-ont:Place]/fn:suggestion()";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 3);
Double lowestConfidence = null;
//stores the lowest confidence suggestion for the 2nd part of this test
- UriRef lowestConfidenceSuggestion = null;
+ IRI lowestConfidenceSuggestion = null;
path = "fise:confidence :: xsd:double";
- for(Resource r : result){
- assertTrue(r instanceof UriRef);
+ for(RDFTerm r : result){
+ assertTrue(r instanceof IRI);
log.info("confidence: {}",r);
Double current = (Double)ldpath.pathTransform(r, path, null).iterator().next();
assertNotNull(current);
if(lowestConfidence == null || lowestConfidence > current){
lowestConfidence = current;
- lowestConfidenceSuggestion = (UriRef) r;
+ lowestConfidenceSuggestion = (IRI) r;
}
}
assertNotNull(lowestConfidenceSuggestion);
path = "fn:textAnnotation()[dc:type is dbpedia-ont:Place]/fn:suggestion(\"2\")";
- Collection<Resource> result2 = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result2 = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result2);
assertFalse(result2.isEmpty());
assertTrue(result2.size() == 2);
@@ -461,16 +459,16 @@ public class ContentItemBackendTest {
// In this example we parse all TextAnnotations
//NOTE: '.' MUST BE used as first argument in this case
String path = "fn:textAnnotation(.)/fn:suggestedEntity(.,\"1\")";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 2);
- Set<UriRef> expectedValues = new HashSet<UriRef>(
+ Set<IRI> expectedValues = new HashSet<IRI>(
Arrays.asList(
- new UriRef("http://dbpedia.org/resource/Paris"),
- new UriRef("http://dbpedia.org/resource/Bob_Marley")));
- for(Resource r : result){
- assertTrue(r instanceof UriRef);
+ new IRI("http://dbpedia.org/resource/Paris"),
+ new IRI("http://dbpedia.org/resource/Bob_Marley")));
+ for(RDFTerm r : result){
+ assertTrue(r instanceof IRI);
log.info("Entity: {}",r);
assertTrue(expectedValues.remove(r));
}
@@ -485,7 +483,7 @@ public class ContentItemBackendTest {
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- assertEquals(new UriRef("http://dbpedia.org/resource/Paris"),
+ assertEquals(new IRI("http://dbpedia.org/resource/Paris"),
result.iterator().next());
}
@@ -496,16 +494,16 @@ public class ContentItemBackendTest {
// In this example we parse all TextAnnotations
//NOTE: '.' MUST BE used as first argument in this case
String path = "fn:textAnnotation()/fn:suggestedEntity(\"1\")";
- Collection<Resource> result = ldpath.pathQuery(ci.getUri(), path, null);
+ Collection<RDFTerm> result = ldpath.pathQuery(ci.getUri(), path, null);
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 2);
- Set<UriRef> expectedValues = new HashSet<UriRef>(
+ Set<IRI> expectedValues = new HashSet<IRI>(
Arrays.asList(
- new UriRef("http://dbpedia.org/resource/Paris"),
- new UriRef("http://dbpedia.org/resource/Bob_Marley")));
- for(Resource r : result){
- assertTrue(r instanceof UriRef);
+ new IRI("http://dbpedia.org/resource/Paris"),
+ new IRI("http://dbpedia.org/resource/Bob_Marley")));
+ for(RDFTerm r : result){
+ assertTrue(r instanceof IRI);
log.info("Entity: {}",r);
assertTrue(expectedValues.remove(r));
}
@@ -520,7 +518,7 @@ public class ContentItemBackendTest {
assertNotNull(result);
assertFalse(result.isEmpty());
assertTrue(result.size() == 1);
- assertEquals(new UriRef("http://dbpedia.org/resource/Paris"),
+ assertEquals(new IRI("http://dbpedia.org/resource/Paris"),
result.iterator().next());
}
Modified: stanbol/trunk/enhancer/ldpath/src/test/java/org/apache/stanbol/enhancer/ldpath/UsageExamples.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/enhancer/ldpath/src/test/java/org/apache/stanbol/enhancer/ldpath/UsageExamples.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/enhancer/ldpath/src/test/java/org/apache/stanbol/enhancer/ldpath/UsageExamples.java (original)
+++ stanbol/trunk/enhancer/ldpath/src/test/java/org/apache/stanbol/enhancer/ldpath/UsageExamples.java Tue May 17 22:20:49 2016
@@ -30,10 +30,10 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
-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.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.rdf.core.serializedform.ParsingProvider;
import org.apache.clerezza.rdf.jena.parser.JenaParserProvider;
import org.apache.commons.io.IOUtils;
@@ -75,7 +75,7 @@ public class UsageExamples {
private static ContentItem ci;
private ContentItemBackend backend;
- private LDPath<Resource> ldpath;
+ private LDPath<RDFTerm> ldpath;
private static double indexingTime;
@BeforeClass
@@ -83,14 +83,14 @@ public class UsageExamples {
//add the metadata
ParsingProvider parser = new JenaParserProvider();
//create the content Item with the HTML content
- MGraph rdfData = parseRdfData(parser,"example.rdf.zip");
- UriRef contentItemId = null;
+ Graph rdfData = parseRdfData(parser,"example.rdf.zip");
+ IRI contentItemId = null;
Iterator<Triple> it = rdfData.filter(null, Properties.ENHANCER_EXTRACTED_FROM, null);
while(it.hasNext()){
- Resource r = it.next().getObject();
+ RDFTerm r = it.next().getObject();
if(contentItemId == null){
- if(r instanceof UriRef){
- contentItemId = (UriRef)r;
+ if(r instanceof IRI){
+ contentItemId = (IRI)r;
}
} else {
assertEquals("multiple ContentItems IDs contained in the RDF test data",
@@ -114,7 +114,7 @@ public class UsageExamples {
backend = new ContentItemBackend(ci);
}
if(ldpath == null){
- ldpath = new LDPath<Resource>(backend, EnhancerLDPath.getConfig());
+ ldpath = new LDPath<RDFTerm>(backend, EnhancerLDPath.getConfig());
}
}
@@ -138,7 +138,7 @@ public class UsageExamples {
program.append("linkedArtists = fn:textAnnotation()" +
"[dc:type is dbpedia-ont:Person]/fn:suggestion()" +
"[fise:entity-type is dbpedia-ont:Artist]/fise:entity-reference :: xsd:anyURI;");
- Program<Resource> personProgram = ldpath.parseProgram(new StringReader(program.toString()));
+ Program<RDFTerm> personProgram = ldpath.parseProgram(new StringReader(program.toString()));
log.info("- - - - - - - - - - - - - ");
log.info("Person Indexing Examples");
Map<String,Collection<?>> result = execute(personProgram);
@@ -152,7 +152,7 @@ public class UsageExamples {
* @param personProgram
* @return the results
*/
- private Map<String,Collection<?>> execute(Program<Resource> personProgram) {
+ private Map<String,Collection<?>> execute(Program<RDFTerm> personProgram) {
long start = System.currentTimeMillis();
Map<String,Collection<?>> result = personProgram.execute(backend, ci.getUri());
for(int i=1;i<ITERATIONS;i++){
@@ -183,7 +183,7 @@ public class UsageExamples {
program.append("linkedCountries = fn:textAnnotation()" +
"[dc:type is dbpedia-ont:Place]/fn:suggestion()" +
"[fise:entity-type is dbpedia-ont:Country]/fise:entity-reference :: xsd:anyURI;");
- Program<Resource> personProgram = ldpath.parseProgram(new StringReader(program.toString()));
+ Program<RDFTerm> personProgram = ldpath.parseProgram(new StringReader(program.toString()));
log.info("- - - - - - - - - - - - -");
log.info("Places Indexing Examples");
Map<String,Collection<?>> result = execute(personProgram);
@@ -212,7 +212,7 @@ public class UsageExamples {
program.append("linkedEducationOrg = fn:textAnnotation()" +
"[dc:type is dbpedia-ont:Organisation]/fn:suggestion()" +
"[fise:entity-type is dbpedia-ont:EducationalInstitution]/fise:entity-reference :: xsd:anyURI;");
- Program<Resource> personProgram = ldpath.parseProgram(new StringReader(program.toString()));
+ Program<RDFTerm> personProgram = ldpath.parseProgram(new StringReader(program.toString()));
log.info("- - - - - - - - - - - - -");
log.info("Places Indexing Examples");
Map<String,Collection<?>> result = execute(personProgram);
@@ -234,7 +234,7 @@ public class UsageExamples {
//but also the selected-text as fallback if no entity is suggested.
program.append("linkedConcepts = fn:entityAnnotation()" +
"[fise:entity-type is skos:Concept]/fise:entity-reference :: xsd:anyURI;");
- Program<Resource> personProgram = ldpath.parseProgram(new StringReader(program.toString()));
+ Program<RDFTerm> personProgram = ldpath.parseProgram(new StringReader(program.toString()));
log.info("- - - - - - - - - - - - -");
log.info("Concept Indexing Examples");
Map<String,Collection<?>> result = execute(personProgram);
Modified: stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java (original)
+++ stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/RepresentationTest.java Tue May 17 22:20:49 2016
@@ -1040,9 +1040,9 @@ public abstract class RepresentationTest
Representation rep = initNaturalLanguageTest(field);
Set<String> textSet = new HashSet<String>(NL_TEST_all);
rep.removeAllNaturalText(field, "de", "de-AT");
- for (Iterator<Text> texts = rep.getText(field); texts.hasNext(); textSet.remove(texts.next()
- .getText()))
- ;
+ for (Iterator<Text> texts = rep.getText(field);
+ texts.hasNext();
+ textSet.remove(texts.next().getText()));
assertTrue(textSet.size() == 2);
assertTrue(textSet.remove(NL_TEST_de));
assertTrue(textSet.remove(NL_TEST_de_AT));
Modified: stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/ValueFactoryTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/ValueFactoryTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/ValueFactoryTest.java (original)
+++ stanbol/trunk/entityhub/generic/test/src/main/java/org/apache/stanbol/entityhub/test/model/ValueFactoryTest.java Tue May 17 22:20:49 2016
@@ -100,7 +100,7 @@ public abstract class ValueFactoryTest {
}
@Test
- public void testUriReference() throws URISyntaxException {
+ public void testIRIerence() throws URISyntaxException {
URI refObject = new URI("http://www.test.org/uriTest");
Reference ref = testRef(refObject);
assertEquals(ref.getReference(), refObject.toString());
Modified: stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/Urify.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/Urify.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/Urify.java (original)
+++ stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/Urify.java Tue May 17 22:20:49 2016
@@ -175,7 +175,7 @@ public class Urify implements Runnable{
}
InputStream is = new FileInputStream(source);
OutputStream os = new FileOutputStream(target);
- log.info("Resource: {}",resource);
+ log.info("RDFTerm: {}",resource);
log.info("Target : {}",target);
if ("gz".equalsIgnoreCase(FilenameUtils.getExtension(name))) {
is = new GZIPInputStream(is);
Modified: stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/config/IndexingConfig.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/config/IndexingConfig.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/config/IndexingConfig.java (original)
+++ stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/config/IndexingConfig.java Tue May 17 22:20:49 2016
@@ -441,13 +441,13 @@ public class IndexingConfig {
private File getResource(String path, String fileName) {
File resourceDir = new File(getWorkingDirectory(),path);
File resource = new File(resourceDir,fileName);
- log.info("request for Resource {} (folder: {})",fileName,resourceDir);
+ log.info("request for RDFTerm {} (folder: {})",fileName,resourceDir);
if(resource.getAbsoluteFile().exists()){
- log.info(" > rquested Resource present");
+ log.info(" > rquested RDFTerm present");
} else if(copyFromClasspath(new File(path,fileName))){
- log.info(" > rquested Resource copied from Classpath ");
+ log.info(" > rquested RDFTerm copied from Classpath ");
} else {
- log.info(" > rquested Resource not found");
+ log.info(" > rquested RDFTerm not found");
}
return resource.getAbsoluteFile();
}
@@ -598,7 +598,7 @@ public class IndexingConfig {
}
URL contextUrl = loadViaClasspath(contextResource);
if(contextUrl == null){// if indexing.properties is not found via classpath
- log.info("No '{}' found via classpath. Loading Resource via" +
+ log.info("No '{}' found via classpath. Loading RDFTerm via" +
"the classpath is deactivated.",
contextResource);
return null;
Modified: stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/source/ResourceLoader.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/source/ResourceLoader.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/source/ResourceLoader.java (original)
+++ stanbol/trunk/entityhub/indexing/core/src/main/java/org/apache/stanbol/entityhub/indexing/core/source/ResourceLoader.java Tue May 17 22:20:49 2016
@@ -285,7 +285,7 @@ public class ResourceLoader {
try {
files.put(moveToImportedFolder(new File(file)).toString(), state);
} catch (IOException ioe) {
- log.warn("Unable to move loaded Resource {} to imported Directory! "
+ log.warn("Unable to move loaded RDFTerm {} to imported Directory! "
+ "Please move the file manually to {}!",file,importedDir);
log.warn("Reason: "+ioe.getMessage(),ioe);
files.put(file, state);
@@ -296,7 +296,7 @@ public class ResourceLoader {
if(ResourceState.ERROR == state){
//if failOnError is activated we stop the loading on the first error!
if (failOnError){
- String msg = "Error while loading Resource "+file;
+ String msg = "Error while loading RDFTerm "+file;
if(e != null){
throw new IllegalStateException(msg,e);
} else {
Modified: stanbol/trunk/entityhub/indexing/core/src/test/java/org/apache/stanbol/entityhub/indexing/core/ResourceLoaderTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/core/src/test/java/org/apache/stanbol/entityhub/indexing/core/ResourceLoaderTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/core/src/test/java/org/apache/stanbol/entityhub/indexing/core/ResourceLoaderTest.java (original)
+++ stanbol/trunk/entityhub/indexing/core/src/test/java/org/apache/stanbol/entityhub/indexing/core/ResourceLoaderTest.java Tue May 17 22:20:49 2016
@@ -71,7 +71,7 @@ public class ResourceLoaderTest {
assertTrue("resourceName '"+resourceName+"' not expected",
expectedNames.remove(resourceName));
IOUtils.closeQuietly(is);
- log.debug("Import Resource {}",resourceName);
+ log.debug("Import RDFTerm {}",resourceName);
if(resourceName.startsWith("ignore")){
return ResourceState.IGNORED;
} else if(resourceName.startsWith("error")){
Modified: stanbol/trunk/entityhub/indexing/geonames/src/main/java/org/apache/stanbol/entityhub/indexing/geonames/GeonamesIndexingSource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/geonames/src/main/java/org/apache/stanbol/entityhub/indexing/geonames/GeonamesIndexingSource.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/geonames/src/main/java/org/apache/stanbol/entityhub/indexing/geonames/GeonamesIndexingSource.java (original)
+++ stanbol/trunk/entityhub/indexing/geonames/src/main/java/org/apache/stanbol/entityhub/indexing/geonames/GeonamesIndexingSource.java Tue May 17 22:20:49 2016
@@ -77,10 +77,10 @@ public class GeonamesIndexingSource impl
private ResourceLoader loader = new ResourceLoader(this, false, false);
- protected static class Resource {
+ protected static class RDFTerm {
protected final String name;
protected final InputStream is;
- protected Resource(String name, InputStream is) {
+ protected RDFTerm(String name, InputStream is) {
this.name = name;
this.is = is;
}
@@ -100,7 +100,7 @@ public class GeonamesIndexingSource impl
}
}
- private List<Resource> resourceList = new ArrayList<GeonamesIndexingSource.Resource>();
+ private List<RDFTerm> resourceList = new ArrayList<GeonamesIndexingSource.RDFTerm>();
private boolean consumed;
@Override
@@ -158,14 +158,14 @@ public class GeonamesIndexingSource impl
@Override
public void close() {
loader = null;
- for(Resource resource : resourceList){
+ for(RDFTerm resource : resourceList){
IOUtils.closeQuietly(resource.is);
}
}
@Override
public ResourceState importResource(InputStream is, String resourceName) throws IOException {
- resourceList.add(new Resource(resourceName, is));
+ resourceList.add(new RDFTerm(resourceName, is));
return ResourceState.LOADED;
}
@@ -180,8 +180,8 @@ public class GeonamesIndexingSource impl
}
return new EntityDataIterator() {
- Iterator<Resource> resources = resourceList.iterator();
- Resource r;
+ Iterator<RDFTerm> resources = resourceList.iterator();
+ RDFTerm r;
LineIterator it = null;
private String next;
private Representation rep;
@@ -196,7 +196,7 @@ public class GeonamesIndexingSource impl
try {
it = r.getEntries();
} catch (IOException e) {
- log.error("Unable to read Resource '"+r.getName()+"' because of "+e.getMessage(),e);
+ log.error("Unable to read RDFTerm '"+r.getName()+"' because of "+e.getMessage(),e);
e.printStackTrace();
IOUtils.closeQuietly(r.is);
it = null;
Modified: stanbol/trunk/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java (original)
+++ stanbol/trunk/entityhub/indexing/source/jenatdb/src/main/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSource.java Tue May 17 22:20:49 2016
@@ -97,7 +97,7 @@ public class RdfIndexingSource extends A
*/
private static final String PARAM_BNODE_STATE = "bnode";
/**
- * If present, this Parameter allows to convert RDF BNodes to dereferable
+ * If present, this Parameter allows to convert RDF BlankNodes to dereferable
* URIs by using {bnode-prefix}{bnode-id} (see
* <a href="https://issues.apache.org/jira/browse/STANBOL-765">STANBOL-765</a>
* for details)
@@ -141,7 +141,7 @@ public class RdfIndexingSource extends A
protected String bnodePrefix; //protected to allow direct access in inner classes
/**
- * used for logging a single WARN level entry on the first ignored BNode
+ * used for logging a single WARN level entry on the first ignored BlankNode
*/
private boolean bnodeIgnored = false;
private RdfImportFilter importFilter;
@@ -429,7 +429,7 @@ public class RdfIndexingSource extends A
}
if(found) {
if(log.isTraceEnabled()){
- log.info("Resource: \n{}", ModelUtils.getRepresentationInfo(source));
+ log.info("RDFTerm: \n{}", ModelUtils.getRepresentationInfo(source));
}
return source;
} else {
@@ -510,12 +510,12 @@ public class RdfIndexingSource extends A
logIgnoredBnode(log, source, field, value);
}
} else {
- log.warn("ignoreing value {} for field {} and Resource {} because it is of an unsupported type!",
+ log.warn("ignoreing value {} for field {} and RDFTerm {} because it is of an unsupported type!",
new Object[]{value,field,source.getId()});
} //end different value node type
}
/**
- * Logs that a BNode was ignored (only the first time). Also debugs the
+ * Logs that a BlankNode was ignored (only the first time). Also debugs the
* ignored triple.
* @param log the logger to use
* @param s subject
@@ -706,7 +706,7 @@ public class RdfIndexingSource extends A
Node entityNode = binding.get(entityVar);
//NOTES:
// * for URIs we need to check for empty URIs!
- // * STANBOL-765: added support for BNodes
+ // * STANBOL-765: added support for BlankNodes
if((entityNode.isURI() && !entityNode.toString().isEmpty()) ||
entityNode.isBlank() && bnodePrefix != null){
if(!entityNode.equals(currentEntity)){
@@ -829,7 +829,7 @@ public class RdfIndexingSource extends A
return nodes;
}
/**
- * Since STANBOL-765 BNodes are converted to URIs if a {@link #bnodePrefix}
+ * Since STANBOL-765 BlankNodes are converted to URIs if a {@link #bnodePrefix}
* is configured. This also means that one needs to expect calls to the
* {@link RDFBackend} interface with transformed Nodes. <p>
* This method ensures that if someone requests an uri {@link Node} for a
Modified: stanbol/trunk/entityhub/indexing/source/jenatdb/src/test/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSourceTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/source/jenatdb/src/test/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSourceTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/source/jenatdb/src/test/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSourceTest.java (original)
+++ stanbol/trunk/entityhub/indexing/source/jenatdb/src/test/java/org/apache/stanbol/entityhub/indexing/source/jenatdb/RdfIndexingSourceTest.java Tue May 17 22:20:49 2016
@@ -209,8 +209,8 @@ public class RdfIndexingSourceTest {
9, count);
}
@Test
- public void testBNodeSupport(){
- log.info(" --- testBNodeSupport ---");
+ public void testBlankNodeSupport(){
+ log.info(" --- testBlankNodeSupport ---");
String testName = "bnode";
IndexingConfig config = new IndexingConfig(CONFIG_ROOT+File.separatorChar+testName,
CONFIG_ROOT+'/'+testName){};
@@ -231,7 +231,7 @@ public class RdfIndexingSourceTest {
}
//check if all entities where indexed
//Expected are 3 entities First France from france.rdf
- //and two from BNode Entities in bnode.nt
+ //and two from BlankNode Entities in bnode.nt
assertEquals(String.format("> %s Entities expected but only %s processed!",
3, count),
3, count);
Modified: stanbol/trunk/entityhub/indexing/source/vcard/src/main/java/org/apache/stanbol/entityhub/indexing/source/vcard/VcardIndexingSource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/indexing/source/vcard/src/main/java/org/apache/stanbol/entityhub/indexing/source/vcard/VcardIndexingSource.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/indexing/source/vcard/src/main/java/org/apache/stanbol/entityhub/indexing/source/vcard/VcardIndexingSource.java (original)
+++ stanbol/trunk/entityhub/indexing/source/vcard/src/main/java/org/apache/stanbol/entityhub/indexing/source/vcard/VcardIndexingSource.java Tue May 17 22:20:49 2016
@@ -331,7 +331,7 @@ public class VcardIndexingSource impleme
}
return ResourceState.LOADED;
} else {
- log.debug("Resource {} ignored: Not an Vcard file.",resourceName);
+ log.debug("RDFTerm {} ignored: Not an Vcard file.",resourceName);
return ResourceState.IGNORED;
}
}
@@ -620,7 +620,7 @@ public class VcardIndexingSource impleme
unitHierarchy[0] != null && unitHierarchy[0].trim().length()>0){
String orgName = unitHierarchy[0];
if(current == null){ //create new Representation for the Organisation
- //Note: this is an Entity and no sub-Resource!
+ //Note: this is an Entity and no sub-RDFTerm!
String orgEntityId = entityByName(entityMap, EntityType.organization,
orgName, null, false);
if(orgEntityId == null){
Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/EntityhubRootResource.java Tue May 17 22:20:49 2016
@@ -68,7 +68,7 @@ import javax.ws.rs.core.Response.Status;
import org.apache.marmotta.ldpath.exception.LDPathParseException;
import org.apache.marmotta.ldpath.model.programs.Program;
-import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.indexedgraph.IndexedGraph;
import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
import org.apache.stanbol.commons.web.viewable.Viewable;
@@ -610,7 +610,7 @@ public class EntityhubRootResource exten
*/
private Response executeLDPathQuery(Entityhub entityhub,FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
QueryResultList<Representation> result;
- ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
+ ValueFactory vf = new RdfValueFactory(new IndexedGraph());
EntityhubBackend backend = new EntityhubBackend(entityhub);
EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
//copy the selected fields, because we might need to delete some during
Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/ReferencedSiteRootResource.java Tue May 17 22:20:49 2016
@@ -72,7 +72,7 @@ import org.apache.clerezza.rdf.core.seri
import org.apache.clerezza.rdf.ontologies.RDFS;
import org.apache.marmotta.ldpath.exception.LDPathParseException;
import org.apache.marmotta.ldpath.model.programs.Program;
-import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.indexedgraph.IndexedGraph;
import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
import org.apache.stanbol.commons.web.viewable.Viewable;
@@ -109,7 +109,7 @@ import org.apache.felix.scr.annotations.
import org.apache.felix.scr.annotations.Service;
/**
- * Resource to provide a REST API for the {@link SiteManager}
+ * RDFTerm to provide a REST API for the {@link SiteManager}
* <p/>
* TODO: add description
*/
@@ -665,7 +665,7 @@ public class ReferencedSiteRootResource
*/
private Response executeLDPathQuery(Site site, FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
QueryResultList<Representation> result;
- ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
+ ValueFactory vf = new RdfValueFactory(new IndexedGraph());
SiteBackend backend = new SiteBackend(site,vf);
EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
//copy the selected fields, because we might need to delete some during
Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/resource/SiteManagerRootResource.java Tue May 17 22:20:49 2016
@@ -58,7 +58,7 @@ import javax.ws.rs.core.UriInfo;
import org.apache.clerezza.rdf.ontologies.RDFS;
import org.apache.marmotta.ldpath.exception.LDPathParseException;
import org.apache.marmotta.ldpath.model.programs.Program;
-import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.indexedgraph.IndexedGraph;
import org.apache.stanbol.commons.namespaceprefix.NamespaceMappingUtils;
import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
@@ -85,7 +85,7 @@ import org.apache.felix.scr.annotations.
import org.apache.felix.scr.annotations.Service;
/**
- * Resource to provide a REST API for the {@link SiteManager}.
+ * RDFTerm to provide a REST API for the {@link SiteManager}.
*
* TODO: add description
*/
@@ -421,7 +421,7 @@ public class SiteManagerRootResource ext
*/
private Response executeLDPathQuery(SiteManager manager,FieldQuery query, String ldpathProgramString, MediaType mediaType, HttpHeaders headers) {
QueryResultList<Representation> result;
- ValueFactory vf = new RdfValueFactory(new IndexedMGraph());
+ ValueFactory vf = new RdfValueFactory(new IndexedGraph());
SiteManagerBackend backend = new SiteManagerBackend(manager);
EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
//copy the selected fields, because we might need to delete some during
Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/jersey/utils/LDPathHelper.java Tue May 17 22:20:49 2016
@@ -36,14 +36,14 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.Response.Status;
-import org.apache.clerezza.rdf.core.MGraph;
+import org.apache.clerezza.commons.rdf.Graph;
import org.apache.marmotta.ldpath.api.backend.RDFBackend;
import org.apache.marmotta.ldpath.exception.LDPathParseException;
import org.apache.marmotta.ldpath.model.fields.FieldMapping;
import org.apache.marmotta.ldpath.model.programs.Program;
import org.apache.marmotta.ldpath.model.selectors.PropertySelector;
import org.apache.marmotta.ldpath.model.transformers.DoubleTransformer;
-import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.indexedgraph.IndexedGraph;
import org.apache.stanbol.commons.web.base.resource.BaseStanbolResource;
import org.apache.stanbol.commons.web.viewable.Viewable;
import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
@@ -90,10 +90,10 @@ public final class LDPathHelper {
* @return The results stored within an RDF graph
* @throws LDPathParseException if the parsed LDPath program is invalid
*/
- private static MGraph executeLDPath(RDFBackend<Object> backend,
+ private static Graph executeLDPath(RDFBackend<Object> backend,
String ldpath,
Set<String> contexts ) throws LDPathParseException {
- MGraph data = new IndexedMGraph();
+ Graph data = new IndexedGraph();
RdfValueFactory vf = new RdfValueFactory(data);
EntityhubLDPath ldPath = new EntityhubLDPath(backend,vf);
Program<Object> program = ldPath.parseProgram(getReader(ldpath));
@@ -104,10 +104,10 @@ public final class LDPathHelper {
/*
* NOTE: We do not need to process the Representations returned by
* EntityhubLDPath#exdecute, because the RdfValueFactory used uses
- * the local variable "MGraph data" to backup all created
+ * the local variable "Graph data" to backup all created
* RdfRepresentation. Because of this all converted data will be
- * automatically added the MGraph. The only thing we need to do is to
- * wrap the MGraph in the response.
+ * automatically added the Graph. The only thing we need to do is to
+ * wrap the Graph in the response.
*/
for(String context : contexts){
ldPath.execute(vf.createReference(context), program);
@@ -186,7 +186,7 @@ public final class LDPathHelper {
.entity("The requested content type "+TEXT_HTML+" is not supported.\n")
.header(HttpHeaders.ACCEPT, acceptedMediaType).build();
}
- MGraph data;
+ Graph data;
try {
data = executeLDPath(backend, ldpath, contexts);
} catch (LDPathParseException e) {
Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/FieldQueryReader.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/FieldQueryReader.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/FieldQueryReader.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/FieldQueryReader.java Tue May 17 22:20:49 2016
@@ -117,7 +117,7 @@ public class FieldQueryReader implements
// 500 with no comment and HTML content type :(
// As a workaround one could use a wrapping object as generic type
// that parses the error and than throw the Exception within the
- // Resource using this MessageBodyReader
+ // RDFTerm using this MessageBodyReader
throw new WebApplicationException(
Response.status(Status.BAD_REQUEST).
entity(message.toString()).
Modified: stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java (original)
+++ stanbol/trunk/entityhub/jersey/src/main/java/org/apache/stanbol/entityhub/web/reader/RepresentationReader.java Tue May 17 22:20:49 2016
@@ -41,10 +41,10 @@ import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.MessageBodyReader;
import javax.ws.rs.ext.Provider;
-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.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.rdf.core.serializedform.Parser;
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
import org.apache.clerezza.rdf.core.serializedform.UnsupportedParsingFormatException;
@@ -52,7 +52,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.entityhub.jersey.utils.JerseyUtils;
import org.apache.stanbol.entityhub.jersey.utils.MessageBodyReaderUtils;
import org.apache.stanbol.entityhub.jersey.utils.MessageBodyReaderUtils.RequestData;
@@ -247,8 +247,8 @@ public class RepresentationReader implem
} else if(isSupported(content.getMediaType())){ //from RDF serialisation
RdfValueFactory valueFactory = RdfValueFactory.getInstance();
Map<String,Representation> representations = new HashMap<String,Representation>();
- Set<NonLiteral> processed = new HashSet<NonLiteral>();
- MGraph graph = new IndexedMGraph();
+ Set<BlankNodeOrIRI> processed = new HashSet<BlankNodeOrIRI>();
+ Graph graph = new IndexedGraph();
try {
parser.parse(graph,content.getEntityStream(), content.getMediaType().toString());
} catch (UnsupportedParsingFormatException e) {
@@ -276,11 +276,11 @@ public class RepresentationReader implem
header(HttpHeaders.ACCEPT, acceptedMediaType).build());
}
for(Iterator<Triple> st = graph.iterator();st.hasNext();){
- NonLiteral resource = st.next().getSubject();
- if(resource instanceof UriRef && processed.add(resource)){
+ BlankNodeOrIRI resource = st.next().getSubject();
+ if(resource instanceof IRI && processed.add(resource)){
//build a new representation
- representations.put(((UriRef)resource).getUnicodeString(),
- valueFactory.createRdfRepresentation((UriRef)resource, graph));
+ representations.put(((IRI)resource).getUnicodeString(),
+ valueFactory.createRdfRepresentation((IRI)resource, graph));
}
}
return representations;
Modified: stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfReference.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfReference.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfReference.java (original)
+++ stanbol/trunk/entityhub/model/clerezza/src/main/java/org/apache/stanbol/entityhub/model/clerezza/RdfReference.java Tue May 17 22:20:49 2016
@@ -16,21 +16,21 @@
*/
package org.apache.stanbol.entityhub.model.clerezza;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.entityhub.servicesapi.model.Reference;
public class RdfReference implements Reference,Cloneable {
- private final UriRef uri;
+ private final IRI uri;
protected RdfReference(String reference){
if(reference == null){
throw new IllegalArgumentException("The parsed Reference MUST NOT be NULL!");
} else if(reference.isEmpty()){
throw new IllegalArgumentException("The parsed Reference MUST NOT be Empty!");
} else {
- this.uri = new UriRef(reference);
+ this.uri = new IRI(reference);
}
}
- protected RdfReference(UriRef uri){
+ protected RdfReference(IRI uri){
if(uri == null){
throw new IllegalArgumentException("The parsed Reference MUST NOT be NULL!");
} else if(uri.getUnicodeString().isEmpty()){
@@ -43,12 +43,12 @@ public class RdfReference implements Ref
public String getReference() {
return uri.getUnicodeString();
}
- public UriRef getUriRef(){
+ public IRI getIRI(){
return uri;
}
@Override
protected Object clone() throws CloneNotSupportedException {
- return new RdfReference(new UriRef(uri.getUnicodeString()));
+ return new RdfReference(new IRI(uri.getUnicodeString()));
}
@Override
public int hashCode() {