Examples of QuerySolution


Examples of com.hp.hpl.jena.query.QuerySolution

           
            // The order of results is undefined.
            System.out.println("Titles: ") ;
            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
               
                // Get title - variable names do not include the '?' (or '$')
                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
                if ( x instanceof Literal )
                {
                    Literal titleStr = (Literal)x  ;
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

            ResultSet rs = qexec.execSelect() ;
           
            // The order of results is undefined.
            for ( ; rs.hasNext() ; )
            {
                QuerySolution rb = rs.nextSolution() ;
               
                // Get title - variable names do not include the '?' (or '$')
                RDFNode x = rb.get("title") ;
               
                // Check the type of the result value
                if ( x.isLiteral() )
                {
                    Literal titleStr = (Literal)x  ;
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

            ResultSet rs = qExec.execSelect() ;
           
            if ( ! rs.hasNext() )
                throw new ARQException("Not found: var ?"+varname) ;

            QuerySolution qs = rs.nextSolution() ;
            RDFNode r = qs.get(varname) ;
            if ( rs.hasNext() )
                throw new ARQException("More than one: var ?"+varname) ;
            return r ;
        } finally { qExec.close() ; }
    }
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

            ResultSet rs = qExec.execSelect() ;
           
            if ( ! rs.hasNext() )
                return null ;

            QuerySolution qs = rs.nextSolution() ;
            RDFNode r = qs.get(varname) ;
            if ( rs.hasNext() )
            {
                QuerySolution qs2 = rs.next();
                RDFNode r2 = qs2.get(varname) ;
                if ( rs.hasNext() )
                    throw new ARQException("More than one: var ?"+varname+ " -> "+r+", "+r2+", ...") ;
                else
                    throw new ARQException("Found two matches: var ?"+varname+ " -> "+r+", "+r2) ;
            }
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

        Query query = QueryFactory.create(preamble+"\n"+qs, Syntax.syntaxARQ) ;
        QueryExecution qexec = QueryExecutionFactory.create(query, model) ;
        ResultSet rs = qexec.execSelect() ;
        for ( ; rs.hasNext() ; )
        {
            QuerySolution soln= rs.next() ;
            Node x = soln.get("x").asNode() ;
            Node y = soln.get("y").asNode() ;
            if ( ! multimap.containsKey(x) )
                multimap.put(x, new ArrayList<Node>()) ;
            multimap.get(x).add(y) ;
        }
    }
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

        // Preparation pass : find the maximum width for each column
        for ( ; rs.hasNext() ; )
        {
            numRows++ ;
            QuerySolution rBind = rs.nextSolution() ;
            int col = -1 ;
            for ( Iterator<String> iter = rs.getResultVars().iterator() ; iter.hasNext() ; )
            {
                col++ ;
                String rVar = iter.next() ;
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

            pw.print('=') ;
        pw.println() ;

        for ( ; resultSetRewindable.hasNext() ; )
        {
            QuerySolution rBind = resultSetRewindable.nextSolution() ;
            for ( int col = 0 ; col < numCols ; col++ )
            {
                String rVar = resultSet.getResultVars().get(col) ;
                row[col] = this.getVarValueAsString(rBind, rVar );
            }
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

    ResultSet results = qe.execSelect();
   
    WDSingleTest one = null;
    Resource last = null;
    while (results.hasNext()) {
      QuerySolution s = results.nextSolution();
      Resource in = s.getResource("in");
      Resource out = s.getResource("out");
      Resource test = s.getResource("test");
     
      Property approval = m.createProperty(
          TestSchema, "approval");
      if (!test.hasProperty(approval))
        System.out.println("#"+test.getLocalName());
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

        QueryExecution qexec = QueryExecutionFactory.create(
            queryString, model);
        try {
          ResultSet results = qexec.execSelect();
          while (results.hasNext()) {
            QuerySolution soln = results.nextSolution();
            try {
              Literal u = soln.getLiteral("user");
//              System.err.println("user: "+u.getString());
              Literal s = soln.getLiteral("software");
//              System.err.println("software: "+s);
              Calendar d = ((XSDDateTime) soln.getLiteral("date")
                  .getValue()).asCalendar();
//              System.err.println("date: "+d);
             
              if (u.getString().equals(user)
                  && s.getString().equals(software)
View Full Code Here

Examples of com.hp.hpl.jena.query.QuerySolution

    VirtuosoQueryExecution vqe = VirtuosoQueryExecutionFactory.create (sparql, _graph);

    ResultSet results = vqe.execSelect();
    System.out.println("RESULT:");
    while (results.hasNext()) {
      QuerySolution result = results.nextSolution();
        RDFNode s = result.get("s");
        RDFNode o = result.get("o");
        System.out.println("  " + s + " " + "skos:exactMatch" + " " + o);
    }
   
    vqe.close();
    _graph.close();
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.