Examples of TextIndexException


Examples of org.apache.jena.query.text.TextIndexException

        QueryExecution qexec1 = QueryExecutionFactory.create(query1, model) ;
        ResultSet rs1 = qexec1.execSelect() ;
        List<QuerySolution> results = ResultSetFormatter.toList(rs1) ;
        if ( results.size() == 0 ) {
            //Log.warn(this, "Failed to find a valid EntityMap for : "+root) ;
            throw new TextIndexException("Failed to find a valid EntityMap for : "+root) ;
        }
       
        if ( results.size() !=1 )  {
            Log.warn(this, "Multiple matches for EntityMap for : "+root) ;
            throw new TextIndexException("Multiple matches for EntityMap for : "+root) ;
        }
       
        QuerySolution qsol1 = results.get(0) ;
        String entityField = qsol1.getLiteral("entityField").getLexicalForm() ;
        String graphField = qsol1.contains("graphField") ? qsol1.getLiteral("graphField").getLexicalForm() : null;
        String defaultField = qsol1.contains("dftField") ? qsol1.getLiteral("dftField").getLexicalForm() : null ;
       
        String qs2 = StrUtils.strjoinNL("SELECT * { ?map list:member [ :field ?field ; :predicate ?predicate ] }") ;
        Query query2 = QueryFactory.create(prologue+" "+qs2) ;
        QueryExecution qexec2 = QueryExecutionFactory.create(query2, model, qsol1) ;
        ResultSet rs2 = qexec2.execSelect() ;
        List<QuerySolution> mapEntries = ResultSetFormatter.toList(rs2) ;
       
        MultiMap<String, Node> mapDefs = MultiMap.createMapList() ;
        for ( QuerySolution qsol : mapEntries ) {
            String field =  qsol.getLiteral("field").getLexicalForm() ;
            Resource p = qsol.getResource("predicate") ;
            mapDefs.put(field, p.asNode()) ;
        }
       
        // Primary field/predicate
        if ( defaultField != null ) {
            Collection<Node> c = mapDefs.get(defaultField) ;
            if ( c == null )
                throw new TextIndexException("No definition of primary field '"+defaultField+"'") ;
        }
       
       
        EntityDefinition docDef = new EntityDefinition(entityField, defaultField, graphField) ;
        for ( String f : mapDefs.keys() ) {
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.