Tabnine Logo
Session
Code IndexAdd Tabnine to your IDE (free)

How to use
Session
in
org.apache.stanbol.ontologymanager.servicesapi.session

Best Java code snippets using org.apache.stanbol.ontologymanager.servicesapi.session.Session (Showing top 20 results out of 315)

origin: apache/stanbol

  @GET
  @Produces(value = {APPLICATION_JSON, N3, N_TRIPLE, RDF_JSON})
  public Response asOntologyGraph(@PathParam(value = "id") String sessionId,
                  @PathParam("scopeid") String scopeid,
                  @DefaultValue("false") @QueryParam("merge") boolean merge,
                  @Context HttpHeaders headers) {
    session = sesMgr.getSession(sessionId);
    if (session == null) return Response.status(NOT_FOUND).build();
    IRI prefix = IRI.create(getPublicBaseUri() + "ontonet/session/");
    // Export to Clerezza ImmutableGraph, which can be rendered as JSON-LD.
    ResponseBuilder rb = Response.ok(session.export(ImmutableGraph.class, merge, prefix));
//        addCORSOrigin(servletContext, rb, headers);
    return rb.build();
  }

origin: apache/stanbol

protected synchronized void addSession(Session session) {
  sessionsByID.put(session.getID(), session);
}
origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

@Override
public boolean equals(Object arg0) {
  if (arg0 == null) return false;
  if (!(arg0 instanceof Session)) 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());
  Session coll = (Session) arg0;
  return super.equals(arg0) && this.getAttachedScopes().equals(coll.getAttachedScopes())
      && this.getAttachedScopes().equals(coll.getAttachedScopes())
      && this.getSessionState().equals(coll.getSessionState());
}
origin: apache/stanbol

    "Failed to create OntoNet session. The Refactor Engine requires its own new session to execute.");
log.debug("Refactor enhancement job will run in session '{}'.", session.getID());
  session.addOntology(new GraphSource(signaturesGraph));
  session.addOntology(new GraphSource(metadataGraph));
} catch (UnmodifiableOntologyCollectorException e1) {
  throw new EngineException("Cannot add enhancement graph to OntoNet session for refactoring", e1);
  OWLOntology ontology = session.export(OWLOntology.class, true);
  log.debug("Refactoring recipe IRI is : " + engineConfiguration.getRecipeId());
  for (OWLOntologyID id : session.listManagedOntologies()) {
    try {
      String key = ontologyProvider.getKey(id.getOntologyIRI());
  sessionManager.destroySession(session.getID());
origin: apache/stanbol

  log.debug("Adding ontology from input source {}", src);
  long b4add = System.currentTimeMillis();
  OWLOntologyID key = session.addOntology(src);
  if (key == null || key.isAnonymous()) throw new WebApplicationException(INTERNAL_SERVER_ERROR);
                                     + session.getID() + "/"
                                     + uri));
  else rb = Response.seeOther(URI.create("/ontonet/session/" + session.getID()));
} else if (rb == null) rb = Response.status(INTERNAL_SERVER_ERROR);
  session.addOntology(new StoredOntologySource(OntologyUtils.decode(key)));
rb = Response.seeOther(URI.create("/ontonet/session/" + session.getID()));
  String scid = sc.getID();
  if (!toAppend.contains(scid) && getAppendedScopes().contains(scid)) {
    session.detachScope(scid);
    log.info("Removed scope \"{}\".", scid);
    log.info("Appending scope \"{}\" to session \"{}\".", scid, session.getID());
    session.attachScope(scid);
    log.info("Appended scope \"{}\".", scid);
rb = Response.seeOther(URI.create("/ontonet/session/" + session.getID()));
origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

session.setActive(false); // Restored sessions are inactive at first.
for (OWLOntologyID key : struct.getOntologyKeysForSession(sessionId))
  try {
    session.addOntology(new StoredOntologySource(key));
  } catch (MissingOntologyException ex) {
    log.error(
  session.attachScope(scopeId);
origin: apache/stanbol

src = new GraphContentInputSource(content, mt, ontologyProvider.getStore());
log.debug("SUCCESS parse with media type {}.", mt);
OWLOntologyID key = session.addOntology(src);
if (key == null || key.isAnonymous()) {
  log.error("FAILED parse with media type {}.", mt);
log.debug("SUCCESS add ontology to session {}.", session.getID());
log.debug("Storage key : {}", key);
origin: apache/stanbol

  @POST
  @Produces({WILDCARD})
  public Response emptyPost(@PathParam("id") String sessionId, @Context HttpHeaders headers) {
    log.debug(" post(no data)");
    session = sesMgr.getSession(sessionId);
    for (Scope sc : getAllScopes()) { // First remove appended scopes not in the list
      String scid = sc.getID();
      if (getAppendedScopes().contains(scid)) {
        session.detachScope(scid);
        log.info("Removed scope \"{]\".", scid);
      }
    }
    ResponseBuilder rb = Response.ok();
//        addCORSOrigin(servletContext, rb, headers);
    return rb.build();
  }

origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

    .addOntologyCollectorListener((OntologyCollectorListener) ontologyProvider);
if (ontologyProvider instanceof SessionListener) session
    .addSessionListener((SessionListener) ontologyProvider);
session.addOntologyCollectorListener(multiplexer);
session.addSessionListener(multiplexer);
  policy = ConnectivityPolicy.valueOf(_CONNECTIVITY_POLICY_DEFAULT);
session.setConnectivityPolicy(policy);
origin: apache/stanbol

  /**
   * Tells the session that it should manage the ontology obtained by dereferencing the supplied IRI.<br>
   * <br>
   * Note that the PUT method cannot be used, as it is not possible to predict what ID the ontology will
   * have until it is parsed.
   * 
   * @param content
   *            the ontology physical IRI
   * @return {@link Status#OK} if the addition was successful, {@link Status#NOT_FOUND} if there is no such
   *         session at all, {@link Status#FORBIDDEN} if the session is locked or cannot modified for some
   *         other reason, {@link Status#INTERNAL_SERVER_ERROR} if some other error occurs.
   */
  @POST
  @Consumes(value = MediaType.TEXT_PLAIN)
  public Response manageOntology(String iri, @PathParam("id") String sessionId, @Context HttpHeaders headers) {

    session = sesMgr.getSession(sessionId);
    if (session == null) return Response.status(NOT_FOUND).build();
    try {
      session.addOntology(new RootOntologySource(IRI.create(iri)));
    } catch (UnmodifiableOntologyCollectorException e) {
      throw new WebApplicationException(e, FORBIDDEN);
    } catch (OWLOntologyCreationException e) {
      throw new WebApplicationException(e, INTERNAL_SERVER_ERROR);
    }
    ResponseBuilder rb = Response.ok();
//        addCORSOrigin(servletContext, rb, headers);
    return rb.build();
  }

origin: apache/stanbol

public SortedSet<String> getOntologies() {
  SortedSet<String> result = new TreeSet<String>();
  for (OWLOntologyID id : session.listManagedOntologies())
    result.add(OntologyUtils.encode(id));
  return result;
}
origin: apache/stanbol

public Set<Scope> getAppendableScopes() {
  Set<Scope> notAppended = new HashSet<Scope>();
  for (Scope sc : onMgr.getRegisteredScopes())
    if (!session.getAttachedScopes().contains(sc.getID())) notAppended.add(sc);
  return notAppended;
}
origin: apache/stanbol

session.setActive(false); // Restored sessions are inactive at first.
for (OWLOntologyID key : struct.getOntologyKeysForSession(sessionId))
  try {
    session.addOntology(new StoredOntologySource(key));
  } catch (MissingOntologyException ex) {
    log.error(
  session.attachScope(scopeId);
origin: apache/stanbol

@Override
public void scopeUnregistered(Scope scope) {
  for (String sid : getRegisteredSessionIDs())
    getSession(sid).detachScope(scope.getID());
}
origin: apache/stanbol

    .addOntologyCollectorListener((OntologyCollectorListener) ontologyProvider);
if (ontologyProvider instanceof SessionListener) session
    .addSessionListener((SessionListener) ontologyProvider);
session.addOntologyCollectorListener(multiplexer);
session.addSessionListener(multiplexer);
  policy = ConnectivityPolicy.valueOf(_CONNECTIVITY_POLICY_DEFAULT);
session.setConnectivityPolicy(policy);
origin: apache/stanbol

public SortedSet<String> getManageableOntologies() {
  SortedSet<String> result = new TreeSet<String>();
  for (OWLOntologyID id : ontologyProvider.listPrimaryKeys())
    result.add(OntologyUtils.encode(id));
  for (OWLOntologyID id : session.listManagedOntologies())
    result.remove(OntologyUtils.encode(id));
  return result;
}
origin: apache/stanbol

public Set<String> getAppendedScopes() {
  Set<String> appended = new HashSet<String>();
  for (Scope sc : onMgr.getRegisteredScopes())
    if (session.getAttachedScopes().contains(sc.getID())) appended.add(sc.getID());
  return appended;
}
origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

protected synchronized void addSession(Session session) {
  sessionsByID.put(session.getID(), session);
}
origin: apache/stanbol

  @GET
  @Produces(value = {RDF_XML, TURTLE, X_TURTLE})
  public Response asOntologyMixed(@PathParam(value = "id") String sessionId,
                  @PathParam("scopeid") String scopeid,
                  @DefaultValue("false") @QueryParam("merge") boolean merge,
                  @Context HttpHeaders headers) {
    session = sesMgr.getSession(sessionId);
    if (session == null) return Response.status(NOT_FOUND).build();
    ResponseBuilder rb;
    IRI prefix = IRI.create(getPublicBaseUri() + "ontonet/session/");
    // Export smaller graphs to OWLOntology due to the more human-readable rendering.
    if (merge) rb = Response.ok(session.export(ImmutableGraph.class, merge, prefix));
    else rb = Response.ok(session.export(OWLOntology.class, merge, prefix));
//        addCORSOrigin(servletContext, rb, headers);
    return rb.build();
  }

origin: org.apache.stanbol/org.apache.stanbol.ontologymanager.multiplexer.clerezza

@Override
public void scopeDeactivated(Scope scope) {
  for (String sid : getRegisteredSessionIDs())
    getSession(sid).detachScope(scope.getID());
}
org.apache.stanbol.ontologymanager.servicesapi.sessionSession

Javadoc

An ontology collector that can be used by client applications to store volatile data, e.g. for the duration of a service call. It has an aggressive severance policy and tries to delete as many managed ontologies as possible when it goes down.

Note that sessions are generally disjoint with HTTP sessions or the like, but can be used in conjunction with them, or manipulated to mimic their behaviour.

Most used methods

  • addOntology
  • export
  • getID
  • attachScope
    Instructs the session to reference the supplied ontology scope. This way, whenever session data are
  • detachScope
    Instructs the session to no longer reference the supplied ontology scope. If a scope with the suppli
  • getAttachedScopes
    Gets the identifiers of the scopes currently attached to this session.
  • listManagedOntologies
  • addOntologyCollectorListener
  • addSessionListener
  • close
    Closes this Session irreversibly. Most likely includes setting the state to ZOMBIE.
  • getOntology
  • getSessionState
    Returns the current state of this KReS session.
  • getOntology,
  • getSessionState,
  • hasOntology,
  • removeOntology,
  • setActive,
  • setConnectivityPolicy

Popular in Java

  • Making http post requests using okhttp
  • setContentView (Activity)
  • getExternalFilesDir (Context)
  • putExtra (Intent)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • JList (javax.swing)
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now