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

x33g5p2x  于2022-01-28 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(102)

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

Resource.addLiteral介绍

[英]Add the property p with the typed-literal value o to this resource, ie add (this, p, typed(o)) to this's model. Answer this resource. The typed literal is equal to one constructed by using this.getModel().createTypedLiteral(o).
[中]将具有类型化文字值o的属性p添加到此资源,即将(this,p,typed(o))添加到此模型。回答这个问题。类型化文本等于使用this.getModel().createTypedLiteral(o)构造的文本。

代码示例

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

private void createExceptionProperty(Throwable thrown, Resource resource) {
  if (thrown.getClass().getName().contains(SKIP))
    resource.addProperty(DCTerms.description, thrown.getMessage());
  else
    resource.addLiteral(DCTerms.description,
        Utils.stackTrace(thrown, false)[0]);
}

代码示例来源:origin: net.sourceforge.ondex.modules/rdf

public void rdfMetadata(Resource r, MetaData md) {
  if (md.getDescription() != null && md.getDescription().length() > 0) 
    r.addLiteral(DC_11.description, md.getDescription());
  if (md.getFullname() != null && md.getFullname().length() > 0)    
    r.addLiteral(DC_11.title, md.getFullname());
  r.addLiteral(DC_11.identifier, md.getId());
}

代码示例来源:origin: net.sf.taverna.t2/provenance-client

public void addProcessor(String pName, String type, String wfNameRef, boolean isTopLevel)
throws SQLException {
  // create a Processor resource in the context of wfNameRef
  // wfNameRef rdf:type Workflow 
  // pName rdf:type j:Processor
  // pName part-Of wfNameRef
  String pNameURI = uriGenerator.makeProcessorURI(pName, wfNameRef);
  Resource pResource = getModel().createResource(pNameURI, JanusOntology.processor_spec);
  pResource.addLiteral(JanusOntology.has_processor_type, type);
  pResource.addLiteral(JanusOntology.is_top_level, isTopLevel);
  
  // pm added 9/10 -- adds original pname as comment for later use by other apps that need to lookup the native DB
  pResource.addLiteral(RDFS_COMMENT, pName);
  
  // associate this proc to its workflow
  Resource wfResource = workflowToResource.get(uriGenerator.makeWorkflowURI(wfNameRef));
  if (wfResource != null) {
    pResource.addProperty(JanusOntology.part_of, wfResource);
  }
  // record this in our local mapping table
  processorToResource.put(pNameURI, pResource);
}

代码示例来源:origin: net.sf.taverna.t2/provenance-client

public void addWFId(String wfId, String parentWFname, String externalName, Blob dataflow) throws SQLException {
  String wfNameURI = uriGenerator.makeWorkflowURI(wfId);
  Resource wfResource = getModel().createResource(wfNameURI, JanusOntology.workflow_spec);
  // pm added 9/10 -- adds original pname as comment for later use by other apps that need to lookup the native DB
  wfResource.addLiteral(RDFS_COMMENT, wfId);
  // record this wf resource locally
  workflowToResource.put(wfNameURI, wfResource);
  if (parentWFname != null)  {
    // do we have a resource for the parent?
    Resource parentWFResource = workflowToResource.get(uriGenerator.makeWorkflowURI(parentWFname));
    if (parentWFResource != null) {
      // link wfResource to its parent
      wfResource.addProperty(JanusOntology.has_parent_workflow, parentWFResource);
    }
  }
}

代码示例来源:origin: net.sf.taverna.t2/provenance-client

public void addPort(Port v) throws SQLException {

  String portURI = uriGenerator.makePortURI(v.getWorkflowId(), v.getProcessorName(), v.getPortName(), v.isInputPort());
  Resource portResource = getModel().createResource(portURI, JanusOntology.port);
  //if (v.getType()!=null) portResource.addLiteral(JanusOntology.has_port_type, v.getType());
  portResource.addLiteral(JanusOntology.has_port_order, v.getIterationStrategyOrder());
  portResource.addLiteral(JanusOntology.is_processor_input, v.isInputPort());
  // pm added 9/10 -- adds original pvame as comment for later use by other apps that need to lookup the native DB
  portResource.addLiteral(RDFS_COMMENT, v.getPortName());
  portToResource.put(portURI, portResource);
  // associate this port to its processor
  String procURI = uriGenerator.makeProcessorURI(v.getProcessorName(), v.getWorkflowId());
  Resource procResource = processorToResource.get(procURI);
  if (procResource != null) {
    procResource.addProperty(JanusOntology.has_parameter, portResource);
  }
}

代码示例来源:origin: org.apache.odftoolkit/odfdom-java

Property p = m.createProperty(xhtmlProperty);
if (xhtmlContent != null) {
  s.addLiteral(p, xhtmlContent);
} else {
  s.addLiteral(p, entry.getValue());

代码示例来源:origin: net.sourceforge.ondex.modules/rdf

public void writeEntity(Resource res, ONDEXEntity entity, Model model, String graphURI) {
  // contexts
  for(ONDEXConcept ctxt : entity.getTags()) {
    res.addProperty(model.createProperty(ONDEXRdf.contextUri), model.createResource(ONDEXRdf.conceptToUri(graphURI, ctxt)));
  }
  // evidence
  for(EvidenceType evt : entity.getEvidence()) {
    res.addProperty(model.createProperty(ONDEXRdf.evidenceUri), model.createResource(ONDEXRdf.etToUri(graphURI, evt)));
  }
  // Attribute values
  for(Attribute attribute : entity.getAttributes()) {
    // todo: add more handlers
    Property p = model.createProperty(ONDEXRdf.attributeNameToUri(graphURI, attribute.getOfType()));
    Object value = attribute.getValue();
    if (value instanceof String) res.addProperty(p, (String) value);
    else if (value instanceof Integer) res.addLiteral(p, (Integer) value);
    else if (value instanceof Double) res.addLiteral(p, (Double) value);
    else if (value instanceof Boolean) res.addLiteral(p, (Boolean) value);
    else if (value instanceof Long) res.addLiteral(p, (Long) value);
    //else res.addProperty(p, value.toString());
  }
}

代码示例来源:origin: net.sf.taverna.t2/provenance-client

vbResource.addLiteral(JanusOntology.has_iteration, vb.getIteration());
vbResource.addLiteral(JanusOntology.has_port_value_order, vb.getPositionInColl());
if (value != null)	vbResource.addLiteral(RDFS_COMMENT, value);

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

assertionResource.addLiteral(ranAsClass, result.getTestClass().getRealClass().getSimpleName());

代码示例来源:origin: uk.ac.open.kmi.msm4j/msm4j-io

current.addProperty(SAWSDL.modelReference, refResource);
refResource.addProperty(RDF.type, WSMO_LITE.Condition);
refResource.addLiteral(RDF.value, cond.getTypedValue());
current.addProperty(SAWSDL.modelReference, refResource);
refResource.addProperty(RDF.type, WSMO_LITE.Effect);
refResource.addLiteral(RDF.value, effect.getTypedValue());

代码示例来源:origin: usc-isi-i2/Web-Karma

private void addAttributeDetails(Model model, Resource my_attribute, Attribute att) {

    Resource attribute_resource = model.createResource(Namespaces.KARMA + "Attribute");

    Property rdf_type = model.createProperty(Namespaces.RDF , "type");
    Property has_name = model.createProperty(Namespaces.KARMA, "hasName");
    Property is_grounded_in = model.createProperty(Namespaces.HRESTS, "isGroundedIn");

    my_attribute.addProperty(rdf_type, attribute_resource);
    my_attribute.addProperty(has_name, att.getName());
//            my_part.addProperty(model_reference, XSDDatatype.XSDstring.getURI());
    
    if (att.getIOType() == IOType.INPUT) {
      String rdf_plain_literal = Namespaces.RDF + "PlainLiteral";
      Literal ground_literal = model.createTypedLiteral(att.getGroundedIn(), rdf_plain_literal);
      my_attribute.addLiteral(is_grounded_in, ground_literal);
    }
    
  }

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

excerpt.addLiteral(TestDescription.includesText, test.description());
if (specRef != null) {
  excerpt.addProperty(RDFS.seeAlso, specRef);

代码示例来源:origin: net.sf.taverna.t2.activities/sadi-activity

Literal literal = resource.getModel().createTypedLiteral(
      triple.getObject().getLiteralValue());
  resource.addLiteral(node.getOntProperty(), literal);
  rdfNodes.add(literal);
} else if (triple.getObject().isURI()) {

代码示例来源:origin: usc-isi-i2/Web-Karma

if (service.getAddress().length() > 0) {
  Literal operation_address_literal = model.createTypedLiteral(service.getAddress(), uri_template);
  myservice.addLiteral(has_address, operation_address_literal);

代码示例来源:origin: epimorphics/elda

.addLiteral( API.page, page )
.addLiteral( OpenSearch.itemsPerPage, perPage )
.addLiteral( OpenSearch.startIndex, perPage * page + 1 )
thisMetaPage.addLiteral( OpenSearch.totalResults, totalResults.intValue() );

相关文章