org.apache.jena.graph.Triple.createMatch()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(72)

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

Triple.createMatch介绍

暂无

代码示例

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

public static GraphEvents remove( Node s, Node p, Node o )
  { return new GraphEvents( "remove", Triple.createMatch( s, p, o ) ){
    @Override
    public Triple getTriple() { return (Triple)content; }
   };
  }

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

public static GraphEvents remove( Node s, Node p, Node o )
  { return new GraphEvents( "remove", Triple.createMatch( s, p, o ) ){
    @Override
    public Triple getTriple() { return (Triple)content; }
   };
  }

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

/**
   Answer <code>true</code> if this graph contains <code>(s, p, o)</code>;
   this canonical implementation cannot be over-ridden. 
*/
@Override
public final boolean contains( Node s, Node p, Node o ) {
  checkOpen();
  return contains( Triple.createMatch( s, p, o ) );
}

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

/**
   Answer <code>true</code> if this graph contains <code>(s, p, o)</code>;
   this canonical implementation cannot be over-ridden. 
*/
@Override
public final boolean contains( Node s, Node p, Node o ) {
  checkOpen();
  return contains( Triple.createMatch( s, p, o ) );
}

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

/**
 * Return the triple pattern as a triple match (concrete terms + Node.ANY) 
 */
public Triple asTripleMatch() {
  return Triple.createMatch(toMatch(subject), 
               toMatch(predicate), 
               toMatch(object));
}

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

/**
 * Return the triple pattern as a triple match (concrete terms + Node.ANY) 
 */
public Triple asTripleMatch() {
  return Triple.createMatch(toMatch(subject), 
               toMatch(predicate), 
               toMatch(object));
}

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

public SPDXFile[] getFileReferences() throws InvalidSPDXAnalysisException {
  List<SPDXFile> alFiles = Lists.newArrayList();
  Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_FILE_REFERENCE).asNode();
  Triple m = Triple.createMatch(getSpdxDocNode(), p, null);
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    Triple t = tripleIter.next();
    alFiles.add(new SPDXFile(this, t.getObject()));
  }
  SPDXFile[] retval = new SPDXFile[alFiles.size()];
  return alFiles.toArray(retval);
}

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

public SPDXFile[] getFileReferences() throws InvalidSPDXAnalysisException {
  List<SPDXFile> alFiles = Lists.newArrayList();
  Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_FILE_REFERENCE).asNode();
  Triple m = Triple.createMatch(getSpdxDocNode(), p, null);
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    Triple t = tripleIter.next();
    alFiles.add(new SPDXFile(this, t.getObject()));
  }
  SPDXFile[] retval = new SPDXFile[alFiles.size()];
  return alFiles.toArray(retval);
}

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

@Override
public void getPropertiesFromModel() throws InvalidSPDXAnalysisException {
  this.licenseInfos.clear();
  Node p = model.getProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LICENSE_SET_MEMEBER).asNode();
  Triple m = Triple.createMatch(node, p, null);
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    Triple t = tripleIter.next();
    this.licenseInfos.add(LicenseInfoFactory.getLicenseInfoFromModel(modelContainer, t.getObject()));
  }
}

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

@Override
public void getPropertiesFromModel() throws InvalidSPDXAnalysisException {
  this.licenseInfos.clear();
  Node p = model.getProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LICENSE_SET_MEMEBER).asNode();
  Triple m = Triple.createMatch(node, p, null);
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    Triple t = tripleIter.next();
    this.licenseInfos.add(LicenseInfoFactory.getLicenseInfoFromModel(modelContainer, t.getObject()));
  }
}

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

public List<SpdxPackage> findAllPackages() throws InvalidSPDXAnalysisException {
  Node rdfTypePredicate = model.getProperty(SpdxRdfConstants.RDF_NAMESPACE, 
      SpdxRdfConstants.RDF_PROP_TYPE).asNode();
  Node packageTypeObject = model.createResource(SPDX_NAMESPACE + CLASS_SPDX_PACKAGE).asNode();
  Triple m = Triple.createMatch(null, rdfTypePredicate, packageTypeObject);
  List<SpdxPackage> retval = Lists.newArrayList();
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    retval.add((SpdxPackage)SpdxElementFactory.createElementFromModel(this, tripleIter.next().getSubject()));
  }
  return retval;
}

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

public List<SpdxPackage> findAllPackages() throws InvalidSPDXAnalysisException {
  Node rdfTypePredicate = model.getProperty(SpdxRdfConstants.RDF_NAMESPACE, 
      SpdxRdfConstants.RDF_PROP_TYPE).asNode();
  Node packageTypeObject = model.createResource(SPDX_NAMESPACE + CLASS_SPDX_PACKAGE).asNode();
  Triple m = Triple.createMatch(null, rdfTypePredicate, packageTypeObject);
  List<SpdxPackage> retval = Lists.newArrayList();
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    retval.add((SpdxPackage)SpdxElementFactory.createElementFromModel(this, tripleIter.next().getSubject()));
  }
  return retval;
}

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

public List<SpdxFile> findAllFiles() throws InvalidSPDXAnalysisException {
  Node rdfTypePredicate = model.getProperty(SpdxRdfConstants.RDF_NAMESPACE, 
      SpdxRdfConstants.RDF_PROP_TYPE).asNode();
  Node fileTypeObject = model.createResource(SPDX_NAMESPACE + CLASS_SPDX_FILE).asNode();
  Triple m = Triple.createMatch(null, rdfTypePredicate, fileTypeObject);
  List<SpdxFile> retval = Lists.newArrayList();
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    retval.add((SpdxFile)SpdxElementFactory.createElementFromModel(this, tripleIter.next().getSubject()));
  }
  return retval;
}

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

public List<SpdxFile> findAllFiles() throws InvalidSPDXAnalysisException {
  Node rdfTypePredicate = model.getProperty(SpdxRdfConstants.RDF_NAMESPACE, 
      SpdxRdfConstants.RDF_PROP_TYPE).asNode();
  Node fileTypeObject = model.createResource(SPDX_NAMESPACE + CLASS_SPDX_FILE).asNode();
  Triple m = Triple.createMatch(null, rdfTypePredicate, fileTypeObject);
  List<SpdxFile> retval = Lists.newArrayList();
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    retval.add((SpdxFile)SpdxElementFactory.createElementFromModel(this, tripleIter.next().getSubject()));
  }
  return retval;
}

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

/**
 * @param id
 * @return true if the license ID is already in the model as an extracted license info
 * @throws InvalidSPDXAnalysisException 
 */
protected boolean extractedLicenseExists(String id) throws InvalidSPDXAnalysisException {
  Node p = model.getProperty(SPDX_NAMESPACE, PROP_LICENSE_ID).asNode();
  Node o = NodeFactory.createLiteral(id);
  Triple m = Triple.createMatch(null, p, o);
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  return tripleIter.hasNext();
}

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

/**
 * @param id
 * @return true if the license ID is already in the model as an extracted license info
 * @throws InvalidSPDXAnalysisException 
 */
protected boolean extractedLicenseExists(String id) throws InvalidSPDXAnalysisException {
  Node p = model.getProperty(SPDX_NAMESPACE, PROP_LICENSE_ID).asNode();
  Node o = NodeFactory.createLiteral(id);
  Triple m = Triple.createMatch(null, p, o);
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  return tripleIter.hasNext();
}

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

public SpdxPackageVerificationCode getVerificationCode() throws InvalidSPDXAnalysisException {			
  SpdxPackageVerificationCode retval = null;
  Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_VERIFICATION_CODE).asNode();
  Triple m = Triple.createMatch(this.node, p, null);
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    Triple t = tripleIter.next();
    retval = new SpdxPackageVerificationCode(model, t.getObject());
  }
  return retval;
}

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

public SpdxPackageVerificationCode getVerificationCode() throws InvalidSPDXAnalysisException {			
  SpdxPackageVerificationCode retval = null;
  Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_VERIFICATION_CODE).asNode();
  Triple m = Triple.createMatch(this.node, p, null);
  ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
  while (tripleIter.hasNext()) {
    Triple t = tripleIter.next();
    retval = new SpdxPackageVerificationCode(model, t.getObject());
  }
  return retval;
}

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

public String getComment() {
  if (this.model != null && this.resource != null) {
    Node p = model.getProperty(SpdxRdfConstants.RDFS_NAMESPACE, SpdxRdfConstants.RDFS_PROP_COMMENT).asNode();
    Triple m = Triple.createMatch(this.resource.asNode(), p, null);
    ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
    while (tripleIter.hasNext()) {
      this.comment = tripleIter.next().getObject().toString(false);
    }
  }
  return this.comment;
}

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

public String getComment() {
  if (this.model != null && this.resource != null) {
    Node p = model.getProperty(SpdxRdfConstants.RDFS_NAMESPACE, SpdxRdfConstants.RDFS_PROP_COMMENT).asNode();
    Triple m = Triple.createMatch(this.resource.asNode(), p, null);
    ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);    
    while (tripleIter.hasNext()) {
      this.comment = tripleIter.next().getObject().toString(false);
    }
  }
  return this.comment;
}

相关文章