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

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

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

Resource.addProperty介绍

[英]Add a property to this resource.

A statement with this resource as the subject, p as the predicate and o as the object is added to the model associated with this resource.
[中]将属性添加到此资源。
将此资源作为主语、p作为谓词、o作为对象的语句添加到与此资源关联的模型中。

代码示例

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

private void writeManifest(ArrayList<Resource> testcases, String localName, String label, String description) {
  if (testcases.size() == 0) return;
  Resource manifest = model.createResource(namespace + localName+"Manifest",
      TestManifest.Manifest);
  manifest.addProperty(DCTerms.title, label);
  manifest.addProperty(TestManifest.name, label);
  manifest.addProperty(RDFS.comment, description);
  Resource[] ra={};
  RDFList l = model.createList(testcases.toArray(ra));
  manifest.addProperty(TestManifest.entries, l);
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void addResourceMap(URI rem)
    throws OREException
{
  res.addProperty(ORE.isDescribedBy, model.createResource(rem.toString()));
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void setCreated(Date created)
{
  SimpleDateFormat sdf = new SimpleDateFormat(JenaOREConstants.dateFormat);
  String date = sdf.format(created);
  res.addProperty(DCTerms.created, model.createTypedLiteral(date, JenaOREConstants.dateTypedLiteral));
}

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

private static void addTypeToAll( Resource type, Set<Resource> candidates )
  {
  List<Resource> types = equivalentTypes( type );
  for (Resource element : candidates)
    {
    Resource resource = element;
    for (int i = 0; i < types.size(); i += 1)
      resource.addProperty( RDF.type, types.get(i) );
    }
  }

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void addSeeAlso(URI seeAlso)
    throws OREException
{
  res.addProperty(RDFS.seeAlso, model.createTypedLiteral(seeAlso));
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void initialise()
{
  res = model.createResource(); // blank node
  res.addProperty(RDF.type, model.createResource("http://purl.org/dc/terms/Agent"));
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void clearTypes()
{
  // leave it to OREResource to handle type clearance
  super.clearTypes();
  // ensure that the required type is still set
  res.addProperty(RDF.type, model.createResource("http://purl.org/dc/terms/Agent"));
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void addCreator(Agent creator)
{
  // creator is only a flat set of triples, so can be added this way
  Resource resource = ((AgentJena) creator).getResource();
  res.addProperty(DC.creator, resource);
  this.addResourceToModel(resource);
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void addCreator(Agent creator)
{
  Resource resource = ((AgentJena) creator).getResource();
  res.addProperty(DC.creator, resource);
  this.addResourceToModel(resource);
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void relate(Predicate pred, Object literal) throws OREException
{
  Property property = model.createProperty(pred.getURI().toString());
  triple.addProperty(property, model.createTypedLiteral(literal));
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void addAgent(URI relationship, Agent agent) throws OREException
{
  Resource resource = ((AgentJena) agent).getResource();
  res.addProperty(model.createProperty(relationship.toString()), resource);
  this.addResourceToModel(resource);
}

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

private void addDocumentation(Model model, Service service) {
  if (service.getDocumentation() != null) {
    com.hp.hpl.jena.rdf.model.Resource current = model.createResource(service.getUri().toASCIIString());
    try {
      com.hp.hpl.jena.rdf.model.Resource documentationRes = model.createResource(service.getDocumentation().toURI().toASCIIString());
      current.addProperty(MSM_NFP.hasDocumentation, documentationRes);
    } catch (URISyntaxException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void relate(Predicate pred, OREResource resource) throws OREException
{
  Property property = model.createProperty(pred.getURI().toString());
  triple.addProperty(property, model.createResource(resource.getURI().toString()));
}

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

private void addMethod(Model model, Operation op) {
  com.hp.hpl.jena.rdf.model.Resource current = model.createResource(op.getUri().toASCIIString());
  if (op.getMethod() != null) {
    current.addProperty(HRESTS.hasMethod, model.createResource(op.getMethod().toASCIIString()));
  }
}

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

private void addAcceptsContentTypes(Model model, Operation op) {
  com.hp.hpl.jena.rdf.model.Resource current = model.createResource(op.getUri().toASCIIString());
  if (op.getAcceptsContentTypes() != null) {
    for (URI mediaType : op.getAcceptsContentTypes()) {
      current.addProperty(HRESTS.acceptsContentType, model.createResource(mediaType.toASCIIString()));
    }
  }
}

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

private void addRecentMashups(Model model, Service service) {
  // Create Recent Mashups Value
  if (service.getRecentMashups() != null) {
    com.hp.hpl.jena.rdf.model.Resource current = model.createResource(service.getUri().toASCIIString());
    Literal recentMashups = model.createTypedLiteral(service.getRecentMashups());
    current.addProperty(MSM_NFP.hasRecentMashups, recentMashups);
  }
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void setTypes(List<URI> types)
{
  super.setTypes(types);
  // ensure that the required type is still set
  Selector selector = new SimpleSelector(res, RDF.type, ORE.Proxy);
  StmtIterator itr = model.listStatements(selector);
  if (!itr.hasNext())
  {
    res.addProperty(RDF.type, ORE.Proxy);
  }
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void setTypes(List<URI> types)
{
  super.setTypes(types);
  // ensure that the required type is still set
  Selector selector = new SimpleSelector(res, RDF.type, ORE.ResourceMap);
  StmtIterator itr = model.listStatements(selector);
  if (!itr.hasNext())
  {
    res.addProperty(RDF.type, ORE.ResourceMap);
  }
}

代码示例来源:origin: com.googlecode.foresite-toolkit/foresite

public void setTypes(List<URI> types)
{
  super.setTypes(types);
  // ensure that the required type is still set
  Selector selector = new SimpleSelector(res, RDF.type, ORE.Aggregation);
  StmtIterator itr = model.listStatements(selector);
  if (!itr.hasNext())
  {
    res.addProperty(RDF.type, ORE.Aggregation);
  }
}

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

private void addAddress(Model model, Service service) {
  if (service.getAddress() != null) {
    com.hp.hpl.jena.rdf.model.Resource current = model.createResource(service.getUri().toASCIIString());
    Literal address = model.createTypedLiteral(service.getAddress(), HRESTS.URITemplate.getURI());
    current.addProperty(HRESTS.hasAddress, address);
  }
}

相关文章