Package org.openrdf.sesame.repository.local

Examples of org.openrdf.sesame.repository.local.LocalRepository


   * @see org.corrib.s3b.mbb.service.MBBService#execute()
   */
  @Override
  public LocalRepository execute(LocalRepository inGraph) {

    LocalRepository lr = RepositoryFactory.getServiceRepository(this.getUri());
   
    try {
      if(lr.getGraph().getStatements().hasNext())
        return lr;//it means that we already invoked this query
    } catch (AccessDeniedException e) {
      Repository.logger.warning(e.toString());
    }
   
   
   
    String squery = this.params.get(1);
    KeywordQueryFilter values = new KeywordQueryFilter(squery);
   
    String rdfquery = values.process(RDFQuery.RDFQ_SEARCH_KEYWORD.toString(), this.isIgnoreCase());

    Value[] avalues = SesameWrapper.performVectorQuery(inGraph, QueryLanguage.SERQL, rdfquery);
    try {
      SesameWrapper.loadResources(avalues, Repository.MAIN_REPOSITORY.getLocalRepository(), lr.getGraph());
    } catch (AccessDeniedException e) {
      e.printStackTrace();
    }
    this.annotateResults(lr, avalues);

View Full Code Here


   * @param conceptsFileName relative path to the file with definitio nof the concepts
   * @param property
   */
  protected final void initilize(String conceptsFileName, MultiBeeBrowseRDF property) {
    String path2N3 = ContextKeeper.getInstallDir() + conceptsFileName;
    LocalRepository tmprep = RepositoryFactory.createTempRepository();
    //getting predefined properties
    try {
      File f = new File(path2N3);
      tmprep.addData(f, "", RDFFormat.NTRIPLES, false, new StdOutAdminListener());
    } catch (FileNotFoundException e) {
      Repository.logger.severe("predefined properties file not found"+e);
    } catch (IOException e) {
      Repository.logger.severe("predefined properties file IO problem"+e);
    } catch (AccessDeniedException e) {
      Repository.logger.severe("access denied predefined properties file"+e);
    }
   
    StatementIterator stmtit = null;
    try {
      stmtit = tmprep.getGraph().getStatements();
    } catch (AccessDeniedException e) {
      Repository.logger.severe("access denied to temporal graph"+e);
    }
    Graph g = null;
    try {
View Full Code Here

   * @param conceptsFileName relative path to the file with definitio nof the concepts
   * @param property
   */
  protected final void initilize(String conceptsFileName, MultiBeeBrowseRDF property) {
    String path2N3 = ContextKeeper.getInstallDir() + conceptsFileName;
    LocalRepository tmprep = RepositoryFactory.createTempRepository();
    //getting predefined properties
    try {
      File f = new File(path2N3);
      tmprep.addData(f, "", RDFFormat.NTRIPLES, false, new StdOutAdminListener());
    } catch (FileNotFoundException e) {
      Repository.logger.severe("predefined properties file not found"+e);
    } catch (IOException e) {
      Repository.logger.severe("predefined properties file IO problem"+e);
    } catch (AccessDeniedException e) {
      Repository.logger.severe("access denied predefined properties file"+e);
    }
   
    StatementIterator stmtit = null;
    try {
      stmtit = tmprep.getGraph().getStatements();
    } catch (AccessDeniedException e) {
      Repository.logger.severe("access denied to temporal graph"+e);
    }
    Graph g = null;
    try {
View Full Code Here

   *
   * @see org.corrib.s3b.mbb.service.MBBService#execute()
   */
  @Override
  public LocalRepository execute(LocalRepository inGraph) {
    LocalRepository lr = RepositoryFactory.createTempRepository();
    String url = ConfigKeeper.getServiceUrl()+"/context/"+this.getParams().get(1);
    List<Integer> _usedPath = new ArrayList<Integer>();
    String _user = this.getSUser();

    try {
View Full Code Here

   */
  protected void removeAction(String url, LocalRepository lr, List<Integer> _usedPath) throws AccessDeniedException{
    String spathAxis = this.getParams().get(2);
    AxisPath axisPath = new AxisPath(spathAxis);
   
    LocalRepository globalLr = Repository.MAIN_REPOSITORY.getLocalRepository();
   
    Graph g = lr.getGraph();
    ValueFactory vf = g.getValueFactory();
    URI context = vf.createURI(url);
   
    Graph g1 = SesameUtils.getEmptyGraph();
    Graph g2 = SesameUtils.getEmptyGraph();
   
    axisPath.getLastOnList(globalLr, context, g1, true, _usedPath);
    axisPath.getLastOnList(globalLr, context, g2, false, _usedPath);
   
    g1.remove(g2);
   
    globalLr.getGraph().remove(g1);
   
    lr.getGraph().clear();

 
  }
View Full Code Here

   */
  protected void loadAction(String url, LocalRepository lr, List<Integer> _usedPath) throws AccessDeniedException{
    String spathAxis = this.getParams().get(2);
    AxisPath axisPath = new AxisPath(spathAxis);
   
    LocalRepository globalLr = Repository.MAIN_REPOSITORY.getLocalRepository();
   
    Graph g = lr.getGraph();
    ValueFactory vf = g.getValueFactory();
    URI context = vf.createURI(url);
    Resource action = axisPath.getLastOnList(globalLr, context, lr.getGraph(), true, _usedPath);
View Full Code Here

    String serviceId = this.getRequestParams().getValueS("action");
    String serviceUri = ServiceById.getServiceUriById(serviceId);
    String spathAxis = this.getParams().get(2);
    AxisPath axisPath = new AxisPath(spathAxis);
   
    LocalRepository globalLr = Repository.MAIN_REPOSITORY.getLocalRepository();
   
    if(serviceUri == null)
      serviceUri = ConfigKeeper.getServiceUrl()+"/mbb/service/"+serviceId;

    Graph g = lr.getGraph();
    ValueFactory vf = g.getValueFactory();

    URI xsdString = XSD_STRING.getURI(g);
    URI xsdDateTime = XSD_DATETIME.getURI(g);
    URI xsdInt = XSD_INT.getURI(g);
    URI rdfType = vf.createURI(RDF.TYPE);
    URI context = vf.createURI(url);
    URI call = vf.createURI(serviceUri);
   
   
    String actionUri = url+"/action/";
    Resource lastAction = null;
   
   
    // --------------- BEGIN : to be removed -------------------------
//    if(axisPath.isInitial()) {
//      lastAction = AxisPath.getLastAction(globalLr, context, _usedPath);
//      if(lastAction != null)
//        _usedPath.add(0);
//    } else {
//      ///--- follows along axis
//      LocalRepository lr2 = Repository.TEMP_REPOSITORY.getLocalRepository();
//      lastAction =  axisPath.getLastOnList(globalLr, context, lr2.getGraph(), false, _usedPath);
//
//      //--inferr isFollowedBy properties
//      Graph ginf = SesameWrapper.performGraphQuery(lr2, QueryLanguage.SERQL, RDFQuery.RDFQ_INFER_ISFOLLOWEDBY.toString());
//      lr2.getGraph().add(ginf);
//    }
//   
//   
//    URI action = vf.createURI(actionUri+AxisPath.pathToString(_usedPath));
//   
//    if(globalg.contains(action,
//                globalg.getValueFactory().createURI(RDF.TYPE),
//                MBB_BROWSEACTION.getURI(globalg))) {
//      lastAction = AxisPath.getLastAction(globalLr, context, _usedPath);
//      if(lastAction != null)
//        _usedPath.add(0);
//      action = vf.createURI(actionUri+AxisPath.pathToString(_usedPath));
//    }
    // --------------- END : to be removed -------------------------
   
    Graph globalg = globalLr.getGraph();
    boolean isGetLastAction = false;
   
    //--A
    if(axisPath.isInitial()) //--A.1
      isGetLastAction = true;
    else {//--A.2
      LocalRepository lr2 = RepositoryFactory.createTempRepository();
      lastAction =  axisPath.getLastOnList(globalLr, context, lr2.getGraph(), false, _usedPath);

      //--inferr isFollowedBy properties
      Graph ginf = SesameWrapper.performGraphQuery(lr2, QueryLanguage.SERQL, RDFQuery.RDFQ_INFER_ISFOLLOWEDBY.toString());
      lr2.getGraph().add(ginf);

      //--B
      if((axisPath.getPath().size() - 1) == _usedPath.size())//--B.1
        _usedPath.add(axisPath.getPath().get(axisPath.getPath().size()-1));
      else if(lastAction != null){//--B.2
        StatementIterator stit = lr2.getGraph().getStatements(lastAction, MultiBeeBrowseRDF.MBB_ISFOLLOWEDSALONGAXIS.getURI(lr2.getGraph()), null);
        Set<Integer> saxis = new HashSet<Integer>();
       
        while(stit.hasNext()) {
          saxis.add(Integer.parseInt(((Literal)stit.next().getObject()).getLabel()));
        }
View Full Code Here

public class ConjunctionCombineService extends CombineService {


  @Override
  public LocalRepository execute(LocalRepository inGraph) {
    LocalRepository lr = RepositoryFactory.getServiceRepository(this.getUri());
   
    try {
      if(lr.getGraph().getStatements().hasNext())
        return lr;//it means that we already invoked this query
    } catch (AccessDeniedException e) {
      Repository.logger.warning(e.toString());
    }
   
    //otherwise we need to execute the query
    String service1Id = this.params.get(2);
    String service2Id = this.params.get(3);
   
    LocalRepository lr1 = ServiceById.getRepositoryByServiceId(service1Id);
    LocalRepository lr2 = ServiceById.getRepositoryByServiceId(service2Id);
   
    Value[] av1 = SesameWrapper.performVectorQuery(lr1, RDFQuery.RDFQ_LIST_RESOURCES);
    Value[] av2 = SesameWrapper.performVectorQuery(lr2, RDFQuery.RDFQ_LIST_RESOURCES);
   
    Set<Value> sAv = new HashSet<Value>();
View Full Code Here

   *
   * @see org.corrib.s3b.mbb.service.MBBService#execute()
   */
  @Override
  public LocalRepository execute(LocalRepository inGraph) {
    LocalRepository lr = RepositoryFactory.createTempRepository();
    String suser = URLDecode.decode(this.getParams().get(2));
    String serviceId = this.getParams().get(1);

   
   
View Full Code Here

  public LocalRepository execute(LocalRepository inGraph) {

    String sQL = this.params.get(1);
    String squery = this.params.get(2);
    QueryLangs ql = QueryLangs.valueOf(sQL);
    LocalRepository lr = RepositoryFactory.getServiceRepository(this.getUri());
   
    try {
      if(lr.getGraph().getStatements().hasNext())
        return lr;//it means that we already invoked this query
    } catch (AccessDeniedException e) {
      Repository.logger.warning(e.toString());
    }
   
   
    if(ql != null && ql.getQL()!=null) {
      try {
        String query = URLDecoder.decode(squery, "UTF-8");
        Graph g = SesameWrapper.performGraphQuery(inGraph, ql.getQL(), query);
        lr.addGraph(g);
      } catch (UnsupportedEncodingException e1) {
        e1.printStackTrace();
      } catch (IOException e) {
        Repository.logger.warning("Could not add graph results: "+e);
      } catch (AccessDeniedException e) {
View Full Code Here

TOP

Related Classes of org.openrdf.sesame.repository.local.LocalRepository

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.