Package org.openrdf.sail.memory.model

Examples of org.openrdf.sail.memory.model.MemValue


  private void readStatement(boolean hasContext, boolean isExplicit, DataInputStream dataIn)
    throws IOException, ClassCastException
  {
    MemResource memSubj = (MemResource)readValue(dataIn);
    MemURI memPred = (MemURI)readValue(dataIn);
    MemValue memObj = (MemValue)readValue(dataIn);
    MemResource memContext = null;
    if (hasContext) {
      memContext = (MemResource)readValue(dataIn);
    }
View Full Code Here


        Resource context = (Resource)getConstantValue(sp.getContextVar());

        // Perform look-ups for value-equivalents of the specified values
        MemResource memSubj = vf.getMemResource(subj);
        MemURI memPred = vf.getMemURI(pred);
        MemValue memObj = vf.getMemValue(obj);
        MemResource memContext = vf.getMemResource(context);

        if (subj != null && memSubj == null || pred != null && memPred == null || obj != null
            && memObj == null || context != null && memContext == null)
        {
          // non-existent subject, predicate, object or context
          return 0.0;
        }

        // Search for the smallest list that can be used by the iterator
        List<Integer> listSizes = new ArrayList<Integer>(4);
        if (memSubj != null) {
          listSizes.add(memSubj.getSubjectStatementCount());
        }
        if (memPred != null) {
          listSizes.add(memPred.getPredicateStatementCount());
        }
        if (memObj != null) {
          listSizes.add(memObj.getObjectStatementCount());
        }
        if (memContext != null) {
          listSizes.add(memContext.getContextStatementCount());
        }
View Full Code Here

    if (pred != null && memPred == null) {
      // non-existent predicate
      return new EmptyCursor<MemStatement>();
    }

    MemValue memObj = vf.getMemValue(obj);
    if (obj != null && memObj == null) {
      // non-existent object
      return new EmptyCursor<MemStatement>();
    }

    MemResource[] memContexts;
    MemStatementList smallestList;

    contexts = OpenRDFUtil.notNull(contexts);
    if (contexts.length == 0) {
      memContexts = new MemResource[0];
      smallestList = statements;
    }
    else if (contexts.length == 1 && contexts[0] != null) {
      MemResource memContext = vf.getMemResource(contexts[0]);
      if (memContext == null) {
        // non-existent context
        return new EmptyCursor<MemStatement>();
      }

      memContexts = new MemResource[] { memContext };
      smallestList = memContext.getContextStatementList();
    }
    else {
      Set<MemResource> contextSet = new LinkedHashSet<MemResource>(2 * contexts.length);

      for (Resource context : contexts) {
        MemResource memContext = vf.getMemResource(context);
        if (context == null || memContext != null) {
          contextSet.add(memContext);
        }
      }

      if (contextSet.isEmpty()) {
        // no known contexts specified
        return new EmptyCursor<MemStatement>();
      }

      memContexts = contextSet.toArray(new MemResource[contextSet.size()]);
      smallestList = statements;
    }

    if (memSubj != null) {
      MemStatementList l = memSubj.getSubjectStatementList();
      if (l.size() < smallestList.size()) {
        smallestList = l;
      }
    }

    if (memPred != null) {
      MemStatementList l = memPred.getPredicateStatementList();
      if (l.size() < smallestList.size()) {
        smallestList = l;
      }
    }

    if (memObj != null) {
      MemStatementList l = memObj.getObjectStatementList();
      if (l.size() < smallestList.size()) {
        smallestList = l;
      }
    }

View Full Code Here

    MemURI memPred = vf.getMemURI(pred);
    if (memPred == null) {
      memPred = vf.createMemURI(pred);
      newValueCreated = true;
    }
    MemValue memObj = vf.getMemValue(obj);
    if (memObj == null) {
      memObj = vf.createMemValue(obj);
      newValueCreated = true;
    }
    MemResource memContext = vf.getMemResource(context);
View Full Code Here

          MemURI pred = st.getPredicate();
          if (processedPredicates.add(pred)) {
            pred.cleanSnapshotsFromPredicateStatements(currentSnapshot);
          }

          MemValue obj = st.getObject();
          if (processedObjects.add(obj)) {
            obj.cleanSnapshotsFromObjectStatements(currentSnapshot);
          }

          MemResource context = st.getContext();
          if (context != null && processedContexts.add(context)) {
            context.cleanSnapshotsFromContextStatements(currentSnapshot);
View Full Code Here

    if (pred != null && memPred == null) {
      // non-existent predicate
      return new EmptyIteration<MemStatement, X>();
    }

    MemValue memObj = valueFactory.getMemValue(obj);
    if (obj != null && memObj == null) {
      // non-existent object
      return new EmptyIteration<MemStatement, X>();
    }

    MemResource[] memContexts;
    MemStatementList smallestList;

    if (contexts.length == 0) {
      memContexts = new MemResource[0];
      smallestList = statements;
    }
    else if (contexts.length == 1 && contexts[0] != null) {
      MemResource memContext = valueFactory.getMemResource(contexts[0]);
      if (memContext == null) {
        // non-existent context
        return new EmptyIteration<MemStatement, X>();
      }

      memContexts = new MemResource[] { memContext };
      smallestList = memContext.getContextStatementList();
    }
    else {
      Set<MemResource> contextSet = new LinkedHashSet<MemResource>(2 * contexts.length);

      for (Resource context : contexts) {
        MemResource memContext = valueFactory.getMemResource(context);
        if (context == null || memContext != null) {
          contextSet.add(memContext);
        }
      }

      if (contextSet.isEmpty()) {
        // no known contexts specified
        return new EmptyIteration<MemStatement, X>();
      }

      memContexts = contextSet.toArray(new MemResource[contextSet.size()]);
      smallestList = statements;
    }

    if (memSubj != null) {
      MemStatementList l = memSubj.getSubjectStatementList();
      if (l.size() < smallestList.size()) {
        smallestList = l;
      }
    }

    if (memPred != null) {
      MemStatementList l = memPred.getPredicateStatementList();
      if (l.size() < smallestList.size()) {
        smallestList = l;
      }
    }

    if (memObj != null) {
      MemStatementList l = memObj.getObjectStatementList();
      if (l.size() < smallestList.size()) {
        smallestList = l;
      }
    }

View Full Code Here

    MemURI memPred = valueFactory.getMemURI(pred);
    if (memPred == null) {
      memPred = valueFactory.createMemURI(pred);
      newValueCreated = true;
    }
    MemValue memObj = valueFactory.getMemValue(obj);
    if (memObj == null) {
      memObj = valueFactory.createMemValue(obj);
      newValueCreated = true;
    }
    MemResource memContext = valueFactory.getMemResource(context);
View Full Code Here

      DataInputStream dataIn)
    throws IOException, ClassCastException
  {
    MemResource memSubj = (MemResource)readValue(store, dataIn);
    MemURI memPred = (MemURI)readValue(store, dataIn);
    MemValue memObj = (MemValue)readValue(store, dataIn);
    MemResource memContext = null;
    if (hasContext) {
      memContext = (MemResource)readValue(store, dataIn);
    }
View Full Code Here

        MemValueFactory valueFactory = store.getValueFactory();

        // Perform look-ups for value-equivalents of the specified values
        MemResource memSubj = valueFactory.getMemResource(subj);
        MemURI memPred = valueFactory.getMemURI(pred);
        MemValue memObj = valueFactory.getMemValue(obj);
        MemResource memContext = valueFactory.getMemResource(context);

        if (subj != null && memSubj == null || pred != null && memPred == null || obj != null
            && memObj == null || context != null && memContext == null)
        {
          // non-existent subject, predicate, object or context
          cardinality = 0;
          return;
        }

        // Search for the smallest list that can be used by the iterator
        List<Integer> listSizes = new ArrayList<Integer>(4);
        if (memSubj != null) {
          listSizes.add(memSubj.getSubjectStatementCount());
        }
        if (memPred != null) {
          listSizes.add(memPred.getPredicateStatementCount());
        }
        if (memObj != null) {
          listSizes.add(memObj.getObjectStatementCount());
        }
        if (memContext != null) {
          listSizes.add(memContext.getContextStatementCount());
        }
View Full Code Here

TOP

Related Classes of org.openrdf.sail.memory.model.MemValue

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.