Package com.clarkparsia.pellet.sparqldl.model

Examples of com.clarkparsia.pellet.sparqldl.model.ResultBindingImpl


  }

  public static QueryResult exec(final Query query) {
    if( query.getAtoms().isEmpty() ) {
      final QueryResultImpl results = new QueryResultImpl( query );
      results.add( new ResultBindingImpl() );
      return results;
    }
    query.getKB().ensureConsistency();

    // PREPROCESSING
View Full Code Here


        }

        if( replaceA1 || replaceA2 ) {
          final ResultBinding b;
          if( replaceA1 ) {
            b = new ResultBindingImpl();
            b.setValue( a1, a2 );
          }
          else {
            b = new ResultBindingImpl();
            b.setValue( a2, a1 );
          }
          q = q.apply( b );
          boundSameAs = true;
          break;
View Full Code Here

    final QueryResult result;

    if (schemaQuery.getAtoms().isEmpty()) {
      shouldHaveBinding = false;
      result = new QueryResultImpl(query);
      result.add(new ResultBindingImpl());
    } else {
      if (log.isLoggable( Level.FINE )) {
        log.fine("Executing TBox query: " + schemaQuery);
      }
      result = distCombinedQueryExec.exec(schemaQuery);
View Full Code Here

   */
  public ResultBinding next() {
    if (!more)
      return null;

    final ResultBinding next = new ResultBindingImpl();

    for (int i = 0; i < indices.length; i++) {
      next.setValue(vars.get(i), varB.get(i).get(indices[i]));
    }

    more = incIndex(0);

    return next;
View Full Code Here

    long satCount = kb.getABox().stats.satisfiabilityCount;
    long consCount = kb.getABox().stats.consistencyCount;

    if (q.getDistVars().isEmpty()) {
      if (QueryEngine.execBooleanABoxQuery(q)) {
        results.add(new ResultBindingImpl());
      }
    } else {
      final Map<ATermAppl, Set<ATermAppl>> varBindings = new HashMap<ATermAppl, Set<ATermAppl>>();

      for (final ATermAppl currVar : q
View Full Code Here

    this.kb = q.getKB();

    long satCount = kb.getABox().stats.satisfiabilityCount;
    long consCount = kb.getABox().stats.consistencyCount;

    exec(q, new ResultBindingImpl(), true);

    if (log.isLoggable( Level.FINE )) {
      log.fine("Total satisfiability operations: "
          + (kb.getABox().stats.satisfiabilityCount - satCount));
      log.fine("Total consistency operations: "
View Full Code Here

      this.pellet = pellet;
      this.query = query;
    }

    private ResultBinding convertBinding(Binding binding) {
      ResultBinding pelletBinding = new ResultBindingImpl();
      GraphLoader loader = pellet.getLoader();
      for( Iterator<?> vars = binding.vars(); vars.hasNext(); ) {
        Var var = (Var) vars.next();
        Node value = binding.get( var );
        if( value != null ) {
          ATermAppl pelletVar = ATermUtils.makeVar( var.getVarName() );
          ATermAppl pelletValue = loader.node2term( value );
          pelletBinding.setValue( pelletVar, pelletValue );
        }
      }

      return pelletBinding;
    }
View Full Code Here

    long satCount = kb.getABox().stats.satisfiabilityCount;
    long consCount = kb.getABox().stats.consistencyCount;

    if (q.getDistVars().isEmpty()) {
      if (QueryEngine.execBooleanABoxQuery(q)) {
        results.add(new ResultBindingImpl());
      }
    } else {
      final Map<ATermAppl, Set<ATermAppl>> varBindings = new HashMap<ATermAppl, Set<ATermAppl>>();

      for (final ATermAppl currVar : q
          .getDistVarsForType(VarType.INDIVIDUAL)) {
        ATermAppl rolledUpClass = q.rollUpTo(currVar,
            Collections.EMPTY_SET, false);

        if (log.isLoggable( Level.FINER ))
          log.finer("Rolled up class " + rolledUpClass);
        varBindings.put(currVar, kb.getInstances(rolledUpClass));
      }

      if (log.isLoggable( Level.FINER ))
        log.finer("Var bindings: " + varBindings);

      final List<ATermAppl> varList = new ArrayList<ATermAppl>(
          varBindings.keySet()); // TODO

      final Map<ATermAppl, Collection<ResultBinding>> goodLists = new HashMap<ATermAppl, Collection<ResultBinding>>();

      final ATermAppl first = varList.get(0);
      final Collection<ResultBinding> c = new HashSet<ResultBinding>();

      for (final ATermAppl a : varBindings.get(first)) {
        final ResultBinding bind = new ResultBindingImpl();
        bind.setValue(first, a);
        c.add(bind);
      }

      goodLists.put(first, c);
View Full Code Here

        coreVertices.union( a, atom );
        toRemove.add( atom );
      }
    }

    final Query transformedQuery = query.apply( new ResultBindingImpl() );

    for( final Set<Object> set : coreVertices.getEquivalanceSets() ) {
      final Collection<QueryAtom> atoms = new ArrayList<QueryAtom>();

      for( final Object a : set ) {
View Full Code Here

    Timer timer = new Timer( "CombinedQueryEngine" );
    timer.start();
    prepare( query );
    branches = 0;
    exec( new ResultBindingImpl() );
    timer.stop();

    if( log.isLoggable( Level.FINE ) ) {
      log.log( Level.FINE, "#B=" + branches + ", time=" + timer.getLast() + " ms." );
    }
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellet.sparqldl.model.ResultBindingImpl

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.