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

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

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

Resource.getLocalName介绍

[英]Returns the name of this resource within its namespace.
[中]返回此资源在其命名空间中的名称。

代码示例

代码示例来源:origin: org.biopax.paxtools/paxtools-jena-io

private String getJavaName(Resource resource) {
  // Since java does not allow '-' replace them all with '_'
  return resource.getLocalName().replaceAll("-", "_");
}

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

/** Answer the local name of resource r mapped to upper case */
protected String getUCValueName( Resource r ) {
  StringBuffer buf = new StringBuffer();
  String localName = r.getLocalName();
  char lastChar = 0;
  for (int i = 0; i < localName.length(); i++) {
    char c = localName.charAt(i);
    if (Character.isLowerCase(lastChar) && Character.isUpperCase(c)) {
      buf.append( '_' );
    }
    buf.append( Character.toUpperCase(c) );
    lastChar = c;
  }
  return buf.toString();
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.core

public String getLocalName() {
  Resource mr = getJenaResource();
  return mr.getLocalName();
}

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

private String resourceSpelling( Resource r ) {
  String shorter = nameMap.get( r.getURI() );
  return shorter == null ? r.getLocalName() : shorter;
}

代码示例来源:origin: org.renci.ahab/libndl

/**
 * Do a reverse lookup on node type (NDL -> shortname )
 */
public static String reverseNodeTypeLookup(Resource nt) {
  if (nt == null)
    return null;
  for (Iterator<Map.Entry<String, Pair<String>>> it = nodeTypes.entrySet().iterator(); it.hasNext();) {
    Map.Entry<String, Pair<String>> e = it.next();
    // convert to namespace and type in a pair
    // WARNING: this checks only the type, not the namespace.
    if (nt.getLocalName().equals(e.getValue().getSecond()))
      return e.getKey();
  }
  return null;
}

代码示例来源:origin: org.renci.ahab/libndl

public void ndlNetworkConnection(Resource l, OntModel om,
    long bandwidth, long latency, List<Resource> interfaces) {
  
  //should be sliceGraph.add... and/or manifestGraph.add...
  //manifest.addNetworkConnection(l.toString());
  String printStr = "ndlManifest_NetworkConnection: \n\tName: " + l.toString() + " (" + l.getLocalName() + ")";
  printStr += "\n\tInterfaces:";
  for (Resource r : interfaces){
    printStr += "\n\t\t " + r;
  }            
  LIBNDL.logger().debug(printStr);
}
public void ndlParseComplete() {

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

private static void classShortname(Resource r) {
  r.addProperty(RDF.type, RDFS.Class );
  r.addProperty(RDFS.label, r.getLocalName() );
}

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

public String getLabel() {
  Statement label = wrapped.getProperty(RDFS.label);
  return label == null ? wrapped.getLocalName() : label.getObject().toString();
}

代码示例来源:origin: jhpoelen/eol-globi-data

protected Specimen createSpecimen(QuerySolution solution, Study study, String targetTaxon1) throws NodeFactoryException {
  String targetTaxon = solution.get(targetTaxon1).asResource().getLocalName();
  String taxonId = targetTaxon.replaceAll("NCBITaxon_", TaxonomyProvider.NCBI.getIdPrefix());
  return nodeFactory.createSpecimen(study, new TaxonImpl(null, taxonId));
}

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

@Test public void ensure_spellings_match_names() {
    assertEquals( "missingListTail", RDFUtil.Vocab.missingListTail.getLocalName() );
    assertEquals( "missingListElement", RDFUtil.Vocab.missingListElement.getLocalName() );
  }
}

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

public static Model createReservedModel() {
  Model result = ModelFactory.createDefaultModel();
  for (Resource reserved: allReservedResouces()) {
    result.add( reserved, API.label, reserved.getLocalName() );
    result.add( reserved, RDF.type, RDF.Property );
  }
  return result;
}

代码示例来源:origin: org.renci.ahab/libndl

/**
 * Process a broadcast link
 */
public void ndlBroadcastConnection(Resource bl, OntModel om,
    long bandwidth, List<Resource> interfaces) {
  
  LIBNDL.logger().debug("BroadcastConnection: " + bl);
  
  Network ol = this.sliceGraph.buildLink(bl.getLocalName());
  ndlModel.mapRequestResource2ModelResource(ol, bl);
  ol.setBandwidth(bandwidth);
  //ol.setLatency(latency);
  ol.setLabel(NdlCommons.getLayerLabelLiteral(bl));    
}

代码示例来源:origin: org.renci.ahab/libndl

/**
 * Process a broadcast link
 */
public void ndlBroadcastConnection(Resource bl, OntModel om,
    long bandwidth, List<Resource> interfaces) {
  
  LIBNDL.logger().debug("BroadcastConnection: " + bl);
  
  Network ol = this.sliceGraph.buildLink(bl.getLocalName());
  ndlModel.mapRequestResource2ModelResource(ol, bl);
  ol.setBandwidth(bandwidth);
  //ol.setLatency(latency);
  ol.setLabel(NdlCommons.getLayerLabelLiteral(bl));    
}

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

private APIEndpointSpec getEndpoint(APISpec a, String localName) {
    for (APIEndpointSpec e: a.getEndpoints())
      if (e.getResource().getLocalName().equals(localName))
        return e;
    return null;
  }
}

代码示例来源:origin: org.renci.ahab/libndl

public String getDomain(RequestResource requestResource) {
  if(this.getModelResource(requestResource) instanceof com.hp.hpl.jena.rdf.model.impl.ResourceImpl){
    //Special case for nodes that are already in the manifest (i.e. are instances of ResourceImpl
    return RequestGenerator.reverseLookupDomain(NdlCommons.getDomain(this.getModelResource(requestResource)));
  } 
  
  //General case for regular resources
  return NdlCommons.getDomain((Individual)this.getModelResource(requestResource)).getLocalName();
  
}

代码示例来源:origin: net.exogeni.orca/ndl

@SuppressWarnings("static-access")
public void testGetLayer() {
  System.out.println("--------GetLayer-------\n");
  String uri = "http://geni-orca.renci.org/owl/ben-dtn.rdf#Duke/Infinera/DTN/fB/1/ocgB/1";
  System.out.println(ontProcessor.getOntModel().getResource(uri).getLocalName());
  ResultSet results = ontProcessor.getLayer(ontProcessor.getOntModel(), uri);
  String layerName = null;
  String varName = (String) results.getResultVars().get(0);
  while (results.hasNext()) {
    layerName = results.nextSolution().getResource(varName).getLocalName();
    System.out.println(layerName);
  }
  assertTrue(layerName != null);
}

代码示例来源:origin: culturecommunication/ginco

public Model exportAssociativeRelationshipRoles(Model model, OntModel ontModel) {
    List<AssociativeRelationshipRole> roles = associativeRelationshipRoleService
        .getAllAssociationTermRole();
    for (AssociativeRelationshipRole role : roles) {
      String roleSkosLabel = role.getSkosLabel();
      ObjectProperty broaderRoleProperty = ontModel
          .createObjectProperty(GINCO.getResourceURI(roleSkosLabel));
      broaderRoleProperty.addLabel(ontModel.createLiteral(GINCO
          .getResource(roleSkosLabel).getLocalName()));
      broaderRoleProperty.addProperty(RDFS.subPropertyOf, SKOS.RELATED);

    }
    return model;
  }
}

代码示例来源:origin: culturecommunication/ginco

public OntClass addGroupTypeToOntModel(OntModel ontmodel, String groupType) {		
  OntClass groupTypeRes = ontmodel.createClass(GINCO.getResource(
      groupType).getURI());
  groupTypeRes.addLabel(ontmodel.createLiteral(GINCO.getResource(
      groupType).getLocalName()));
  groupTypeRes.addSuperClass(ontmodel.getResource(ISOTHES.CONCEPT_GROUP
      .getURI()));
  return groupTypeRes;
      
}

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

public APITester( Model model, ModelLoader loader ) {
  for (ResIterator ri = model.listSubjectsWithProperty(RDF.type, API.API); ri.hasNext();) {
    Resource api = ri.next();
    APISpec spec = new APISpec( EldaFileManager.get(), api, loader );
    specifications.put(api.getLocalName(), spec);
    for (APIEndpointSpec eps : spec.getEndpoints()) {
      APIEndpoint ep = APIFactory.makeApiEndpoint(eps);
      register(ep.getURITemplate(), ep);
    }
  }
}

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

private void EachEndpointHasItsOwnDefaultSuffix(String expected, String protoSpec ) {
  String spec = ":my a api:API; api:sparqlEndpoint :spoo." + "\n" + protoSpec;
  Model m = ModelIOUtils.modelFromTurtle( spec );
  Resource root = m.createResource( m.expandPrefix( ":my" ) );
  APISpec s = SpecUtil.specFrom( root );
//
  for (APIEndpointSpec es : s.getEndpoints()) {
    String localName = es.getResource().getLocalName();
    String defaultSuffix = es.getBindings().getAsString("_defaultSuffix", null);
    assertEquals("suffix should be the same as the local name", localName, defaultSuffix);
  }
}

相关文章