Package org.apache.stanbol.entityhub.servicesapi.yard

Examples of org.apache.stanbol.entityhub.servicesapi.yard.YardException


    @Override
    public void setAdditionalMappings(FieldMapper fieldMapper) throws YardException {
        Yard yard = getCacheYard();
        if (yard == null) {
            throw new YardException(String.format("The Yard %s for this cache is currently not available", yardId));
        } else {
            setAdditionalMappings(yard, fieldMapper);
        }
    }
View Full Code Here


    @Override
    public void setBaseMappings(FieldMapper fieldMapper) throws YardException {
        Yard yard = getCacheYard();
        if (yard == null) {
            throw new YardException(String.format("The Yard %s for this cache is currently not available", yardId));
        } else {
            if (isAvailable()) {
                FieldMapper old = this.baseMapper;
                this.baseMapper = fieldMapper;
                try {
View Full Code Here

    @Override
    public void remove(Iterable<String> ids) throws IllegalArgumentException, YardException {
        Yard yard = getCacheYard();
        if (yard == null) {
            throw new YardException(String.format("The Yard %s for this cache is currently not available", yardId));
        } else {
            yard.remove(ids);
        }
    }
View Full Code Here

    @Override
    public Iterable<Representation> store(Iterable<Representation> representations) throws IllegalArgumentException, YardException {
        Yard yard = getCacheYard();
        if (yard == null) {
            throw new YardException(String.format("The Yard %s for this cache is currently not available", yardId));
        } else {
            return yard.store(representations);
        }
    }
View Full Code Here

    @Override
    public Iterable<Representation> update(Iterable<Representation> representations) throws YardException, IllegalArgumentException {
        Yard yard = getCacheYard();
        if (yard == null) {
            throw new YardException(String.format("The Yard %s for this cache is currently not available", yardId));
        } else {
            return yard.update(representations);
        }
    }
View Full Code Here

     * @param toStore the Representations to store. This method removes all
     * Elements of this map while doing the work
     */
    private Set<QueueItem<Representation>> store(Map<String,QueueItem<Representation>> toStore) {
        String errorMsg;
        YardException yardException = null;
        Set<QueueItem<Representation>> stored = new HashSet<QueueItem<Representation>>();
        Collection<Representation> reps = new ArrayList<Representation>(toStore.size());
        for(QueueItem<Representation> item:toStore.values()){
            reps.add(item.getItem());
        }
View Full Code Here

            sparqlQuery = (SelectQuery)QueryParser.getInstance().parse(sparqlQueryString);
        } catch (ParseException e) {
            log.error("ParseException for SPARQL Query in findRepresentation");
            log.error("FieldQuery: "+query);
            log.error("SPARQL Query: "+sparqlQueryString);
            throw new YardException("Unable to parse SPARQL query generated for the parse FieldQuery",e);
        } catch (ClassCastException e){
            log.error("ClassCastExeption because parsed SPARQL Query is not of Type "+SelectQuery.class);
            log.error("FieldQuery: "+query);
            log.error("SPARQL Query: "+sparqlQueryString);
            throw new YardException("Unable to parse SPARQL SELECT query generated for the parse FieldQuery",e);
        }
        return tcManager.executeSparqlQuery((SelectQuery)sparqlQuery, graph);
    }
View Full Code Here

            sparqlQuery = QueryParser.getInstance().parse(sparqlQueryString);
        } catch (ParseException e) {
            log.error("ParseException for SPARQL Query in findRepresentation");
            log.error("FieldQuery: "+query);
            log.error("SPARQL Query: "+sparqlQueryString);
            throw new YardException("Unable to parse SPARQL query generated for the parse FieldQuery",e);
        }
        Object resultObject = tcManager.executeSparqlQuery(sparqlQuery, graph);
        final MGraph resultGraph;
        if(resultObject instanceof MGraph){
            resultGraph = (MGraph)resultObject;
        } else if(resultObject instanceof Graph){
            resultGraph = new IndexedMGraph();
            resultGraph.addAll((Graph)resultObject);
        } else {
            log.error("Unable to create "+MGraph.class+" instance for query reults of type "+resultObject.getClass()+" (this indicates that the used SPARQL Query was not of type CONSTRUCT)");
            log.error("FieldQuery: "+query);
            log.error("SPARQL Query: "+sparqlQueryString);
            throw new YardException("Unable to process results of Query");
        }
        return new RdfQueryResultList(query, resultGraph);
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.servicesapi.yard.YardException

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.