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

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

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

Model.createResource介绍

[英]Create a new anonymous resource whose model is this model. This bnode will have a new AnonId distinct from any allocated by any other call of this method.

Subsequent operations on the returned resource may modify this model.
[中]创建一个新的匿名资源,其模型是此模型。此bnode将有一个新的AnonId,与此方法的任何其他调用分配的任何AnonId不同。
对返回资源的后续操作可能会修改此模型。

代码示例

代码示例来源:origin: de.unibonn.iai.eis/luzzu-semantics

public static Resource generateURI(){
  String uri = "https://w3id.org/lodquator/resource/"; //TODO: fix this to do this URI in the PropertyManager
    
  uri += UUID.randomUUID().toString();
  Resource r = ModelFactory.createDefaultModel().createResource(uri);
  return r;
}

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

private Resource oneLevelClone( Resource root )
  {
  Model partialCopy = ModelFactory.createDefaultModel();
  Resource newRoot = partialCopy.createResource();
  transferContentProperties( partialCopy, root, newRoot );
  return newRoot;
  }

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

public PdbRdfModel() {
  model = ModelFactory.createDefaultModel();
  DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss");
  Date d = new Date();
  date = dateFormat.format(d);
  dataset = model.createResource("http://bio2rdf.org/bio2rdf.dataset:pdb-"+date);
  model.add(dataset, RDF.type, model.createResource("http://rdfs.org/ns/void#Dataset"));
  inDataset = model.createProperty("http://rdfs.org/ns/void#inDataset");
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.rules.manager

private static URI getSWRLVariable(String argument){
    Resource variableResource = null;
    String variableString = argument.substring(1);
    variableResource = ModelFactory.createDefaultModel().createResource(kb.getPrefixURI("var")+variableString);
    try {
                return new URI(variableResource.getURI());
            } catch (URISyntaxException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
}

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

private static URI getSWRLVariable(String argument){
    Resource variableResource = null;
    String variableString = argument.substring(1);
    variableResource = ModelFactory.createDefaultModel().createResource(kb.getPrefixURI("var")+variableString);
    try {
                return new URI(variableResource.getURI());
            } catch (URISyntaxException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return null;
            }
}

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.rules.manager

private static URI getSWRLArgument(String argument){
    Resource rdfNode = null;
    String[] argumentComposition = argument.split(":");
    if(argumentComposition.length == 2){
        String prefix = argumentComposition[0];
        String resourceName = argumentComposition[1];
        String namespaceURI = kb.getPrefixURI(prefix);
        rdfNode = ModelFactory.createDefaultModel().createResource(namespaceURI+resourceName);
        try {
                        return new URI(rdfNode.getURI());
                    } catch (URISyntaxException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
    }
    return null;
}

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

private static URI getSWRLArgument(String argument){
    Resource rdfNode = null;
    String[] argumentComposition = argument.split(":");
    if(argumentComposition.length == 2){
        String prefix = argumentComposition[0];
        String resourceName = argumentComposition[1];
        String namespaceURI = kb.getPrefixURI(prefix);
        rdfNode = ModelFactory.createDefaultModel().createResource(namespaceURI+resourceName);
        try {
                        return new URI(rdfNode.getURI());
                    } catch (URISyntaxException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
    }
    return null;
}

代码示例来源:origin: org.w3/ldp-testsuite

protected Model getDefaultModel() {
  Model model = ModelFactory.createDefaultModel();
  Resource resource = model.createResource("",
      model.createResource("http://example.com/ns#Bug"));
  resource.addProperty(RDF.type, model.createResource(LDP.RDFSource.stringValue()));
  resource.addProperty(
      model.createProperty("http://example.com/ns#severity"), "High");
  resource.addProperty(DCTerms.title, "Another bug to test.");
  resource.addProperty(DCTerms.description, "Issues that need to be fixed.");
  return model;
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

private void generateQualityMetadata(){
  Resource res = ModelFactory.createDefaultModel().createResource(this.datasetURI);
  
  QualityMetadata md = new QualityMetadata(res, false);
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    md.addMetricData(m);
  }
  
  try {
    RDFDataMgr.write(System.out, md.createQualityMetadata(), Lang.TRIG);
  } catch (MetadataException e) {
    logger.error(e.getMessage());
  }
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

private void generateQualityReport() {
  QualityReport r = new QualityReport();
  List<String> qualityProblems = new ArrayList<String>();
  
  String datasetURI = "";
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    qualityProblems.add(r.createQualityProblem(m.getMetricURI(), m.getQualityProblems()));
    datasetURI = m.getDatasetURI();
  }
  
  Resource res = ModelFactory.createDefaultModel().createResource(datasetURI);
  this.qualityReport = r.createQualityReport(res, qualityProblems);
  r.flush();
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Generates the quality report associated to this quality assessment process. 
 * Sets the result into the qualityReport attribute
 */
private void generateQualityReport() {
  QualityReport r = new QualityReport();
  List<String> qualityProblems = new ArrayList<String>();
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    qualityProblems.add(r.createQualityProblem(m.getMetricURI(), m.getQualityProblems()));
  }
  
  Resource res = ModelFactory.createDefaultModel().createResource(EnvironmentProperties.getInstance().getBaseURI());
  this.qualityReport = r.createQualityReport(res, qualityProblems);
  r.flush();
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Generates the quality report associated to this quality assessment process. 
 * Sets the result into the qualityReport attribute
 */
private void generateQualityReport() {
  QualityReport r = new QualityReport();
  List<String> qualityProblems = new ArrayList<String>();
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    qualityProblems.add(r.createQualityProblem(m.getMetricURI(), m.getQualityProblems()));
  }
  
  Resource res = ModelFactory.createDefaultModel().createResource(EnvironmentProperties.getInstance().getBaseURI());
  this.qualityReport = r.createQualityReport(res, qualityProblems);
  r.flush();
}

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

/**
 * Return a description of the capabilities of this reasoner encoded in
 * RDF. This method is normally called by the ReasonerRegistry which caches
 * the resulting information so dynamically creating here is not really an overhead.
 */
@Override
public Model getCapabilities() {
  if (capabilities == null) {
    capabilities = ModelFactory.createDefaultModel();
    Resource base = capabilities.createResource(getURI());
    base.addProperty(ReasonerVocabulary.nameP, "Generic Rule Reasoner")
      .addProperty(ReasonerVocabulary.descriptionP, "Generic rule reasoner, configurable")
      .addProperty(ReasonerVocabulary.versionP, "0.1");
  }
  return capabilities;
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Prints the quality meta-data produced by this quality assessment process onto the standard output 
 */
@SuppressWarnings("unused")
private void generateQualityMetadata(){
  Resource res = ModelFactory.createDefaultModel().createResource(EnvironmentProperties.getInstance().getBaseURI());
  QualityMetadata md = new QualityMetadata(res, false);
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    md.addMetricData(m);
  }
  
  try {
    RDFDataMgr.write(System.out, md.createQualityMetadata(), Lang.TRIG);
  } catch (MetadataException e) {
    logger.error(e.getMessage());
  }
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Prints the quality meta-data produced by this quality assessment process onto the standard output 
 */
@SuppressWarnings("unused")
private void generateQualityMetadata(){
  Resource res = ModelFactory.createDefaultModel().createResource(EnvironmentProperties.getInstance().getBaseURI());
  QualityMetadata md = new QualityMetadata(res, false);
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    md.addMetricData(m);
  }
  
  try {
    RDFDataMgr.write(System.out, md.createQualityMetadata(), Lang.TRIG);
  } catch (MetadataException e) {
    logger.error(e.getMessage());
  }
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Prints the quality meta-data produced by this quality assessment process onto the standard output 
 */
@SuppressWarnings("unused")
private void generateQualityMetadata(){
  Resource res = ModelFactory.createDefaultModel().createResource(EnvironmentProperties.getInstance().getBaseURI());
  QualityMetadata md = new QualityMetadata(res, false);
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    md.addMetricData(m);
  }
  
  try {
    RDFDataMgr.write(System.out, md.createQualityMetadata(), Lang.TRIG);
  } catch (MetadataException e) {
    logger.error(e.getMessage());
  }
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Prints the quality meta-data produced by this quality assessment process onto the standard output 
 */
@SuppressWarnings("unused")
private void generateQualityMetadata(){
  Resource res = ModelFactory.createDefaultModel().createResource(EnvironmentProperties.getInstance().getBaseURI());
  QualityMetadata md = new QualityMetadata(res, false);
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    md.addMetricData(m);
  }
  
  try {
    RDFDataMgr.write(System.out, md.createQualityMetadata(), Lang.TRIG);
  } catch (MetadataException e) {
    logger.error(e.getMessage());
  }
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Prints the quality meta-data produced by this quality assessment process onto the standard output 
 */
@SuppressWarnings("unused")
private void generateQualityMetadata(){
  Resource res = ModelFactory.createDefaultModel().createResource(EnvironmentProperties.getInstance().getBaseURI());
  QualityMetadata md = new QualityMetadata(res, false);
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    md.addMetricData(m);
  }
  
  try {
    RDFDataMgr.write(System.out, md.createQualityMetadata(), Lang.TRIG);
  } catch (MetadataException e) {
    logger.error(e.getMessage());
  }
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Prints the quality meta-data produced by this quality assessment process onto the standard output 
 */
@SuppressWarnings("unused")
private void generateQualityMetadata(){
  Resource res = ModelFactory.createDefaultModel().createResource(EnvironmentProperties.getInstance().getBaseURI());
  QualityMetadata md = new QualityMetadata(res, false);
  
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    md.addMetricData(m);
  }
  
  try {
    RDFDataMgr.write(System.out, md.createQualityMetadata(), Lang.TRIG);
  } catch (MetadataException e) {
    logger.error(e.getMessage());
  }
}

代码示例来源:origin: de.unibonn.iai.eis/luzzu-io

/**
 * Generates the quality report associated to this quality assessment process. 
 * Sets the result into the qualityReport attribute
 */
private void generateQualityReport() {
  QualityReport r = new QualityReport();
  List<String> qualityProblems = new ArrayList<String>();
  
  String datasetURI = "";
  for(String className : this.metricInstances.keySet()){
    QualityMetric m = this.metricInstances.get(className);
    if (m.getQualityProblems() == null) continue;
    qualityProblems.add(r.createQualityProblem(m.getMetricURI(), m.getQualityProblems()));
    datasetURI = m.getDatasetURI();
  }
  
  Resource res = ModelFactory.createDefaultModel().createResource(datasetURI);
  this.qualityReport = r.createQualityReport(res, qualityProblems);
  r.flush();
}

相关文章

Model类方法