Package org.trippi

Examples of org.trippi.TupleIterator


                logger.warn("RI query language " + queryLang + " is not supported");
                return res;
            }
            // FIXME: should we limit?
            try {
                TupleIterator tuples = RI.findTuples(queryLang, query, 0, true);
                if (tuples != null) {
                    while (tuples.hasNext()) {
                        Map<String, Node> tuple = tuples.next();
                        Node variableValue = tuple.get(variable);
                        if (variableValue != null) {
                            res.add(variableValue.stringValue());
                        } else {
                            logger.error("Attribute query does not contain a result variable " + variable);
View Full Code Here


                query = getSPARQLQuery(pidUri);
            }

            logger.debug(lang + " query: " + query);

            TupleIterator tuples;
            try {
                tuples = RI.findTuples(lang, query,0, false);
                if (tuples != null) {
                    while (tuples.hasNext()) {
                        Node parent = tuples.next().get("parent");
                        if (parent != null) {
                            if (parent.isURIReference()) {
                                try {
                                    PID parentPID = new PID(parent.stringValue());
                                    logger.debug("Found parent " + parentPID.toString());
                                    parentPIDs.add(parentPID.toString());
                                } catch (MalformedPIDException e) {
                                    logger.warn("parent/child relationship target is not a Fedora object" + parent.stringValue());
                                }
                            } else {
                                logger.warn("parent/child query result is not a Fedora object " + parent.stringValue());
                            }
                        } else {
                            logger.error("parent/child tuple result did not contain parent variable");
                        }
                    }
                    logger.debug("Query result count: " + tuples.count());

                } else {
                    logger.debug("Query returned 0 results");
                }
View Full Code Here

                    "select $date " + "from <#ri> " + "where <" + locator
                            + "> <" + VIEW.LAST_MODIFIED_DATE.uri + "> $date";
            Map<String, String> map = new HashMap<String, String>();
            map.put("lang", "itql");
            map.put("query", query);
            TupleIterator tuples = getTuples(map);
            try {
                if (tuples.hasNext()) {
                    Map<String, Node> row = tuples.next();
                    Literal dateLiteral = (Literal) row.get("date");
                    if (dateLiteral == null) {
                        throw new IOException("A row was returned, but it did not contain a 'date' binding");
                    }
                    return DateUtility.parseDateLoose(dateLiteral
                            .getLexicalForm());
                } else {
                    throw new IOException("No rows were returned");
                }
            } catch (TrippiException e) {
                throw new IOException(e.getMessage());
            } finally {
                try {
                    tuples.close();
                } catch (Exception e) {
                }
            }
        } else {
            HttpClient client = getHttpClient();
View Full Code Here

TOP

Related Classes of org.trippi.TupleIterator

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.