com.hp.hpl.jena.rdf.model.Model.leaveCriticalSection()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(120)

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

Model.leaveCriticalSection介绍

暂无

代码示例

代码示例来源:origin: fr.inria.eventcloud/eventcloud-api

/**
 * {@inheritDoc}
 */
@Override
public void leaveCriticalSection() {
  super.object.leaveCriticalSection();
}

代码示例来源:origin: bio2rdf/bio2rdf-scripts

public void leaveCriticalSection() {
  model.leaveCriticalSection();
}

代码示例来源:origin: org.semweb4j/rdf2go.impl.jena

@Override
public void unlock() {
  assertModel();
  if(this.isLocked()) {
    this.jenaModel.leaveCriticalSection();
    this.locked = false;
  }
}

代码示例来源:origin: org.eagle-i/eagle-i-search-rdf-provider

@Override
public void generate(final DataGenParams params) throws IOException {
  model.enterCriticalSection( Lock.WRITE );
  try {
    super.generate( params );
  } finally {
    model.leaveCriticalSection();
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

graph.leaveCriticalSection();

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

/**
 * Returns the number of statements in the graph.
 * <p>
 * XXX AT: this size may not be equal to the number of statements retrieved via getStatements() because it counts
 * each statement property.
 *
 * @return integer number of statements in the graph
 */
@Override
public Long size() {
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    return graph.size();
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public boolean write(OutputStream out, String lang, String base) {
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.WRITE);
    graph.write(out, lang, base);
    // default to true
    return true;
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public boolean read(InputStream in, String lang, String base) {
  // XXX AT: maybe update namespaces in case some new appeared
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    graph.read(in, base, lang);
    // default to true
    return true;
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public void clear() {
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    graph.removeAll();
    // XXX AT: remove reification quadlets explicitly
    RSIterator it = graph.listReifiedStatements();
    List<ReifiedStatement> rss = new ArrayList<ReifiedStatement>();
    while (it.hasNext()) {
      rss.add(it.nextRS());
    }
    for (ReifiedStatement rs : rss) {
      graph.removeReification(rs);
    }
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public List<Node> getPredicates(Node subject, Node object) {
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    SimpleSelector selector = getJenaSelector(graph, new StatementImpl(subject, null, object));
    StmtIterator it = graph.listStatements(selector);
    List<Statement> statements = getNXRelationsStatements(graph, it.toList());
    List<Node> res = new ArrayList<Node>();
    for (Statement stmt : statements) {
      Node predicate = stmt.getPredicate();
      if (!res.contains(predicate)) {
        // remove duplicates
        res.add(predicate);
      }
    }
    return res;
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public List<Statement> getStatements() {
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    StmtIterator it = graph.listStatements();
    return getNXRelationsStatements(graph, it.toList());
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

graph.leaveCriticalSection();

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public List<Node> getObjects(Node subject, Node predicate) {
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    SimpleSelector selector = getJenaSelector(graph, new StatementImpl(subject, predicate, null));
    NodeIterator it = graph.listObjectsOfProperty(selector.getSubject(), selector.getPredicate());
    List<Node> res = new ArrayList<Node>();
    while (it.hasNext()) {
      res.add(getNXRelationsNode(it.nextNode().asNode()));
    }
    return res;
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public List<Node> getSubjects(Node predicate, Node object) {
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    SimpleSelector selector = getJenaSelector(graph, new StatementImpl(null, predicate, object));
    ResIterator it = graph.listSubjectsWithProperty(selector.getPredicate(), selector.getObject());
    List<Node> res = new ArrayList<Node>();
    while (it.hasNext()) {
      res.add(getNXRelationsNode(it.nextResource().asNode()));
    }
    return res;
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public boolean hasResource(Resource resource) {
  if (resource == null) {
    return false;
  }
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    com.hp.hpl.jena.graph.Node jenaNodeInst = getJenaNode(resource);
    RDFNode jenaNode = graph.asRDFNode(jenaNodeInst);
    return graph.containsResource(jenaNode);
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public List<Statement> getStatements(Statement statement) {
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    SimpleSelector selector = getJenaSelector(graph, statement);
    StmtIterator it = graph.listStatements(selector);
    return getNXRelationsStatements(graph, it.toList());
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

@Override
public boolean hasStatement(Statement statement) {
  if (statement == null) {
    return false;
  }
  Model graph = null;
  GraphConnection graphConnection = null;
  try {
    graphConnection = openGraph();
    graph = graphConnection.getGraph();
    graph.enterCriticalSection(Lock.READ);
    SimpleSelector selector = getJenaSelector(graph, statement);
    return graph.contains(selector.getSubject(), selector.getPredicate(), selector.getObject());
  } finally {
    if (graph != null) {
      graph.leaveCriticalSection();
    }
    if (graphConnection != null) {
      graphConnection.close();
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-relations-jena-plugin

graph.leaveCriticalSection();

相关文章

Model类方法