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 [19/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/entityhub/web/clerezza/src/main/java/org/apache/stanbol/entityhub/web/writer/clerezza/ClerezzaModelWriter.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/web/clerezza/src/main/java/org/apache/stanbol/entityhub/web/writer/clerezza/ClerezzaModelWriter.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/web/clerezza/src/main/java/org/apache/stanbol/entityhub/web/writer/clerezza/ClerezzaModelWriter.java (original)
+++ stanbol/trunk/entityhub/web/clerezza/src/main/java/org/apache/stanbol/entityhub/web/writer/clerezza/ClerezzaModelWriter.java Tue May 17 22:20:49 2016
@@ -11,13 +11,13 @@ import java.util.List;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
+
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
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.TripleCollection;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
import org.apache.clerezza.rdf.core.serializedform.Serializer;
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
import org.apache.clerezza.rdf.ontologies.RDF;
@@ -25,7 +25,7 @@ import org.apache.felix.scr.annotations.
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.Service;
-import org.apache.stanbol.commons.indexedgraph.IndexedMGraph;
+import org.apache.stanbol.commons.indexedgraph.IndexedGraph;
import org.apache.stanbol.commons.namespaceprefix.NamespacePrefixService;
import org.apache.stanbol.entityhub.model.clerezza.RdfRepresentation;
import org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory;
@@ -82,24 +82,24 @@ public class ClerezzaModelWriter impleme
Arrays.asList(TURTLE_TYPE, JSONLD_TYPE, N3_TYPE, N_TRIPLE_TYPE, RDF_JSON_TYPE, RDF_XML_TYPE, X_TURTLE_TYPE));
//some Concepts and Relations we use to represent Entities
- private final static UriRef FOAF_DOCUMENT = new UriRef(NamespaceEnum.foaf+"Document");
- private final static UriRef FOAF_PRIMARY_TOPIC = new UriRef(NamespaceEnum.foaf+"primaryTopic");
- private final static UriRef FOAF_PRIMARY_TOPIC_OF = new UriRef(NamespaceEnum.foaf+"isPrimaryTopicOf");
- private final static UriRef SIGN_SITE = new UriRef(RdfResourceEnum.site.getUri());
-// private final static UriRef ENTITY_TYPE = new UriRef(RdfResourceEnum.Entity.getUri());
+ private final static IRI FOAF_DOCUMENT = new IRI(NamespaceEnum.foaf+"Document");
+ private final static IRI FOAF_PRIMARY_TOPIC = new IRI(NamespaceEnum.foaf+"primaryTopic");
+ private final static IRI FOAF_PRIMARY_TOPIC_OF = new IRI(NamespaceEnum.foaf+"isPrimaryTopicOf");
+ private final static IRI SIGN_SITE = new IRI(RdfResourceEnum.site.getUri());
+// private final static IRI ENTITY_TYPE = new IRI(RdfResourceEnum.Entity.getUri());
private final static RdfValueFactory valueFactory = RdfValueFactory.getInstance();
/**
* The URI used for the query result list (static for all responses)
*/
- private static final UriRef QUERY_RESULT_LIST = new UriRef(RdfResourceEnum.QueryResultSet.getUri());
+ private static final IRI QUERY_RESULT_LIST = new IRI(RdfResourceEnum.QueryResultSet.getUri());
/**
* The property used for all results
*/
- private static final UriRef QUERY_RESULT = new UriRef(RdfResourceEnum.queryResult.getUri());
+ private static final IRI QUERY_RESULT = new IRI(RdfResourceEnum.queryResult.getUri());
/**
* The property used for the JSON serialised FieldQuery (STANBOL-298)
*/
- private static final UriRef FIELD_QUERY = new UriRef(RdfResourceEnum.query.getUri());
+ private static final IRI FIELD_QUERY = new IRI(RdfResourceEnum.query.getUri());
/**
* This Serializer only supports UTF-8
@@ -158,7 +158,7 @@ public class ClerezzaModelWriter impleme
@Override
public void write(QueryResultList<?> result, OutputStream out, MediaType mediaType) throws WebApplicationException,
IOException {
- MGraph queryRdf = toRDF(result);
+ Graph queryRdf = toRDF(result);
//we need also to the JSON formatted FieldQuery as a literal to the
//RDF data.
FieldQuery query = result.getQuery();
@@ -186,7 +186,7 @@ public class ClerezzaModelWriter impleme
* @param out
* @param mediaType
*/
- private void writeRdf(TripleCollection tc, OutputStream out, MediaType mediaType) {
+ private void writeRdf(Graph tc, OutputStream out, MediaType mediaType) {
String charset = mediaType.getParameters().get("charset");
if(charset == null){
charset = ModelWriter.DEFAULT_CHARSET;
@@ -198,23 +198,23 @@ public class ClerezzaModelWriter impleme
.append('/').append(mediaType.getSubtype()).toString());
}
- private MGraph toRDF(Representation representation) {
- MGraph graph = new IndexedMGraph();
+ private Graph toRDF(Representation representation) {
+ Graph graph = new IndexedGraph();
addRDFTo(graph, representation);
return graph;
}
- private void addRDFTo(MGraph graph, Representation representation) {
+ private void addRDFTo(Graph graph, Representation representation) {
graph.addAll(valueFactory.toRdfRepresentation(representation).getRdfGraph());
}
- private TripleCollection toRDF(Entity entity) {
- MGraph graph = new IndexedMGraph();
+ private Graph toRDF(Entity entity) {
+ Graph graph = new IndexedGraph();
addRDFTo(graph, entity);
return graph;
}
- private void addRDFTo(MGraph graph, Entity entity) {
+ private void addRDFTo(Graph graph, Entity entity) {
addRDFTo(graph, entity.getRepresentation());
addRDFTo(graph, entity.getMetadata());
//now add some triples that represent the Sign
@@ -230,28 +230,28 @@ public class ClerezzaModelWriter impleme
* @param graph the graph to add the triples
* @param sign the sign
*/
- private void addEntityTriplesToGraph(MGraph graph, Entity sign) {
- UriRef id = new UriRef(sign.getId());
- UriRef metaId = new UriRef(sign.getMetadata().getId());
+ private void addEntityTriplesToGraph(Graph graph, Entity sign) {
+ IRI id = new IRI(sign.getId());
+ IRI metaId = new IRI(sign.getMetadata().getId());
//add the FOAF triples between metadata and content
graph.add(new TripleImpl(id, FOAF_PRIMARY_TOPIC_OF, metaId));
graph.add(new TripleImpl(metaId, FOAF_PRIMARY_TOPIC, metaId));
graph.add(new TripleImpl(metaId, RDF.type, FOAF_DOCUMENT));
//add the site to the metadata
//TODO: this should be the HTTP URI and not the id of the referenced site
- TypedLiteral siteName = literalFactory.createTypedLiteral(sign.getSite());
+ Literal siteName = literalFactory.createTypedLiteral(sign.getSite());
graph.add(new TripleImpl(metaId, SIGN_SITE, siteName));
}
- private MGraph toRDF(QueryResultList<?> resultList) {
- final MGraph resultGraph;
+ private Graph toRDF(QueryResultList<?> resultList) {
+ final Graph resultGraph;
Class<?> type = resultList.getType();
if (String.class.isAssignableFrom(type)) {
- resultGraph = new IndexedMGraph(); //create a new Graph
+ resultGraph = new IndexedGraph(); //create a new ImmutableGraph
for (Object result : resultList) {
//add a triple to each reference in the result set
- resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, QUERY_RESULT, new UriRef(result.toString())));
+ resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, QUERY_RESULT, new IRI(result.toString())));
}
} else {
//first determine the type of the resultList
@@ -277,22 +277,22 @@ public class ClerezzaModelWriter impleme
//now add the Sign specific triples and add result triples
//to the Sign IDs
for (Object result : resultList) {
- UriRef signId = new UriRef(((Entity) result).getId());
+ IRI signId = new IRI(((Entity) result).getId());
addEntityTriplesToGraph(resultGraph, (Entity) result);
resultGraph.add(new TripleImpl(QUERY_RESULT_LIST, QUERY_RESULT, signId));
}
}
} else { //any other implementation of the QueryResultList interface
- resultGraph = new IndexedMGraph(); //create a new graph
+ resultGraph = new IndexedGraph(); //create a new graph
if (Representation.class.isAssignableFrom(type)) {
for (Object result : resultList) {
- UriRef resultId;
+ IRI resultId;
if (!isSignType) {
addRDFTo(resultGraph, (Representation) result);
- resultId = new UriRef(((Representation) result).getId());
+ resultId = new IRI(((Representation) result).getId());
} else {
addRDFTo(resultGraph, (Entity) result);
- resultId = new UriRef(((Entity) result).getId());
+ resultId = new IRI(((Entity) result).getId());
}
//Note: In case of Representation this Triple points to
// the representation. In case of Signs it points to
Modified: stanbol/trunk/entityhub/web/sesame/src/main/java/org/apache/stanbol/entityhub/web/writer/sesame/SesameModelWriter.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/web/sesame/src/main/java/org/apache/stanbol/entityhub/web/writer/sesame/SesameModelWriter.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/web/sesame/src/main/java/org/apache/stanbol/entityhub/web/writer/sesame/SesameModelWriter.java (original)
+++ stanbol/trunk/entityhub/web/sesame/src/main/java/org/apache/stanbol/entityhub/web/writer/sesame/SesameModelWriter.java Tue May 17 22:20:49 2016
@@ -236,7 +236,7 @@ public class SesameModelWriter implement
final Model resultGraph;
Class<?> type = resultList.getType();
if (String.class.isAssignableFrom(type)) {
- resultGraph = new LinkedHashModel(); //create a new Graph
+ resultGraph = new LinkedHashModel(); //create a new ImmutableGraph
for (Object result : resultList) {
//add a triple to each reference in the result set
resultGraph.add(QUERY_RESULT_LIST, QUERY_RESULT, sesameFactory.createURI(result.toString()));
Modified: stanbol/trunk/entityhub/yard/clerezza/src/main/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYard.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/yard/clerezza/src/main/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYard.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/yard/clerezza/src/main/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYard.java (original)
+++ stanbol/trunk/entityhub/yard/clerezza/src/main/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYard.java Tue May 17 22:20:49 2016
@@ -24,20 +24,19 @@ import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.locks.Lock;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Literal;
-import org.apache.clerezza.rdf.core.LiteralFactory;
-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.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.LockableMGraph;
+import org.apache.clerezza.commons.rdf.BlankNode;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.Literal;
+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.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
import org.apache.clerezza.rdf.core.access.TcManager;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
+import org.apache.clerezza.rdf.core.LiteralFactory;
import org.apache.clerezza.rdf.core.sparql.ParseException;
import org.apache.clerezza.rdf.core.sparql.QueryParser;
import org.apache.clerezza.rdf.core.sparql.ResultSet;
@@ -52,7 +51,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.core.query.QueryResultListImpl;
import org.apache.stanbol.entityhub.core.query.QueryUtils;
import org.apache.stanbol.entityhub.servicesapi.util.AdaptingIterator;
@@ -84,7 +83,7 @@ import org.slf4j.LoggerFactory;
* Implementation of the Yard Interface based on a RDF Triple Store. This
* Implementation uses Clerezza as RDF Framework. The actual Triple Store used
* to store the data depends on the configuration of Clerezza.<p>
- * This implementation uses {@link LockableMGraph} interface for write locks
+ * This implementation uses {@link LockableGraph} interface for write locks
* when updating the graph. SPARQL queries are not within a write lock.<p>
*
* @author Rupert Westenthaler
@@ -108,7 +107,7 @@ import org.slf4j.LoggerFactory;
public class ClerezzaYard extends AbstractYard implements Yard {
private static Logger log = LoggerFactory.getLogger(ClerezzaYard.class);
/**
- * Property used to mark empty Representations managed by this Graph. This is
+ * Property used to mark empty Representations managed by this ImmutableGraph. This is
* needed to workaround the fact, that the Entityhub supports the storage of
* empty Representations but this Yard uses the search for any outgoing
* relation (triple with the id of the representation as Subject) for the
@@ -120,11 +119,11 @@ public class ClerezzaYard extends Abstra
* <code> ?representationId <{@value #MANAGED_REPRESENTATION}> true^^xsd:boolean </code>
* <br> for any empty Representation avoids this unwanted behaviour.
*/
- public static final UriRef MANAGED_REPRESENTATION = new UriRef("urn:org.apache.stanbol:entityhub.yard:rdf.clerezza:managesRepresentation");
+ public static final IRI MANAGED_REPRESENTATION = new IRI("urn:org.apache.stanbol:entityhub.yard:rdf.clerezza:managesRepresentation");
/**
- * Property used to optionally configure the URI of the Clerezza Graph.
- * This graph will be looked up by using {@link TcManager#getTriples(UriRef).<p>
- * Note that if the returned RDF graph is of instance Graph the write/delete
+ * Property used to optionally configure the URI of the Clerezza ImmutableGraph.
+ * This graph will be looked up by using {@link TcManager#getTriples(IRI).<p>
+ * Note that if the returned RDF graph is of instance ImmutableGraph the write/delete
* operations of this implementations will not work.
*/
public static final String GRAPH_URI = "org.apache.stanbol.entityhub.yard.clerezza.graphuri";
@@ -134,18 +133,19 @@ public class ClerezzaYard extends Abstra
private static final Literal TRUE_LITERAL = LiteralFactory.getInstance().createTypedLiteral(Boolean.FALSE);
//public static final String YARD_URI_PREFIX = "urn:org.apache.stanbol:entityhub.yard:rdf.clerezza:";
-// public static final UriRef REPRESENTATION = new UriRef(RdfResourceEnum.Representation.getUri());
+// public static final IRI REPRESENTATION = new IRI(RdfResourceEnum.Representation.getUri());
// protected ComponentContext context;
// protected Dictionary<String,?> properties;
@Reference
private TcManager tcManager;
- private UriRef yardGraphUri;
- private TripleCollection graph;
+ private IRI yardGraphUri;
+ private Graph graph;
private ServiceRegistration graphRegistration;
private ComponentContext context;
+ private boolean immutable;
- //private LockableMGraph graph;
+ //private LockableGraph graph;
public ClerezzaYard() {
super();
@@ -183,18 +183,23 @@ public class ClerezzaYard extends Abstra
if(this.yardGraphUri == null){ // use default
String yardUri = getUriPrefix();
//remove the "." at the last position of the prefix
- this.yardGraphUri = new UriRef(yardUri.substring(0, yardUri.length()-2));
+ this.yardGraphUri = new IRI(yardUri.substring(0, yardUri.length()-2));
}
try {
- this.graph = tcManager.getTriples(yardGraphUri);
+
+ try {
+ this.graph = tcManager.getImmutableGraph(yardGraphUri);
+ immutable = true;
+ } catch(NoSuchEntityException e) {
+ this.graph = tcManager.getGraph(yardGraphUri);
+ immutable = false;
+ }
+
log.info(" ... (re)use existing Graph {} for Yard {}",
yardGraphUri,config.getName());
- if(!(graph instanceof LockableMGraph)){
- log.info(" > NOTE: this ClerezzaYard is read-only");
- }
} catch (NoSuchEntityException e) {
log.info(" ... create new Graph {} for Yard {}",yardGraphUri,config.getName());
- this.graph = tcManager.createMGraph(yardGraphUri);
+ this.graph = tcManager.createGraph(yardGraphUri);
}
if(context != null){ //within an OSGI environment
//Register the graph with the Stanbol SPARQL endpoint (STANBOL-677)
@@ -206,7 +211,7 @@ public class ClerezzaYard extends Abstra
graphRegProp.put("graph.description", getConfig().getDescription());
}
graphRegistration = context.getBundleContext().registerService(
- TripleCollection.class.getName(), graph, graphRegProp);
+ Graph.class.getName(), graph, graphRegProp);
} //else do not register when running outside OSGI
}
@Deactivate
@@ -239,20 +244,20 @@ public class ClerezzaYard extends Abstra
if(id.isEmpty()){
throw new IllegalArgumentException("The parsed representation id MUST NOT be EMTPY!");
}
- return getRepresentation(new UriRef(id),true);
+ return getRepresentation(new IRI(id),true);
}
/**
* Internally used to create Representations for URIs
* @param uri the uri
* @param check if <code>false</code> than there is no check if the URI
- * refers to a Resource in the graph that is of type {@link #REPRESENTATION}
+ * refers to a RDFTerm in the graph that is of type {@link #REPRESENTATION}
* @return the Representation
*/
- protected final Representation getRepresentation(UriRef uri, boolean check) {
+ protected final Representation getRepresentation(IRI uri, boolean check) {
final Lock readLock = readLockGraph();
try {
if(!check || isRepresentation(uri)){
- MGraph nodeGraph = createRepresentationGraph(uri, graph);
+ Graph nodeGraph = createRepresentationGraph(uri, graph);
//Remove the triple internally used to represent an empty Representation
// ... this will only remove the triple if the Representation is empty
// but a check would take longer than the this call
@@ -272,49 +277,45 @@ public class ClerezzaYard extends Abstra
*/
private Lock readLockGraph() {
final Lock readLock;
- if(graph instanceof LockableMGraph){
- readLock = ((LockableMGraph)graph).getLock().readLock();
- readLock.lock();
- } else {
- readLock = null;
- }
+ readLock = graph.getLock().readLock();
+ readLock.lock();
return readLock;
}
/**
* Extracts the triples that belong to the {@link Representation} with the
* parsed id from the parsed graph. The graph is not modified and changes
* in the returned graph will not affect the parsed graph.
- * @param id the {@link UriRef} node representing the id of the Representation.
- * @param graph the Graph to extract the representation from
+ * @param id the {@link IRI} node representing the id of the Representation.
+ * @param graph the ImmutableGraph to extract the representation from
* @return the extracted graph.
*/
- protected MGraph createRepresentationGraph(UriRef id, TripleCollection graph){
- return extractRepresentation(graph, new IndexedMGraph(), id, new HashSet<BNode>());
+ protected Graph createRepresentationGraph(IRI id, Graph graph){
+ return extractRepresentation(graph, new IndexedGraph(), id, new HashSet<BlankNode>());
}
/**
* Recursive Method internally doing all the work for
- * {@link #createRepresentationGraph(UriRef, TripleCollection)}
+ * {@link #createRepresentationGraph(IRI, Graph)}
* @param source The graph to extract the Representation (source)
* @param target The graph to store the extracted triples (target)
* @param node the current node. Changes in recursive calls as it follows
- * @param visited holding all the visited BNodes to avoid cycles. Other nodes
+ * @param visited holding all the visited BlankNodes to avoid cycles. Other nodes
* need not be added because this implementation would not follow it anyway
- * outgoing relations if the object is a {@link BNode} instance.
+ * outgoing relations if the object is a {@link BlankNode} instance.
* @return the target graph (for convenience)
*/
- private MGraph extractRepresentation(TripleCollection source,MGraph target, NonLiteral node, Set<BNode> visited){
+ private Graph extractRepresentation(Graph source,Graph target, BlankNodeOrIRI node, Set<BlankNode> visited){
//we need all the outgoing relations and also want to follow bNodes until
- //the next UriRef. However we are not interested in incoming relations!
+ //the next IRI. However we are not interested in incoming relations!
Iterator<Triple> outgoing = source.filter(node, null, null);
while (outgoing.hasNext()) {
Triple triple = outgoing.next();
target.add(triple);
- Resource object = triple.getObject();
- if(object instanceof BNode){
+ RDFTerm object = triple.getObject();
+ if(object instanceof BlankNode){
//add first and than follow because there might be a triple such as
// bnode1 <urn:someProperty> bnode1
- visited.add((BNode)object);
- extractRepresentation(source, target, (NonLiteral)object, visited);
+ visited.add((BlankNode)object);
+ extractRepresentation(source, target, (BlankNodeOrIRI)object, visited);
}
}
return target;
@@ -329,14 +330,14 @@ public class ClerezzaYard extends Abstra
throw new IllegalArgumentException("The parsed id MUST NOT be EMPTY!");
}
//search for any outgoing triple
- return isRepresentation(new UriRef(id));
+ return isRepresentation(new IRI(id));
}
/**
* Internally used to check if a URI resource represents an representation
* @param resource the resource to check
* @return the state
*/
- protected final boolean isRepresentation(UriRef resource){
+ protected final boolean isRepresentation(IRI resource){
return graph.filter(resource, null, null).hasNext();
}
@@ -345,7 +346,7 @@ public class ClerezzaYard extends Abstra
if(id == null) {
throw new IllegalArgumentException("The parsed Representation id MUST NOT be NULL!");
}
- UriRef resource = new UriRef(id);
+ IRI resource = new IRI(id);
final Lock writeLock = writeLockGraph();
try {
Iterator<Triple> it = graph.filter(resource, null, null);
@@ -365,15 +366,14 @@ public class ClerezzaYard extends Abstra
* @throws YardException
*/
private Lock writeLockGraph() throws YardException {
- final Lock writeLock;
- if(graph instanceof LockableMGraph){
- writeLock = ((LockableMGraph)graph).getLock().writeLock();
- writeLock.lock();
- } else {
- throw new YardException("Unable modify data in ClerezzaYard '"+getId()
+ if (immutable) {
+ throw new YardException("Unable modify data in ClerezzaYard '"+getId()
+ "' because the backing RDF graph '"+yardGraphUri
+ "' is read-only!");
}
+ final Lock writeLock;
+ writeLock = graph.getLock().writeLock();
+ writeLock.lock();
return writeLock;
}
@Override
@@ -445,7 +445,7 @@ public class ClerezzaYard extends Abstra
return null;
}
log.debug("store Representation " + representation.getId());
- UriRef id = new UriRef(representation.getId());
+ IRI id = new IRI(representation.getId());
final Lock writeLock = writeLockGraph();
try {
Iterator<Triple> current = graph.filter(id, null, null);
@@ -491,14 +491,14 @@ public class ClerezzaYard extends Abstra
// first we use the adaptingIterator to convert reseource to string
// to get the resources we have to retrieve the root-variable of the
// Iterator<SolutionMapping> provided by the ResultSet of the SPARQL query
- Iterator<String> representationIdIterator = new AdaptingIterator<Resource, String>(
- new Iterator<Resource>() {
+ Iterator<String> representationIdIterator = new AdaptingIterator<RDFTerm, String>(
+ new Iterator<RDFTerm>() {
@Override public void remove() { result.remove(); }
- @Override public Resource next() {
+ @Override public RDFTerm next() {
return result.next().get(query.getRootVariableName()); }
@Override public boolean hasNext() { return result.hasNext(); }
},
- new Resource2StringAdapter<Resource>(), String.class);
+ new Resource2StringAdapter<RDFTerm>(), String.class);
return new QueryResultListImpl<String>(query,representationIdIterator,String.class);
}
/**
@@ -547,14 +547,14 @@ public class ClerezzaYard extends Abstra
* @param solution a solution of the query
* @param type the type (no generics here)
* @return the representation or <code>null</code> if result is
- * not an UriRef or there is no Representation for the result.
+ * not an IRI or there is no Representation for the result.
*/
@Override
public Representation adapt(SolutionMapping solution, Class<Representation> type) {
- Resource resource = solution.get(query.getRootVariableName());
- if(resource instanceof UriRef){
+ RDFTerm resource = solution.get(query.getRootVariableName());
+ if(resource instanceof IRI){
try {
- return getRepresentation((UriRef)resource,false);
+ return getRepresentation((IRI)resource,false);
} catch (IllegalArgumentException e) {
log.warn("Unable to create Representation for ID "+resource+"! -> ignore query result");
return null;
@@ -591,14 +591,14 @@ public class ClerezzaYard extends Abstra
throw new YardException("Unable to parse SPARQL query generated for the parse FieldQuery",e);
}
Object resultObject = tcManager.executeSparqlQuery(sparqlQuery, graph);
- final MGraph resultGraph;
- if(resultObject instanceof MGraph){
- resultGraph = (MGraph)resultObject;
- } else if(resultObject instanceof Graph){
- resultGraph = new IndexedMGraph();
- resultGraph.addAll((Graph)resultObject);
+ final Graph resultGraph;
+ if(resultObject instanceof Graph){
+ resultGraph = (Graph)resultObject;
+ } else if(resultObject instanceof ImmutableGraph){
+ resultGraph = new IndexedGraph();
+ resultGraph.addAll((ImmutableGraph)resultObject);
} else {
- log.error("Unable to create "+MGraph.class+" instance for query reults of type "+resultObject.getClass()+" (this indicates that the used SPARQL Query was not of type CONSTRUCT)");
+ log.error("Unable to create "+Graph.class+" instance for query reults of type "+resultObject.getClass()+" (this indicates that the used SPARQL Query was not of type CONSTRUCT)");
log.error("FieldQuery: "+query);
log.error("SPARQL Query: "+sparqlQueryString);
throw new YardException("Unable to process results of Query");
Modified: stanbol/trunk/entityhub/yard/clerezza/src/main/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYardConfig.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/yard/clerezza/src/main/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYardConfig.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/yard/clerezza/src/main/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYardConfig.java (original)
+++ stanbol/trunk/entityhub/yard/clerezza/src/main/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYardConfig.java Tue May 17 22:20:49 2016
@@ -18,7 +18,7 @@ package org.apache.stanbol.entityhub.yar
import java.util.Dictionary;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.stanbol.entityhub.core.yard.AbstractYard.YardConfig;
import org.osgi.service.cm.ConfigurationException;
@@ -38,12 +38,12 @@ public class ClerezzaYardConfig extends
* Getter for the {@link ClerezzaYard#GRAPH_URI} property
* @return the graph URI or <code>null</code> if non is configured
*/
- public UriRef getGraphUri(){
+ public IRI getGraphUri(){
Object value = config.get(ClerezzaYard.GRAPH_URI);
- if(value instanceof UriRef){
- return (UriRef)value;
+ if(value instanceof IRI){
+ return (IRI)value;
} else if (value != null){
- return new UriRef(value.toString());
+ return new IRI(value.toString());
} else {
return null;
}
@@ -52,7 +52,7 @@ public class ClerezzaYardConfig extends
* Setter for the {@link ClerezzaYard#GRAPH_URI} property
* @param uri the uri or <code>null</code> to remove this configuration
*/
- public void setGraphUri(UriRef uri){
+ public void setGraphUri(IRI uri){
if(uri == null){
config.remove(ClerezzaYard.GRAPH_URI);
} else {
Modified: stanbol/trunk/entityhub/yard/clerezza/src/test/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYardTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/yard/clerezza/src/test/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYardTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/yard/clerezza/src/test/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYardTest.java (original)
+++ stanbol/trunk/entityhub/yard/clerezza/src/test/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ClerezzaYardTest.java Tue May 17 22:20:49 2016
@@ -52,7 +52,7 @@ public class ClerezzaYardTest extends Ya
/**
* The Clerezza Yard uses the Statement<br>
* <code>representationId -> rdf:type -> Representation</code><br>
- * to identify that an UriRef in the RDF graph (MGraph) represents a
+ * to identify that an IRI in the RDF graph (Graph) represents a
* Representation. This Triple is added when a Representation is stored and
* removed if retrieved from the Yard.<p>
* This tests if this functions as expected
Modified: stanbol/trunk/entityhub/yard/clerezza/src/test/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ExistingClerezzaGraphTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/entityhub/yard/clerezza/src/test/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ExistingClerezzaGraphTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/entityhub/yard/clerezza/src/test/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ExistingClerezzaGraphTest.java (original)
+++ stanbol/trunk/entityhub/yard/clerezza/src/test/java/org/apache/stanbol/entityhub/yard/clerezza/impl/ExistingClerezzaGraphTest.java Tue May 17 22:20:49 2016
@@ -17,11 +17,9 @@
package org.apache.stanbol.entityhub.yard.clerezza.impl;
import static java.util.Collections.singletonMap;
-import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertTrue;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -29,20 +27,17 @@ import java.util.Map.Entry;
import junit.framework.Assert;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TripleCollection;
-import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.commons.rdf.ImmutableGraph;
+import org.apache.clerezza.commons.rdf.Language;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
import org.apache.clerezza.rdf.core.access.TcManager;
-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.rdf.core.impl.graphmatching.GraphMatcher;
+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.ontologies.RDF;
import org.apache.clerezza.rdf.ontologies.SKOS;
-import org.apache.stanbol.entityhub.core.model.InMemoryValueFactory;
import org.apache.stanbol.entityhub.model.clerezza.RdfRepresentation;
import org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory;
import org.apache.stanbol.entityhub.servicesapi.model.Representation;
@@ -54,7 +49,7 @@ import org.junit.Test;
/**
* Unit tests for testing {@link ClerezzaYard} initialisation and usage in
* cases the configured {@link ClerezzaYardConfig#getGraphUri()} points to
- * already existing Clerezza {@link MGraph}s and {@link Graph} instances.<p>
+ * already existing Clerezza {@link Graph}s and {@link ImmutableGraph} instances.<p>
* This basically tests features added with STANBOL-662 and STANBOL-663
* @author Rupert Westenthaler
*
@@ -64,10 +59,10 @@ public class ExistingClerezzaGraphTest {
private static TcManager tcManager;
private static Language EN = new Language("en");
private static Language DE = new Language("de");
- private static final Map<UriRef,TripleCollection> entityData = new HashMap<UriRef,TripleCollection>();
+ private static final Map<IRI,Graph> entityData = new HashMap<IRI,Graph>();
- private static UriRef READ_ONLY_GRAPH_URI = new UriRef("http://www.test.org/read-only-grpah");
- private static UriRef READ_WRITEGRAPH_URI = new UriRef("http://www.test.org/read-write-grpah");
+ private static IRI READ_ONLY_GRAPH_URI = new IRI("http://www.test.org/read-only-grpah");
+ private static IRI READ_WRITEGRAPH_URI = new IRI("http://www.test.org/read-write-grpah");
private static ClerezzaYard readwriteYard;
private static ClerezzaYard readonlyYard;
@@ -77,24 +72,24 @@ public class ExistingClerezzaGraphTest {
initTestData();
//create the graphs in Clerezza
tcManager = TcManager.getInstance();
- MGraph graph = tcManager.createMGraph(READ_WRITEGRAPH_URI);
+ Graph graph = tcManager.createGraph(READ_WRITEGRAPH_URI);
//add the test data to the MGrpah
- for(TripleCollection tc :entityData.values()){
+ for(Graph tc :entityData.values()){
graph.addAll(tc);
}
//create the read only graph
- tcManager.createGraph(READ_ONLY_GRAPH_URI, graph);
+ tcManager.createImmutableGraph(READ_ONLY_GRAPH_URI, graph);
//init the ClerezzaYards for the created Clerezza graphs
ClerezzaYardConfig readWriteConfig = new ClerezzaYardConfig("readWriteYardId");
readWriteConfig.setName("Clerezza read/write Yard");
- readWriteConfig.setDescription("Tests config with pre-existing MGraph");
+ readWriteConfig.setDescription("Tests config with pre-existing Graph");
readWriteConfig.setGraphUri(READ_WRITEGRAPH_URI);
readwriteYard = new ClerezzaYard(readWriteConfig);
ClerezzaYardConfig readOnlyYardConfig = new ClerezzaYardConfig("readOnlyYardId");
readOnlyYardConfig.setName("Clerezza read-only Yard");
- readOnlyYardConfig.setDescription("Tests config with pre-existing Graph");
+ readOnlyYardConfig.setDescription("Tests config with pre-existing ImmutableGraph");
readOnlyYardConfig.setGraphUri(READ_ONLY_GRAPH_URI);
readonlyYard = new ClerezzaYard(readOnlyYardConfig);
@@ -106,7 +101,7 @@ public class ExistingClerezzaGraphTest {
*/
@Test
public void testRetrival(){
- for(Entry<UriRef,TripleCollection> entity : entityData.entrySet()){
+ for(Entry<IRI,Graph> entity : entityData.entrySet()){
validateEntity(readonlyYard,entity);
validateEntity(readwriteYard,entity);
}
@@ -148,12 +143,12 @@ public class ExistingClerezzaGraphTest {
* retrieved by the tested {@link ClerezzaYard}s.
* @param entity key - URI; value - expected RDF data
*/
- private void validateEntity(ClerezzaYard yard, Entry<UriRef,TripleCollection> entity) {
+ private void validateEntity(ClerezzaYard yard, Entry<IRI,Graph> entity) {
Representation rep = yard.getRepresentation(entity.getKey().getUnicodeString());
assertNotNull("The Representation for "+entity.getKey()
+ "is missing in the "+yard.getId(), rep);
assertTrue("RdfRepresentation expected", rep instanceof RdfRepresentation);
- TripleCollection repGraph = ((RdfRepresentation)rep).getRdfGraph();
+ Graph repGraph = ((RdfRepresentation)rep).getRdfGraph();
for(Iterator<Triple> triples = entity.getValue().iterator();triples.hasNext();){
Triple triple = triples.next();
assertTrue("Data of Representation "+entity.getKey()
@@ -168,15 +163,15 @@ public class ExistingClerezzaGraphTest {
* Initialises the {@link #entityData} used for this test (called in BeforeClass)
*/
private static void initTestData() {
- UriRef entity1 = new UriRef("http://www.test.org/entity1");
- MGraph entity1Data = new SimpleMGraph();
+ IRI entity1 = new IRI("http://www.test.org/entity1");
+ Graph entity1Data = new SimpleGraph();
entity1Data.add(new TripleImpl(entity1,RDF.type, SKOS.Concept));
entity1Data.add(new TripleImpl(entity1,SKOS.prefLabel, new PlainLiteralImpl("test", EN)));
entity1Data.add(new TripleImpl(entity1,SKOS.prefLabel, new PlainLiteralImpl("Test", DE)));
entityData.put(entity1, entity1Data);
- MGraph entity2Data = new SimpleMGraph();
- UriRef entity2 = new UriRef("http://www.test.org/entity2");
+ Graph entity2Data = new SimpleGraph();
+ IRI entity2 = new IRI("http://www.test.org/entity2");
entity2Data.add(new TripleImpl(entity2, RDF.type, SKOS.Concept));
entity2Data.add(new TripleImpl(entity2,SKOS.prefLabel, new PlainLiteralImpl("sub-test", EN)));
entity2Data.add(new TripleImpl(entity2,SKOS.prefLabel, new PlainLiteralImpl("Untertest", DE)));
@@ -186,7 +181,7 @@ public class ExistingClerezzaGraphTest {
@AfterClass
public static void cleanup(){
- tcManager.deleteTripleCollection(READ_ONLY_GRAPH_URI);
- tcManager.deleteTripleCollection(READ_WRITEGRAPH_URI);
+ tcManager.deleteGraph(READ_ONLY_GRAPH_URI);
+ tcManager.deleteGraph(READ_WRITEGRAPH_URI);
}
}
Modified: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java (original)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTestBase.java Tue May 17 22:20:49 2016
@@ -39,12 +39,12 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.zip.GZIPInputStream;
-import org.apache.clerezza.rdf.core.Literal;
-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.UriRef;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
+import org.apache.clerezza.commons.rdf.Literal;
+import org.apache.clerezza.commons.rdf.RDFTerm;
+import org.apache.clerezza.commons.rdf.Triple;
+import org.apache.clerezza.commons.rdf.Graph;
+import org.apache.clerezza.commons.rdf.IRI;
+import org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph;
import org.apache.clerezza.rdf.core.serializedform.Parser;
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
import org.apache.clerezza.rdf.core.serializedform.UnsupportedFormatException;
@@ -61,7 +61,7 @@ import org.apache.http.config.SocketConf
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
-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.namespaceprefix.service.StanbolNamespacePrefixService;
@@ -93,7 +93,7 @@ public abstract class MultiThreadedTestB
*/
public static final String PROPERTY_CHAIN = "stanbol.it.multithreadtest.chain";
/**
- * The reference to the test data. Can be a File, a Resource available via the
+ * The reference to the test data. Can be a File, a RDFTerm available via the
* Classpath or an URL. This also supports compressed files. In case of ZIP
* only the first entry is processed.
*/
@@ -245,7 +245,7 @@ public abstract class MultiThreadedTestB
mediaType = null;
}
}
- Assert.assertNotNull("Unable to detect MediaType for Resource '"
+ Assert.assertNotNull("Unable to detect MediaType for RDFTerm '"
+ name+"'. Please use the property '"+PROPERTY_TEST_DATA_TYPE
+ "' to manually parse the MediaType!", mediaType);
@@ -271,7 +271,7 @@ public abstract class MultiThreadedTestB
* the Apache Clerezza RDF parsers.
*/
private Iterator<String> createRdfDataIterator(InputStream is, String mediaType, final String propertyString) {
- final SimpleMGraph graph = new SimpleMGraph();
+ final SimpleGraph graph = new SimpleGraph();
try {
rdfParser.parse(graph, is, mediaType);
} catch (UnsupportedFormatException e) {
@@ -288,19 +288,19 @@ public abstract class MultiThreadedTestB
String next = null;
private String getNext(){
if(it == null){
- UriRef property;
+ IRI property;
if("*".equals(propertyString)){
property = null; //wildcard
log.info("Iterate over values of all Triples");
} else {
- property = new UriRef(
+ property = new IRI(
NamespaceMappingUtils.getConfiguredUri(nsPrefixService, propertyString));
log.info("Iterate over values of property {}", property);
}
it = graph.filter(null, property, null);
}
while(it.hasNext()){
- Resource value = it.next().getObject();
+ RDFTerm value = it.next().getObject();
if(value instanceof Literal){
return ((Literal)value).getLexicalForm();
}
@@ -635,7 +635,7 @@ public abstract class MultiThreadedTestB
}
}
- void succeed(Request request, UriRef contentItemUri, TripleCollection results, Long rtt, int size) {
+ void succeed(Request request, IRI contentItemUri, Graph results, Long rtt, int size) {
ExecutionMetadata em = ExecutionMetadata.parseFrom(results, contentItemUri);
results.clear(); // we no longer need the results
if (em != null) {
@@ -751,19 +751,19 @@ public abstract class MultiThreadedTestB
rtt = null;
return;
}
- IndexedMGraph graph = new IndexedMGraph();
+ IndexedGraph graph = new IndexedGraph();
try {
rdfParser.parse(graph,executor.getStream(), executor.getContentType().getMimeType());
Iterator<Triple> ciIt = graph.filter(null, Properties.ENHANCER_EXTRACTED_FROM, null);
if(!ciIt.hasNext()){
throw new IllegalStateException("Enhancement Results do not caontain a single Enhancement");
}
- Resource contentItemUri = ciIt.next().getObject();
- if(!(contentItemUri instanceof UriRef)){
- throw new IllegalStateException("ContentItem URI is not an UriRef but an instance of "
+ RDFTerm contentItemUri = ciIt.next().getObject();
+ if(!(contentItemUri instanceof IRI)){
+ throw new IllegalStateException("ContentItem URI is not an IRI but an instance of "
+ contentItemUri.getClass().getSimpleName());
}
- tracker.succeed(request, (UriRef) contentItemUri, graph, rtt, executor.getContent().length());
+ tracker.succeed(request, (IRI) contentItemUri, graph, rtt, executor.getContent().length());
content = null; //do not store content for successful results
} catch (Exception e) {
log.warn("Exception while parsing Enhancement Response",e);
Modified: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java (original)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultipartRequestTest.java Tue May 17 22:20:49 2016
@@ -30,13 +30,13 @@ import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.MGraph;
-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.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.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.simple.SimpleGraph;
+import org.apache.clerezza.commons.rdf.impl.utils.TripleImpl;
import org.apache.clerezza.rdf.core.serializedform.Serializer;
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
import org.apache.clerezza.rdf.ontologies.RDF;
@@ -379,7 +379,7 @@ public class MultipartRequestTest extend
@Test
public void testContentBeforeMetadata() throws IOException{
- final UriRef contentItemId = new UriRef("http://www.example.com/test.html");
+ final IRI contentItemId = new IRI("http://www.example.com/test.html");
String rdfContentType = SupportedFormat.RDF_XML;
String rdfContent = getDummyRdfMetadata(contentItemId, rdfContentType);
MultipartEntityBuilder ciBuilder = MultipartEntityBuilder.create();
@@ -399,7 +399,7 @@ public class MultipartRequestTest extend
}
@Test
public void testMissingContent() throws IOException{
- final UriRef contentItemId = new UriRef("http://www.example.com/test.html");
+ final IRI contentItemId = new IRI("http://www.example.com/test.html");
String rdfContentType = SupportedFormat.RDF_XML;
String rdfContent = getDummyRdfMetadata(contentItemId, rdfContentType);
MultipartEntityBuilder ciBuilder = MultipartEntityBuilder.create();
@@ -422,9 +422,9 @@ public class MultipartRequestTest extend
* @param rdfContentType
* @return
*/
- private String getDummyRdfMetadata(final UriRef contentItemId, String rdfContentType) {
- MGraph metadata = new SimpleMGraph();
- metadata.add(new TripleImpl(new BNode(), Properties.ENHANCER_EXTRACTED_FROM, contentItemId));
+ private String getDummyRdfMetadata(final IRI contentItemId, String rdfContentType) {
+ Graph metadata = new SimpleGraph();
+ metadata.add(new TripleImpl(new BlankNode(), Properties.ENHANCER_EXTRACTED_FROM, contentItemId));
ByteArrayOutputStream out = new ByteArrayOutputStream();
serializer.serialize(out, metadata, rdfContentType);
String rdfContent = new String(out.toByteArray(),UTF8);
@@ -440,9 +440,9 @@ public class MultipartRequestTest extend
@Test
public void testUploadWithMetadata() throws IOException {
//create the metadata
- Resource user = new PlainLiteralImpl("Rupert Westenthaler");
- final UriRef contentItemId = new UriRef("http://www.example.com/test.html");
- MGraph metadata = new SimpleMGraph();
+ RDFTerm user = new PlainLiteralImpl("Rupert Westenthaler");
+ final IRI contentItemId = new IRI("http://www.example.com/test.html");
+ Graph metadata = new SimpleGraph();
addTagAsTextAnnotation(metadata, contentItemId,
"Germany",DBPEDIA_PLACE, user);
addTagAsTextAnnotation(metadata, contentItemId,
@@ -515,9 +515,9 @@ public class MultipartRequestTest extend
* @param user the user that created the tag
* @return the uri of the created annotation
*/
- private static final UriRef addTagAsTextAnnotation(MGraph graph, UriRef contentItem,
- String tag, UriRef tagType, Resource user){
- UriRef ta = new UriRef("urn:user-annotation:"+EnhancementEngineHelper.randomUUID());
+ private static final IRI addTagAsTextAnnotation(Graph graph, IRI contentItem,
+ String tag, IRI tagType, RDFTerm user){
+ IRI ta = new IRI("urn:user-annotation:"+EnhancementEngineHelper.randomUUID());
graph.add(new TripleImpl(ta, RDF.type, TechnicalClasses.ENHANCER_TEXTANNOTATION));
graph.add(new TripleImpl(ta, Properties.ENHANCER_EXTRACTED_FROM,contentItem));
if(tagType != null){
Modified: stanbol/trunk/launchers/bundlelists/security/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/launchers/bundlelists/security/src/main/bundles/list.xml?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/launchers/bundlelists/security/src/main/bundles/list.xml (original)
+++ stanbol/trunk/launchers/bundlelists/security/src/main/bundles/list.xml Tue May 17 22:20:49 2016
@@ -21,12 +21,12 @@
<bundle>
<groupId>org.apache.clerezza</groupId>
<artifactId>rdf.file.storage</artifactId>
- <version>0.4</version>
+ <version>1.0.0</version>
</bundle>
<bundle>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.config</artifactId>
- <version>0.4</version>
+ <version>1.0.0</version>
</bundle>
<bundle>
<groupId>org.apache.clerezza</groupId>
@@ -36,7 +36,7 @@
<bundle>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform</artifactId>
- <version>0.2</version>
+ <version>1.0.0</version>
</bundle>
<bundle>
<groupId>org.apache.stanbol</groupId>
@@ -71,7 +71,7 @@
<bundle>
<groupId>org.apache.clerezza</groupId>
<artifactId>platform.graphprovider.content</artifactId>
- <version>0.7</version>
+ <version>1.0.0</version>
</bundle>
</startLevel>
</bundles>
Modified: stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml (original)
+++ stanbol/trunk/launchers/bundlelists/stanbolcommons/src/main/bundles/list.xml Tue May 17 22:20:49 2016
@@ -388,7 +388,17 @@
<bundle>
<groupId>org.apache.clerezza</groupId>
<artifactId>jaxrs.rdf.providers</artifactId>
- <version>0.15</version>
+ <version>1.0.0</version>
+ </bundle>
+ <bundle>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
+ </bundle>
+ <bundle>
+ <groupId>org.apache.clerezza</groupId>
+ <artifactId>rdf.rdfjson</artifactId>
+ <version>1.0.0</version>
</bundle>
</startLevel>
Modified: stanbol/trunk/launchers/bundlelists/zzshell/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/launchers/bundlelists/zzshell/pom.xml?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/launchers/bundlelists/zzshell/pom.xml (original)
+++ stanbol/trunk/launchers/bundlelists/zzshell/pom.xml Tue May 17 22:20:49 2016
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.stanbol</groupId>
- <artifactId>apache-stanbol-bundlelists</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <groupId>org.apache.stanbol</groupId>
- <artifactId>org.apache.stanbol.launchers.bundlelists.zzshell</artifactId>
- <version>1.0.0-SNAPSHOT</version>
- <packaging>partialbundlelist</packaging>
-
- <name>Apache Stanbol Bundlelist for the Clerezza Shell</name>
- <description>This is a Maven project which produces the partial list containing for bundles providing the clerezza shell with ssh access</description>
-
- <scm>
- <connection>
- scm:svn:http://svn.apache.org/repos/asf/stanbol/trunk/launchers/bundlelists/zzshell
- </connection>
- <developerConnection>
- scm:svn:https://svn.apache.org/repos/asf/stanbol/trunk/launchers/bundlelists/zzshell
- </developerConnection>
- <url>http://stanbol.apache.org/</url>
- </scm>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.sling</groupId>
- <artifactId>maven-launchpad-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-bundle-list</id>
- <goals>
- <goal>attach-bundle-list</goal>
- </goals>
- <configuration>
- <includeDefaultBundles>false</includeDefaultBundles>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
Modified: stanbol/trunk/launchers/bundlelists/zzshell/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/launchers/bundlelists/zzshell/src/main/bundles/list.xml?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/launchers/bundlelists/zzshell/src/main/bundles/list.xml (original)
+++ stanbol/trunk/launchers/bundlelists/zzshell/src/main/bundles/list.xml Tue May 17 22:20:49 2016
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<bundles>
-
-
- <!-- Scala -->
- <startLevel level="32">
- <bundle>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.scala-library</artifactId>
- <version>2.8.1_1</version>
- </bundle>
- <bundle>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.scala-compiler</artifactId>
- <version>2.8.1_1</version>
- </bundle>
- <bundle>
- <groupId>org.apache.clerezza.ext</groupId>
- <artifactId>slf4j-scala-api</artifactId>
- <version>1.6.1-incubating</version>
- </bundle>
- <bundle>
- <groupId>org.apache.clerezza.scala</groupId>
- <artifactId>script-engine</artifactId>
- <version>0.1-incubating</version>
- </bundle>
- </startLevel>
-
- <!-- Console Shell -->
- <startLevel level="33">
- <bundle>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>shell</artifactId>
- <version>0.1-incubating</version>
- </bundle>
- <bundle>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>osgi.services</artifactId>
- <version>0.1-incubating</version>
- </bundle>
- <bundle>
- <groupId>org.apache.servicemix.bundles</groupId>
- <artifactId>org.apache.servicemix.bundles.jline</artifactId>
- <version>0.9.94_1</version>
- </bundle>
- <bundle>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>permissiondescriptions</artifactId>
- <version>0.1-incubating</version>
- </bundle>
- </startLevel>
-
- <!-- SSH Shell access -->
- <startLevel level="34">
- <bundle>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>sshshell</artifactId>
- <version>0.1-incubating</version>
- </bundle>
- <bundle>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.config</artifactId>
- <version>0.3-incubating</version>
- </bundle>
- <bundle>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.security</artifactId>
- <version>0.8-incubating</version>
- </bundle>
- <bundle>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform</artifactId>
- <version>0.1-incubating</version>
- </bundle>
- <bundle>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>platform.graphprovider.content</artifactId>
- <version>0.6-incubating</version>
- </bundle>
- <bundle>
- <groupId>org.apache.mina</groupId>
- <artifactId>mina-core</artifactId>
- <version>2.0.7</version>
- </bundle>
- <bundle>
- <groupId>org.apache.sshd</groupId>
- <artifactId>sshd-core</artifactId>
- <version>0.8.0</version>
- </bundle>
- </startLevel>
-
-
-</bundles>
\ No newline at end of file
Modified: stanbol/trunk/launchers/full/pom.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/launchers/full/pom.xml?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/launchers/full/pom.xml (original)
+++ stanbol/trunk/launchers/full/pom.xml Tue May 17 22:20:49 2016
@@ -191,7 +191,7 @@
<dependency>
<groupId>org.apache.clerezza.provisioning</groupId>
<artifactId>rdf</artifactId>
- <version>0.1</version>
+ <version>1.0.0</version>
<type>partialbundlelist</type>
<scope>provided</scope>
</dependency>
@@ -200,7 +200,7 @@
<dependency>
<groupId>org.apache.clerezza.provisioning</groupId>
<artifactId>rdf.tdb</artifactId>
- <version>0.1</version>
+ <version>1.0.0</version>
<type>partialbundlelist</type>
<scope>provided</scope>
</dependency>
@@ -224,13 +224,13 @@
</dependency>
<!-- Clerezza zz> Shell Bundle List -->
- <dependency>
+ <!-- <dependency>
<groupId>org.apache.clerezza.provisioning</groupId>
<artifactId>shell</artifactId>
<version>0.1</version>
<type>partialbundlelist</type>
<scope>provided</scope>
- </dependency>
+ </dependency> -->
<!-- Stanbol Data Bundle List -->
<dependency>
Propchange: stanbol/trunk/launchers/mini-war/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 17 22:20:49 2016
@@ -0,0 +1 @@
+target
Propchange: stanbol/trunk/launchers/stable-war/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 17 22:20:49 2016
@@ -0,0 +1 @@
+target
Modified: stanbol/trunk/nbactions.xml
URL: http://svn.apache.org/viewvc/stanbol/trunk/nbactions.xml?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/nbactions.xml (original)
+++ stanbol/trunk/nbactions.xml Tue May 17 22:20:49 2016
@@ -40,4 +40,15 @@
<allowSnapshots>true</allowSnapshots>
</properties>
</action>
+ <action>
+ <actionName>CUSTOM-use-latests-zz-versions</actionName>
+ <displayName>use-latests-clerezza-versions</displayName>
+ <goals>
+ <goal>versions:use-latest-versions</goal>
+ </goals>
+ <properties>
+ <includes>org.apache.clerezza</includes>
+ <allowSnapshots>false</allowSnapshots>
+ </properties>
+ </action>
</actions>
Modified: stanbol/trunk/ontologymanager/generic/servicesapi/src/main/java/org/apache/stanbol/ontologymanager/servicesapi/NamedArtifact.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/ontologymanager/generic/servicesapi/src/main/java/org/apache/stanbol/ontologymanager/servicesapi/NamedArtifact.java?rev=1744328&r1=1744327&r2=1744328&view=diff
==============================================================================
--- stanbol/trunk/ontologymanager/generic/servicesapi/src/main/java/org/apache/stanbol/ontologymanager/servicesapi/NamedArtifact.java (original)
+++ stanbol/trunk/ontologymanager/generic/servicesapi/src/main/java/org/apache/stanbol/ontologymanager/servicesapi/NamedArtifact.java Tue May 17 22:20:49 2016
@@ -45,7 +45,7 @@ public interface NamedArtifact {
* objects of different types cannot have the same ID. These aspects should be ensured by registries,
* indexers etc.<br>
* <br>
- * XXX check if a type other than String (e.g. URI, IRI, UriRef) should be used.
+ * XXX check if a type other than String (e.g. URI, IRI, IRI) should be used.
*
* @return an identifier for this resource.
*/