org.openrdf.model.Model.isEmpty()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.openrdf.model.Model.isEmpty()方法的一些代码示例,展示了Model.isEmpty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.isEmpty()方法的具体详情如下:
包路径:org.openrdf.model.Model
类名称:Model
方法名:isEmpty

Model.isEmpty介绍

暂无

代码示例

代码示例来源:origin: org.openrdf.sesame/sesame-sail-base

private CloseableIteration<? extends Statement, SailException> difference(
    CloseableIteration<? extends Statement, SailException> result, final Model excluded)
{
  if (excluded.isEmpty()) {
    return result;
  }
  return new FilterIteration<Statement, SailException>(result) {
    protected boolean accept(Statement stmt) {
      return !excluded.contains(stmt);
    }
  };
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

private boolean conflicts(Model added, Model removed, OptimisticSail sail) {
  try {
    for (EvaluateOperation op : evaluateOps) {
      if (!added.isEmpty() && sail.effects(added, op))
        return true;
      if (!removed.isEmpty() && sail.effects(removed, op))
        return true;
    }
    return false;
  } catch (SailException e) {
    logger.error(e.toString(), e);
    return true;
  }
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

private synchronized Model open(Model filtered) {
  Model model;
  if (additional == null) {
    model = new MemoryOverflowModel(filtered);
  } else {
    model = filtered;
  }
  if (model.isEmpty())
    return new LinkedHashModel();
  return model;
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

synchronized void prepare(OptimisticConnection prepared)
    throws InterruptedException, SailException {
  while (preparedLock != null && preparedLock.isActive()) {
    wait();
  }
  assert transactions.containsKey(prepared);
  preparedLock = preparing.getWriteLock();
  this.prepared = prepared;
  synchronized (prepared) {
    Model added = prepared.getAddedModel();
    Model removed = prepared.getRemovedModel();
    if (added.isEmpty() && removed.isEmpty())
      return;
    for (OptimisticConnection con : transactions.keySet()) {
      if (con == prepared)
        continue;
      con.changed(added, removed);
    }        
  }
}

代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-r2rml

/**
 * method to find the triplesmap node referenced in a parent join condition
 * 
 * @param myModel
 *            - the Model of mappings
 * @param predobjNode
 *            - the pred obj node containing the join condition
 * @return the Resource node refferred to in the condition
 */
public Resource getReferencedTripleMap(Model myModel, Resource predobjNode) {
  // process OBJECTMAP
  Model m = myModel.filter(predobjNode, R2RMLVocabulary.objectMap, null);
  if (!m.isEmpty()) {
    Resource object = m.objectResource();
    // look for parentTriplesMap declaration
    m = myModel.filter(object, R2RMLVocabulary.parentTriplesMap, null);
    if (!m.isEmpty()) {
      return m.objectResource();
    }
  }
  return null;
}

代码示例来源:origin: org.openrdf.sesame/sesame-sail-base

private CloseableIteration<? extends Statement, SailException> union(
    CloseableIteration<? extends Statement, SailException> result, Model included)
{
  if (included.isEmpty()) {
    return result;
  }
  final Iterator<Statement> iter = included.iterator();
  CloseableIteration<Statement, SailException> incl;
  incl = new CloseableIteratorIteration<Statement, SailException>(iter);
  return new UnionIteration<Statement, SailException>(incl, result);
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

/**
 * Checks this change to see if it is inconsistent with the observed state
 * of the store.
 */
void changed(Model added, Model removed)
    throws SailException {
  synchronized (observations) {
    for (EvaluateOperation op : observations) {
      if (!added.isEmpty() && sail.effects(added, op)) {
        ConcurrencyException inc = inconsistency(op);
        changes.add(new InconsistentChange(added, removed, inc));
        break;
      } else if (!removed.isEmpty() && sail.effects(removed, op)) {
        ConcurrencyException inc = inconsistency(op);
        changes.add(new InconsistentChange(added, removed, inc));
        break;
      }
    }
  }
}

代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-r2rml

/**
 * method to get the parent column in a join condition
 * 
 * @param myModel
 *            - the Model of mappings
 * @param predobjNode
 *            - the pred obj node containing the join condition
 * @return the parent column condition as a string
 */
public String getParentColumn(Model myModel, Resource predobjNode) {
  // process OBJECTMAP
  Model m = myModel.filter(predobjNode, R2RMLVocabulary.objectMap, null);
  if (!m.isEmpty()) {
    Resource object = m.objectResource();
    // look for joincondition declaration
    m = myModel.filter(object, R2RMLVocabulary.joinCondition, null);
    if (!m.isEmpty()) {
      Resource objectt = m.objectResource();
      // look for parent declaration
      m = myModel.filter(objectt, R2RMLVocabulary.parent, null);
      if (!m.isEmpty()) {
        return trimTo1(m.objectString());
      }
    }
  }
  return null;
}

代码示例来源:origin: it.unibz.inf.ontop/ontop-obdalib-r2rml

/**
 * method to get the child column in a join condition
 * 
 * @param myModel
 *            - the Model of mappings
 * @param predobjNode
 *            - the pred obj node containing the join condition
 * @return the child column condition as a string
 */
public String getChildColumn(Model myModel, Resource predobjNode) {
  // process OBJECTMAP
  Model m = myModel.filter(predobjNode, R2RMLVocabulary.objectMap, null);
  if (!m.isEmpty()) {
    Resource object = m.objectResource();
    // look for joincondition declaration
    m = myModel.filter(object, R2RMLVocabulary.joinCondition, null);
    if (!m.isEmpty()) {
      Resource objectt = m.objectResource();
      // look for child declaration
      m = myModel.filter(objectt, R2RMLVocabulary.child, null);
      if (!m.isEmpty()) {
        return trimTo1(m.objectString());
      }
    }
  }
  return null;
}

代码示例来源:origin: eu.fbk.pikes/pikes-rdf

for (final Value obj : this.valueComparator.sortedCopy(model.filter(node, pred, null)
    .objects())) {
  if (obj instanceof Literal || model.filter((Resource) obj, null, null).isEmpty()) {
    out.append(separator);
    renderObject(out, obj, model);

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

/**
 * Searches for observations that observed a subsequent state change of the store
 */
private ConcurrencyException detectPhantomRead(LinkedList<InconsistentChange> changes) throws SailException {
  for (InconsistentChange cs : changes) {
    Model added = cs.getAdded();
    Model removed = cs.getRemoved();
    for (EvaluateOperation op : cs.getSubsequentObservations()) {
      if (!added.isEmpty() && sail.effects(added, op)) {
        return phantom(op, cs.getInconsistency());
      }
      if (!removed.isEmpty() && sail.effects(removed, op)) {
        return phantom(op, cs.getInconsistency());
      }
    }
  }
  return null;
}

代码示例来源:origin: eu.fbk.pikes/pikes-rdf

if (!mentionModel.isEmpty()) {
  renderProperties(out, mentionModel, mentionID, false);

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

Model excluded = getRemovedModel().filter(subj, pred, obj, contexts);
Model included = getAddedModel().filter(subj, pred, obj, contexts);
if (included.isEmpty() && excluded.isEmpty())
  return result;
if (!excluded.isEmpty()) {
  final MemoryOverflowModel set;
  set = new MemoryOverflowModel(excluded);

代码示例来源:origin: com.github.ansell.oas/oas-webservice-impl

private void assertModel(final Model parseTsv)
{
  Assert.assertFalse(parseTsv.isEmpty());
  Assert.assertEquals(4, parseTsv.subjects().size());
  Assert.assertEquals(6, parseTsv.predicates().size());
  Assert.assertEquals(9, parseTsv.objects().size());
}

代码示例来源:origin: org.openrdf.sesame/sesame-sparql-testsuite

@Test
public void testSES2104ConstructBGPSameURI()
  throws Exception
{
  final String queryStr = "PREFIX : <urn:> CONSTRUCT {:x :p :x } WHERE {} ";
  conn.add(new StringReader("@prefix : <urn:> . :a :p :b . "), "", RDFFormat.TURTLE);
  final IRI x = conn.getValueFactory().createIRI("urn:x");
  final IRI p = conn.getValueFactory().createIRI("urn:p");
  GraphQuery query = conn.prepareGraphQuery(QueryLanguage.SPARQL, queryStr);
  Model result = QueryResults.asModel(query.evaluate());
  assertNotNull(result);
  assertFalse(result.isEmpty());
  assertTrue(result.contains(x, p, x));
}

代码示例来源:origin: apache/stanbol

protected final Representation store(RepositoryConnection con, Representation representation,boolean allowCreate,boolean canNotCreateIsError) throws IllegalArgumentException, RepositoryException {
  if(representation == null) {
    return null;
  }
  log.debug("store Representation " + representation.getId());
  URI subject = sesameFactory.createURI(representation.getId());
  boolean contains = con.hasStatement(subject, null, null, includeInferred, contexts);
  con.remove(subject, null, null, contexts);
  if(!contains && !allowCreate){
    if(canNotCreateIsError) {
      throw new IllegalArgumentException("Parsed Representation "+representation.getId()+" in not managed by this Yard "+getName()+"(id="+getId()+")");
    } else {
      return null;
    }
  }
  //get the graph for the Representation and add it to the store
  RdfRepresentation toAdd = valueFactory.toRdfRepresentation(representation);
  if(toAdd.getModel().isEmpty()){
    con.add(toAdd.getURI(),managedRepresentation,managedRepresentationState, contexts);
  } else {
    con.add(toAdd.getModel(), contexts);
  }
  return toAdd;
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

@Override
public void meet(StatementPattern sp) throws RuntimeException {
  super.meet(sp);
  ExternalModel externalR = new ExternalModel(sp, dataset, additional);
  ExternalModel externalA = new ExternalModel(sp, dataset, additional);
  Model minus = open(externalR.filter(removed, bindings));
  Model union = open(externalA.filter(added, bindings));
  TupleExpr node = sp;
  if (!minus.isEmpty()) {
    modified = true;
    externalR.setModel(minus);
    if (sp.getContextVar() == null) {
      // difference must compare context, but only works if non-null
      sp.setContextVar(newVar());
    }
    Difference rpl = new Difference(node.clone(), externalR);
    node.replaceWith(rpl);
    node = rpl;
  }
  if (!union.isEmpty()) {
    modified = true;
    externalA.setModel(union);
    Union rpl = new Union(externalA, node.clone());
    node.replaceWith(rpl);
    node = rpl;
  }
}

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-optimistic

Model added = getAddedModel();
Model removed = getRemovedModel();
if (added.isEmpty() && removed.isEmpty()) {
  merger = null;
} else {

代码示例来源:origin: org.openrdf.alibaba/alibaba-repository-object

if (!sup.equals(res) && !ds.match(sup, OWL.ONPROPERTY, prop).isEmpty()) {
  for (Value from : ds.match(sup, OWL.ALLVALUESFROM, null).objects()) {
    ds.add(node, RDFS.SUBCLASSOF, from);

代码示例来源:origin: anno4j/anno4j

if (!sup.equals(res) && !ds.match(sup, OWL.ONPROPERTY, prop).isEmpty()) {
  for (Value from : ds.match(sup, OWL.ALLVALUESFROM, null).objects()) {
    ds.add(node, RDFS.SUBCLASSOF, from);

相关文章