Package org.openrdf.model

Examples of org.openrdf.model.Graph


   * @param serviceCallUri
   * @param serviceId
   */
  public static final void addServiceId(String serviceCallUri, String serviceId) {
    try {
      Graph g = Repository.MAIN_REPOSITORY.getLocalRepository().getGraph();
      g.add(g.getValueFactory().createURI(serviceCallUri), MBB_SERVICEID.getURI(g), g.getValueFactory().createLiteral(serviceId));
    } catch (AccessDeniedException e) {
      Repository.logger.warning("problems when adding service id: "+e);
    }
  }
View Full Code Here


   * @param repo
   * @param results
   */
  protected void annotateResults(LocalRepository repo, Value... results) {
   
    Graph g;
    try {
      g = repo.getGraph();
      URI pisResultOf = MultiBeeBrowseRDF.MBB_ISRESULTOF.getURI(g);
      Resource rcall = g.getValueFactory().createURI(this.getUri());
     
      for(Value result : results)
        if(result instanceof Resource)
        g.add((Resource)result, pisResultOf, rcall);
    } catch (AccessDeniedException e) {
      Repository.logger.warning(e.toString());
    }
   
  }
View Full Code Here

             "type = <http://s3b.corrib.org/mbb#Call> OR " +
             "type = <http://s3b.corrib.org/mbb#BrowseAction> OR " +
             "type = <http://s3b.corrib.org/mbb#BrowseContext>";
   
    LocalRepository lr = Repository.MAIN_REPOSITORY.getLocalRepository();
    Graph g = SesameWrapper.performGraphQuery(lr, QueryLanguage.SERQL, query);
    try {
      lr.removeGraph(g);
    } catch (AccessDeniedException e) {
      e.printStackTrace();
    }
View Full Code Here

   * @throws AccessDeniedException
   * @throws IOException
   */
  protected void removeContext(String url, LocalRepository lr) throws IOException, AccessDeniedException {
   
    Graph g = SesameWrapper.performGraphQuery(Repository.MAIN_REPOSITORY.getLocalRepository(),
          QueryLanguage.SERQL,
          RDFQuery.RDFQ_GET_CONTEXT_FOR_REMOVE.toString(url));
   
    Repository.MAIN_REPOSITORY.getLocalRepository().removeGraph(g);
   
View Full Code Here

   * @param lr
   * @throws AccessDeniedException
   * @throws IOException
   */
  protected void loadContext(String url, LocalRepository lr) throws AccessDeniedException, IOException {
    Graph g = SesameWrapper.performGraphQuery(Repository.MAIN_REPOSITORY.getLocalRepository(),
                          QueryLanguage.SERQL,
                          RDFQuery.RDFQ_GET_CONTEXT.toString(url));
   
    if("true".equals(this.getRequestParams().getValueS("switch")))
      this.getRequestParams().put("contextURI", new FieldValueWrapper(url));
View Full Code Here

      _uri = url+Sha1sum.getInstance().calc(_user+date+RepositoryFactory.RANDOM.nextFloat());
    }
   
    this.getRequestParams().put("contextURI", new FieldValueWrapper(_uri));
   
    Graph g = lr.getGraph();
    ValueFactory vf = g.getValueFactory();
    URI contextUri = vf.createURI(_uri);
    URI xsdString = XSD_STRING.getURI(g);
    URI xsdDateTime = XSD_DATETIME.getURI(g);
   
    g.add(contextUri,
        vf.createURI(RDF.TYPE),
        MBB_BROWSECONTEXT.getURI(g));
   
    g.add(contextUri,
          DC_CREATOR.getURI(g),
          (_user.indexOf("mailto:")==0 ||
           _user.indexOf("user:")==0 ||
           _user.indexOf("ip:")==0)?vf.createURI(_user):vf.createLiteral(_user, xsdString));

    g.add(contextUri,
        MBB_CREATEDATE.getURI(g),
        vf.createLiteral(date, xsdDateTime));
    g.add(contextUri,
        MBB_ACCESSDATE.getURI(g),
        vf.createLiteral(date, xsdDateTime));
    g.add(contextUri,
        MBB_UPDATEDATE.getURI(g),
        vf.createLiteral(date, xsdDateTime));
     
    Repository.MAIN_REPOSITORY.getLocalRepository().addGraph(g);
  }
View Full Code Here

        }

      } // -- if rdfq

      try {
        Graph g = SesameWrapper.performGraphQuery(inGraph, ql, rdfq);
        lr.addGraph(g);
      } catch (UnsupportedEncodingException e1) {
        e1.printStackTrace();
      } catch (IOException e) {
        Repository.logger.warning("Could not add graph results: "+e);
View Full Code Here

  @Override
  public LocalRepository execute(LocalRepository inGraph) {

    String param = (this.params.get(2) == null) ? this.params.get(0) : this.params.get(2);

    Graph g = SesameWrapper.performGraphQuery(inGraph, QueryLanguage.SERQL, RDFQuery.RDFQ_ACCESS_RESOURCE
        .toString("<"+param+">"));
    LocalRepository local = null;

    local = RepositoryFactory.getServiceRepository(this.getUri());
    if (local != null) {
View Full Code Here

   * @param repository
   * @return
   */
  public static Graph getGraph(LocalRepository repository) {
   
    Graph graph = null;
    try {
      graph = repository.getGraph();
    } catch (AccessDeniedException e) {
      e.printStackTrace();
    }
View Full Code Here

   * @param query
   * @return
   */
  public static Graph performGraphQuery(LocalRepository repository, QueryLanguage queryLanguage, String query) {
   
    Graph graph = null;
    try {
      graph = repository.performGraphQuery(queryLanguage, query);
    } catch (Exception e) {
      Repository.logger.warning("Problems with query ["+query+"] "+e);
    }
View Full Code Here

TOP

Related Classes of org.openrdf.model.Graph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.