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

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

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

Resource.getNameSpace介绍

[英]Returns the namespace associated with this resource.
[中]返回与此资源关联的命名空间。

代码示例

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

/** Record a use of the given namespace in the count map */
private void countNamespace( Resource r, Map<String,Integer> nsCount ) {
  if (!r.isAnon()) {
    String ns = r.getNameSpace();
    // increment the count for this namespace
    Integer count = nsCount.containsKey( ns ) ? (Integer) nsCount.get( ns ) : new Integer( 0 );
    Integer count1 = new Integer( count.intValue() + 1 );
    nsCount.put( ns, count1 );
  }
}

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

private static String guessNamespace(Model temp) {
  List<Resource> res = temp.listSubjectsWithProperty(RDF.type, OWL.Ontology).toList();
  Map<String, Integer> tempMap = new HashMap<String, Integer>();
  for (Resource r : res) {
    String ns = r.getNameSpace();
    tempMap.put(ns, (tempMap.containsKey(ns)) ? (tempMap.get(ns) + 1) : 1);
  }
  
  if (tempMap.size() > 0)
    return (String) sortByValue(tempMap).keySet().toArray()[0];
  else
    return null;
}

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

return null;
String ns = r.getNameSpace();
if (ns == null || ns.trim().length() == 0) ns = null;
String prefix = ontModel.getNsURIPrefix(r.getNameSpace());
if (prefix == null || prefix.trim().length() == 0) prefix = null;

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

String uri = m.asResource().getNameSpace();
logger.debug("service uri: " + uri);
if (IdsAndMappings.get(uri) == null) {

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

private Attribute getSingleAttribute(Model model, Resource att_resource) {
  
  String att_id = "";
  String att_name = "";
  Property has_name_property = model.getProperty(Namespaces.KARMA + "hasName");
  
  // attribute id
  att_id = att_resource.getLocalName();
  logger.debug("attribute id: " + att_id);
  NodeIterator nodeIterator = null;
  RDFNode node = null;
  
  // attribute name
  nodeIterator = model.listObjectsOfProperty(att_resource, has_name_property);
  if (nodeIterator.hasNext() && (node = nodeIterator.next()).isLiteral()) {
    att_name = node.asLiteral().getString();
    logger.debug("attribute name: " + att_name);
  } else
    logger.debug("attribute does not have a name.");
  
  Attribute att = new Attribute(att_id, att_resource.getNameSpace(), att_name, IOType.NONE, AttributeRequirement.NONE);
  
  return att;
}

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

/**
  Answer the default OntModelSpec for this root, which will be
  <code>DEFAULT</code> unless <code>root</code> has the JA
  namespace and a local name which is the name of an OntModelSpec
  constant (in OntModelSpec), in which case it's that constant's value.
*/
private OntModelSpec getDefault( Resource root )
  {
  if (root.isURIResource() && root.getNameSpace().equals( JA.uri ))
    {
    OntModelSpec oms = getOntModelSpecField( root.getLocalName() );
    return oms == null ? DEFAULT : oms;
    }
  else
    {
    Resource like = getUniqueResource( root, JA.likeBuiltinSpec );
    return like == null ? DEFAULT : getRequiredOntModelSpecField( like.getLocalName() );
    }
  }

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

att = new Attribute(att_id, att_resource.getNameSpace(), att_name, ioType, requirement, att_groundedIn );
else
  att = new Attribute(att_id, att_resource.getNameSpace(), att_name, ioType, requirement);

代码示例来源:origin: nkons/r2rml-parser

e.printStackTrace();
namespace = r.getNameSpace();

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

predicateNs = node.asResource().getNameSpace();
predicatePrefix = model.getNsURIPrefix(predicateNs);

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

predicateNs = node.asResource().getNameSpace();
predicatePrefix = model.getNsURIPrefix(predicateNs);

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

predicateNs = node.asResource().getNameSpace();
predicatePrefix = model.getNsURIPrefix(predicateNs);

代码示例来源:origin: nkons/r2rml-parser

while (iterTermType.hasNext()) {
    RDFNode rnTermType = iterTermType.next();
    if (rnTermType.isResource() && rnTermType.asResource().getNameSpace().equals(rrNs)) {
      String termType = rnTermType.asResource().getLocalName();
      log.info("Found rr:termType " + termType);
while (iterTermType.hasNext()) {
  RDFNode rnTermType = iterTermType.next();
  if (rnTermType.isResource() && rnTermType.asResource().getNameSpace().equals(rrNs)) {
    String termType = rnTermType.asResource().getLocalName();
    if (verbose) log.info("Found rr:termType " + termType);

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

predicateNs = node.asResource().getNameSpace();
predicatePrefix = model.getNsURIPrefix(predicateNs);

代码示例来源:origin: nkons/r2rml-parser

RDFNode rnDataType = iterDataType.next();
if (xsdNs.equals(rnDataType.asResource().getNameSpace())) {
  String dataType = rnDataType.asResource().getLocalName();
  log.info("Found datatype xsd:" + dataType);
while (iterTermType.hasNext()) { //should only be 1
  RDFNode rnTermType = iterTermType.next();
  if (rnTermType.isResource() && rnTermType.asResource().getNameSpace().equals(rrNs)) {
    String termType = rnTermType.asResource().getLocalName();
    log.info("Found rr:termType " + termType);

相关文章