本文整理了Java中org.apache.jena.rdf.model.Model.equals()
方法的一些代码示例,展示了Model.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.equals()
方法的具体详情如下:
包路径:org.apache.jena.rdf.model.Model
类名称:Model
方法名:equals
[英]Test whether the given object m
is a model that is equal to this model, which is true iff the underlying graphs are identical Java objects. This is not the same test as comparing whether two models have the same structure (i.e. contain the same set of statements). To test for strucutural equivalence, see #isIsomorphicWith.
[中]测试给定对象m
是否是与此模型相等的模型,如果基础图是相同的Java对象,则为真。这与比较两个模型是否具有相同的结构(即包含相同的语句集)不同。要测试结构等效性,请参见#isIsomorphicWith。
代码示例来源:origin: stackoverflow.com
ArrayList<Model> model = new ArrayList(); //you have all data with same area and location
ArrayList<Model> list = new ArrayList(); //it will hold total area with same area + location
for(int i=0;i<model.size()-1;i++){
Model t = model.get(i);
for(int j=i+1;j<model.size();j++){
Model m = model.get(j);
if(!t.equals(m)){
list.add(t);
}else{
if(!list.contains(t)){
list.add(t);
}
}
}
}
代码示例来源:origin: org.aksw.commons/jena-jgrapht-bindings
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PseudoGraphJenaModel other = (PseudoGraphJenaModel) obj;
if (model == null) {
if (other.model != null)
return false;
} else if (!model.equals(other.model))
return false;
if (confinementProperty == null) {
if (other.confinementProperty != null)
return false;
} else if (!confinementProperty.equals(other.confinementProperty))
return false;
return true;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ResourceModel other = (ResourceModel) obj;
if (model == null) {
if (other.model != null)
return false;
} else if (!model.equals(other.model))
return false;
if (resource == null) {
if (other.resource != null)
return false;
} else if (!resource.equals(other.resource))
return false;
return true;
}
代码示例来源:origin: apache/jena
@Test
public void testEquals() throws Exception {
securedModel.equals(baseModel);
baseModel.equals(securedModel);
}
代码示例来源:origin: org.spdx/spdx-tools
if (this.getModel().equals(localLicenseModel)) {
retval = new SpdxListedLicense(localLicenseContainer, licResource.asNode());
} else { // we need to copy from the local model into this model
代码示例来源:origin: spdx/tools
if (this.getModel().equals(localLicenseModel)) {
retval = new SpdxListedLicense(localLicenseContainer, licResource.asNode());
} else { // we need to copy from the local model into this model
代码示例来源:origin: apache/jena
@Override
protected void reallyRunTest() {
try {
Model m2 = read(output);
super.reallyRunTest();
if (!m1.equals(m2)) {
save(output);
assertTrue(m1.isIsomorphicWith( m2 ) );
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
fail(e.getMessage());
}
}
@Override
代码示例来源:origin: org.apache.jena/jena-core
@Override
protected void reallyRunTest() {
try {
Model m2 = read(output);
super.reallyRunTest();
if (!m1.equals(m2)) {
save(output);
assertTrue(m1.isIsomorphicWith( m2 ) );
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
fail(e.getMessage());
}
}
@Override
代码示例来源:origin: at.researchstudio.sat/won-core
/**
* Modifies the specified resources' model, replacing resource with replacement.
*
* @param resource
* @param replacement
*/
public static void replaceResourceInModel(final Resource resource, final Resource replacement) {
logger.debug("replacing resource '{}' with resource '{}'", resource, replacement);
if (!resource.getModel().equals(replacement.getModel()))
throw new IllegalArgumentException("resource and replacement must be from the same model");
Model model = resource.getModel();
Model modelForNewStatements = ModelFactory.createDefaultModel();
StmtIterator iterator = model.listStatements(resource, (Property) null, (RDFNode) null);
while (iterator.hasNext()) {
Statement origStmt = iterator.next();
Statement newStmt = new StatementImpl(replacement, origStmt.getPredicate(), origStmt.getObject());
iterator.remove();
modelForNewStatements.add(newStmt);
}
iterator = model.listStatements(null, (Property) null, (RDFNode) resource);
while (iterator.hasNext()) {
Statement origStmt = iterator.next();
Statement newStmt = new StatementImpl(origStmt.getSubject(), origStmt.getPredicate(), replacement);
iterator.remove();
modelForNewStatements.add(newStmt);
}
model.add(modelForNewStatements);
}
代码示例来源:origin: at.researchstudio.sat/won-core
if (!resource.getModel().equals(replacement.getModel()))
throw new IllegalArgumentException("resource and replacement must be from the same model");
Model result = ModelFactory.createDefaultModel();
代码示例来源:origin: org.spdx/spdx-tools
this.exceptionNode != null &&
this.resource != null &&
(this.model.equals(modelContainer.getModel()) || (this.exceptionNode.isURI()))) {
return resource;
} else {
代码示例来源:origin: spdx/tools
this.exceptionNode != null &&
this.resource != null &&
(this.model.equals(modelContainer.getModel()) || (this.exceptionNode.isURI()))) {
return resource;
} else {
内容来源于网络,如有侵权,请联系作者删除!