Examples of TupleQuery


Examples of org.openrdf.query.TupleQuery

    private TupleQueryResult executeSparqlFieldQuery(RepositoryConnection con, final SparqlFieldQuery fieldQuery, int limit, boolean select) throws RepositoryException, YardException, QueryEvaluationException {
        log.debug("> execute FieldQuery: {}", fieldQuery);
        String sparqlQueryString = SparqlQueryUtils.createSparqlSelectQuery(
            fieldQuery, select, limit, SparqlEndpointTypeEnum.Sesame);
        log.debug(" - SPARQL Query: {}", sparqlQueryString);
        TupleQuery sparqlOuery;
        try {
            sparqlOuery = con.prepareTupleQuery(QueryLanguage.SPARQL, sparqlQueryString);
        } catch (MalformedQueryException e) {
            log.error("Unable to pparse SPARQL Query generated for a FieldQuery");
            log.error("FieldQuery: {}",fieldQuery);
            log.error("SPARQL Query: {}",sparqlQueryString);
            log.error("Exception ", e);
            throw new YardException("Unable to parse SPARQL query generated for the parse FieldQuery", e);
        } catch (UnsupportedQueryTypeException e) {
            String message = "The Sesame Repository '" + repository + "'(class: "
                    + repository.getClass().getName() + ") does not support SPARQL!";
            log.error(message, e);
            throw new YardException(message, e);
        }
        if(dataset != null){ //respect the configured contexts
            sparqlOuery.setDataset(dataset);
        }
        return sparqlOuery.evaluate();
    }
View Full Code Here

Examples of org.openrdf.query.TupleQuery

            throws ProjectDaoException {
        Set<Project> projects = new HashSet<Project>();
        TupleQueryResult result = null;
        try
        {
            TupleQuery tupleQuery = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, projectQuery );
            result = tupleQuery.evaluate();
            while ( result.hasNext() )
            {
                BindingSet set = result.next();

                String groupId = set.getBinding( ProjectUri.GROUP_ID.getObjectBinding() ).getValue().toString();
View Full Code Here

Examples of org.openrdf.query.TupleQuery

        TupleQueryResult result = null;

        try
        {
            TupleQuery tupleQuery = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, projectQuery );
            tupleQuery.setBinding( ProjectUri.GROUP_ID.getObjectBinding(), valueFactory.createLiteral( groupId ) );
            tupleQuery.setBinding( ProjectUri.ARTIFACT_ID.getObjectBinding(), valueFactory.createLiteral( artifactId ) );
            tupleQuery.setBinding( ProjectUri.VERSION.getObjectBinding(), valueFactory.createLiteral( version ) );
            tupleQuery.setBinding( ProjectUri.ARTIFACT_TYPE.getObjectBinding(),
                                   valueFactory.createLiteral( artifactType ) );

            if ( publicKeyTokenId != null )
            {
                tupleQuery.setBinding( ProjectUri.CLASSIFIER.getObjectBinding(),
                                       valueFactory.createLiteral( publicKeyTokenId ) );
                project.setPublicKeyTokenId( publicKeyTokenId.replace( ":", "" ) );
            }

            result = tupleQuery.evaluate();

            if ( !result.hasNext() )
            {
               
                //if ( artifactType != null && ArtifactTypeHelper.isDotnetAnyGac( artifactType ) )
View Full Code Here

Examples of org.openrdf.query.TupleQuery

    private void addClassifiersToProject( Project project, RepositoryConnection repositoryConnection,
                                          Value classifierUri )
        throws RepositoryException, MalformedQueryException, QueryEvaluationException
    {
        String query = "SELECT * FROM {x} p {y}";
        TupleQuery tq = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, query );
        tq.setBinding( "x", classifierUri );
        TupleQueryResult result = tq.evaluate();

        while ( result.hasNext() )
        {
            BindingSet set = result.next();
            for ( Iterator<Binding> i = set.iterator(); i.hasNext(); )
View Full Code Here

Examples of org.openrdf.query.TupleQuery

    private void addDependenciesToProject( Project project, RepositoryConnection repositoryConnection,
                                           Value dependencyUri )
        throws RepositoryException, MalformedQueryException, QueryEvaluationException
    {
        TupleQuery tq = repositoryConnection.prepareTupleQuery( QueryLanguage.SERQL, dependencyQuery );
        tq.setBinding( "x", dependencyUri );
        TupleQueryResult dependencyResult = tq.evaluate();
        try
        {
            while ( dependencyResult.hasNext() )
            {
                ProjectDependency projectDependency = new ProjectDependency();
View Full Code Here

Examples of org.openrdf.query.TupleQuery

          try {
              SailRepositoryConnection connection = (SailRepositoryConnection)
                  database.getRepository().getConnection();
             
              try {
                  TupleQuery query = _builder.makeTupleQuery(_itemVar, connection);
                  TupleQueryResult queryResult = query.evaluate();
                  try {
                      while (queryResult.hasNext()) {
                          BindingSet bindingSet = queryResult.next();
                          Value v = bindingSet.getValue(_itemVar.getName());
                          if (v instanceof URI) {
View Full Code Here

Examples of org.openrdf.query.TupleQuery

                "} " +
                "GROUP BY ?c1 ?p ?c2";

        System.out.println(queryString);

        TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
        TupleQueryResult result = tupleQuery.evaluate();
        try {
          while (result.hasNext()) {
            BindingSet bindingSet = result.next();
            Value valueOfC1 = bindingSet.getValue("c1");
            Value valueOfP = bindingSet.getValue("p");
View Full Code Here

Examples of org.openrdf.query.TupleQuery

                "} " +
                "GROUP BY ?c ?p";

        System.out.println(queryString);

        TupleQuery tupleQuery = con.prepareTupleQuery(QueryLanguage.SPARQL, queryString);
        TupleQueryResult result = tupleQuery.evaluate();
        try {
          while (result.hasNext()) {
            BindingSet bindingSet = result.next();
            Value valueOfC = bindingSet.getValue("c");
            Value valueOfP = bindingSet.getValue("p");
View Full Code Here

Examples of org.openrdf.query.TupleQuery

                  Projection projection = new Projection(group, projectionElements);
                  Order order = "value".equals(_sortMode) ?
                      new Order(projection, new OrderElem(_valueVar, "forward".equals(_sortDirection))) :
                      new Order(projection, new OrderElem(_countVar, !"forward".equals(_sortDirection)));
                 
                  TupleQuery query = new MyTupleQuery(new ParsedTupleQuery(order), connection);
                  TupleQueryResult queryResult = query.evaluate();
                  try {
                    return createComponentState(queryResult);
                  } finally {
                      queryResult.close();
                  }
View Full Code Here

Examples of org.openrdf.query.TupleQuery

              // TODO[dfhuynh]: This happens if the expression is just "value". I'm not sure what to do here.
              return null;
            }
           
            Projection projection = new Projection(t, projectionElements);
            TupleQuery query = new MyTupleQuery(new ParsedTupleQuery(projection), connection);
           
            return new ExpressionQueryResult(query, expressionResult.valueType, resultVar);
        }
        return null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.