Package org.openrdf.sail.memory.model

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


  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


        Value obj = getConstantValue(sp.getObjectVar());
        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) {
View Full Code Here

    if (subj != null && memSubj == null) {
      // non-existent subject
      return new EmptyCursor<MemStatement>();
    }

    MemURI memPred = vf.getMemURI(pred);
    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;
      }
    }

View Full Code Here

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

          MemResource subj = st.getSubject();
          if (processedSubjects.add(subj)) {
            subj.cleanSnapshotsFromSubjectStatements(currentSnapshot);
          }

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

          MemValue obj = st.getObject();
          if (processedObjects.add(obj)) {
            obj.cleanSnapshotsFromObjectStatements(currentSnapshot);
View Full Code Here

    if (subj != null && memSubj == null) {
      // non-existent subject
      return new EmptyIteration<MemStatement, X>();
    }

    MemURI memPred = valueFactory.getMemURI(pred);
    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;
      }
    }

View Full Code Here

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

  private static void readStatement(MemoryStore store, boolean hasContext, boolean isExplicit,
      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) {
View Full Code Here

TOP

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

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.