org.apache.jena.rdf.model.Model.removeAll()方法的使用及代码示例

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

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

Model.removeAll介绍

[英]Remove all the statements from this model.
[中]删除此模型中的所有语句。

代码示例

代码示例来源:origin: org.spdx/spdx-tools

public void setExcludedFileNames(String[] excludedFileNames) {
  this.excludedFileNames.clear();
  if (this.verificationCodeNode != null && this.model != null) {
    // clear old list
    Property p = model.getProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_VERIFICATIONCODE_IGNORED_FILES);
    model.removeAll(this.verificationCodeResource, p, null);
  }
  for (int i = 0; i < excludedFileNames.length; i++) {
    addExcludedFileName(excludedFileNames[i]);
  }
}

代码示例来源:origin: org.spdx/spdx-tools

/**
 * Remove all properties by the property name within the nameSpace from the subject node
 * @param node
 * @param propertyName
 * @throws InvalidSPDXAnalysisException 
 */
private void removeProperties(Node subject, String nameSpace, String propertyName) throws InvalidSPDXAnalysisException {
  Property p = model.getProperty(nameSpace, propertyName);
  Resource s = getResource(subject);
  model.removeAll(s, p, null);
}

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

private void removeOne(String IRI)
  {
    boolean removeDefault = "default".equals(IRI);

    if (isVerbose()) {
      if (removeDefault) System.out.println("Removing default graph");
      else System.out.println("Removing graph named <" + IRI + ">");
    }

    Model model = (removeDefault) ?
      SDBFactory.connectDefaultModel(getStore()) :
      SDBFactory.connectNamedModel(getStore(), IRI) ;

    model.removeAll();
  }
}

代码示例来源:origin: org.spdx/spdx-tools

/**
 * @param name the name to set
 */
public void setName(String name) {
  this.name = name;
  if (this.projectNode != null && this.model != null) {
    Property p = model.createProperty(SpdxRdfConstants.DOAP_NAMESPACE, SpdxRdfConstants.PROP_PROJECT_NAME);
    model.removeAll(projectResource, p, null);
    p = model.createProperty(SpdxRdfConstants.DOAP_NAMESPACE, SpdxRdfConstants.PROP_PROJECT_NAME);
    projectResource.addProperty(p, name);
  }
}

代码示例来源:origin: org.spdx/spdx-tools

public void setComment(String comment) {
this.comment = comment;
  if (this.model != null && this.resource != null) {
    Property p = model.createProperty(SpdxRdfConstants.RDFS_NAMESPACE, SpdxRdfConstants.RDFS_PROP_COMMENT);
    model.removeAll(this.resource, p, null);
    p = model.createProperty(SpdxRdfConstants.RDFS_NAMESPACE, SpdxRdfConstants.RDFS_PROP_COMMENT);
    this.resource.addProperty(p, this.comment);
  }
}
/**

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

@Override
public void put(String graphName, Model model) {
  checkOpen();
  Txn.executeWrite(dataset, ()-> {
    Model modelDst = modelFor(graphName); 
    modelDst.removeAll();
    modelDst.add(model);
  });
}

代码示例来源:origin: org.spdx/spdx-tools

/**
 * @param licenseComments the licenseComments to set
 */
public void setLicenseComments(String licenseComments) {
  this.licenseComments = licenseComments;
  if (this.model != null && this.resource != null) {
    Property p = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LIC_COMMENTS);
    model.removeAll(this.resource, p, null);
    p = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LIC_COMMENTS);
    this.resource.addProperty(p, this.getLicenseComments());
  }    
}

代码示例来源:origin: org.spdx/spdx-tools

@Override
  public void populateModel() throws InvalidSPDXAnalysisException {
    // delete any previous created
    Property licProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LICENSE_SET_MEMEBER);
    model.removeAll(resource, licProperty, null);

    licProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LICENSE_SET_MEMEBER);
    for (AnyLicenseInfo licenseInfo:this.licenseInfos) {
      Resource licResource = licenseInfo.createResource(this.modelContainer);
      resource.addProperty(licProperty, licResource);
    }
  }
}

代码示例来源:origin: spdx/tools

/**
 * @param licenseComments the licenseComments to set
 */
public void setLicenseComments(String licenseComments) {
  this.licenseComments = licenseComments;
  if (this.model != null && this.resource != null) {
    Property p = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LIC_COMMENTS);
    model.removeAll(this.resource, p, null);
    p = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LIC_COMMENTS);
    this.resource.addProperty(p, this.getLicenseComments());
  }    
}

代码示例来源:origin: spdx/tools

@Override
public void populateModel() throws InvalidSPDXAnalysisException {
  // delete any previous created
  Property licProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LICENSE_SET_MEMEBER);
  model.removeAll(resource, licProperty, null);
  licProperty = model.createProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LICENSE_SET_MEMEBER);
  Resource licResource = license.createResource(this.modelContainer);
  resource.addProperty(licProperty, licResource);        
}

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

@Override
public void delete(String graph) {
  checkOpen();
  Txn.executeWrite(dataset,() ->{
    if ( LibRDFConn.isDefault(graph) ) 
      dataset.getDefaultModel().removeAll();
    else 
      dataset.removeNamedModel(graph);
  });
}

代码示例来源:origin: org.apache.jena/jena-rdfconnection

@Override
public void delete(String graph) {
  checkOpen();
  Txn.executeWrite(dataset,() ->{
    if ( LibRDFConn.isDefault(graph) ) 
      dataset.getDefaultModel().removeAll();
    else 
      dataset.removeNamedModel(graph);
  });
}

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

@Before
public void setup() {
  baseModel = ModelFactory.createDefaultModel();
  baseModel.removeAll();
  URL url = SecuredModelDetailTest.class.getClassLoader().getResource(
      "org/apache/jena/permissions/model/detail.ttl");
  baseModel.read(url.toExternalForm());
  secEval = new DetailEvaluator(baseModel);
  securedModel = Factory.getInstance(secEval,
      "http://example.com/detailModelTest", baseModel);
}

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

protected void testRemoveAll( final String statements )
{
  ModelHelper.modelAdd(model, statements);
  Assert.assertSame(model, model.removeAll());
  Assert.assertEquals("model should have size 0 following removeAll(): ",
      0, model.size());
}

代码示例来源:origin: org.apache.jena/jena-core

protected void testRemoveAll( String statements )
  {
  modelAdd( model, statements );
  assertSame( model, model.removeAll() );
  assertEquals( "model should have size 0 following removeAll(): ", 0, model.size() );
  }

代码示例来源:origin: org.apache.jena/jena-core

protected void testRemoveAll( final String statements )
{
  ModelHelper.modelAdd(model, statements);
  Assert.assertSame(model, model.removeAll());
  Assert.assertEquals("model should have size 0 following removeAll(): ",
      0, model.size());
}

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

protected void testRemoveAll( String statements )
  {
  modelAdd( model, statements );
  assertSame( model, model.removeAll() );
  assertEquals( "model should have size 0 following removeAll(): ", 0, model.size() );
  }

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

public void testCount()
{
  for (int i = 0; i <= 5; i++)
  {
    model.removeAll();
    model.read( getFileName("ontology/list" + i + ".rdf"));
    final RDFList l0 = getListRoot(model);
    Assert.assertEquals("List size should be " + i, i, l0.size());
  }
}

代码示例来源:origin: org.apache.jena/jena-core

public void testCount()
{
  for (int i = 0; i <= 5; i++)
  {
    model.removeAll();
    model.read( getFileName("ontology/list" + i + ".rdf"));
    final RDFList l0 = getListRoot(model);
    Assert.assertEquals("List size should be " + i, i, l0.size());
  }
}

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

@Before
public void setup() {
  baseModel = createModel();
  baseModel.removeAll();
  baseModel.add(SecuredRDFNodeTest.s, SecuredRDFNodeTest.p, SecuredRDFNodeTest.o);
  baseModel.add(SecuredRDFNodeTest.s, SecuredRDFNodeTest.p2, "yeehaw");
  baseModel.add(SecuredRDFNodeTest.s, SecuredRDFNodeTest.p2, "yeehaw yall", "us");
  baseModel.add(SecuredRDFNodeTest.s, SecuredRDFNodeTest.p2, "whohoo", "uk");
  securedModel = Factory.getInstance(securityEvaluator, "http://example.com/securedGraph", baseModel);
  baseRDFNode = baseModel.getResource(SecuredRDFNodeTest.o.getURI());
  securedRDFNode = SecuredRDFNodeImpl.getInstance(securedModel, baseRDFNode);
}

相关文章

Model类方法