use of org.apache.stanbol.ontologymanager.servicesapi.collector.OntologyCollector in project stanbol by apache.
the class AbstractOntologyCollectorImpl method equals.
@Override
public boolean equals(Object arg0) {
if (arg0 == null)
return false;
if (!(arg0 instanceof OntologyCollector))
return false;
if (this == arg0)
return true;
log.warn("{} only implements weak equality, i.e. managed ontologies are only checked by public key, not by content.", getClass());
OntologyCollector coll = (OntologyCollector) arg0;
return this.getID().equals(coll.getID()) && this.getDefaultNamespace().equals(coll.getDefaultNamespace()) && this.listManagedOntologies().equals(coll.listManagedOntologies()) && this.getSupportedOntologyTypes().equals(coll.getSupportedOntologyTypes());
}
use of org.apache.stanbol.ontologymanager.servicesapi.collector.OntologyCollector in project stanbol by apache.
the class GraphMultiplexer method getHandles.
@Override
public Set<OntologyCollector> getHandles(OWLOntologyID publicKey) {
Set<OntologyCollector> handles = new HashSet<OntologyCollector>();
Set<OWLOntologyID> aliases = listAliases(publicKey);
aliases.add(publicKey);
for (OWLOntologyID alias : aliases) {
IRI ontologyId = buildResource(alias);
for (Iterator<Triple> it = meta.filter(null, MANAGES_URIREF, ontologyId); it.hasNext(); ) {
BlankNodeOrIRI sub = it.next().getSubject();
if (sub instanceof IRI)
checkHandle((IRI) sub, handles);
else
throw new InvalidMetaGraphStateException(sub + " is not a valid ontology collector identifer.");
}
for (Iterator<Triple> it = meta.filter(ontologyId, IS_MANAGED_BY_URIREF, null); it.hasNext(); ) {
RDFTerm obj = it.next().getObject();
if (obj instanceof IRI)
checkHandle((IRI) obj, handles);
else
throw new InvalidMetaGraphStateException(obj + " is not a valid ontology collector identifer.");
}
}
return handles;
// throw new UnsupportedOperationException("Not implemented yet.");
}
use of org.apache.stanbol.ontologymanager.servicesapi.collector.OntologyCollector in project stanbol by apache.
the class RootResource method performShowOntology.
/**
* Helper method to make sure a ResponseBuilder is created on every conditions, so that it is then
* possible to enable CORS on it afterwards.
*
* @param ontologyId
* @return
*/
protected ResponseBuilder performShowOntology(String ontologyId) {
if (ontologyId == null || ontologyId.isEmpty()) {
return Response.status(BAD_REQUEST);
}
OWLOntologyID key = OntologyUtils.decode(ontologyId);
if (ontologyProvider.listOrphans().contains(key)) {
return Response.status(NO_CONTENT);
}
OWLOntology o = getOWLOntology(ontologyId, false, uriInfo.getRequestUri());
if (o == null) {
return Response.status(NOT_FOUND);
}
// Assemble dependency list
Map<OWLOntologyID, OntologyProvider.Status> deps = new HashMap<OWLOntologyID, OntologyProvider.Status>();
for (OWLOntologyID dep : getDescriptor().getDependencies(key)) {
deps.put(dep, ontologyProvider.getStatus(dep));
}
Set<OntologyCollector> handles = new HashSet<OntologyCollector>();
if (onManager != null) {
for (Scope scope : onManager.getRegisteredScopes()) {
if (scope.getCoreSpace().hasOntology(key)) {
handles.add(scope.getCoreSpace());
}
if (scope.getCustomSpace().hasOntology(key)) {
handles.add(scope.getCustomSpace());
}
}
}
if (sessionManager != null) {
for (String sesId : sessionManager.getRegisteredSessionIDs()) {
if (sessionManager.getSession(sesId).hasOntology(key)) {
handles.add(sessionManager.getSession(sesId));
}
}
}
return Response.ok(new Viewable("ontology", new OntologyStats(uriInfo, key, o, ontologyProvider.listAliases(key), deps, handles)));
}
Aggregations