当前位置: 首页>>代码示例>>Java>>正文


Java Model.getProperty方法代码示例

本文整理汇总了Java中org.apache.jena.rdf.model.Model.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Model.getProperty方法的具体用法?Java Model.getProperty怎么用?Java Model.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jena.rdf.model.Model的用法示例。


在下文中一共展示了Model.getProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillTrie

import org.apache.jena.rdf.model.Model; //导入方法依赖的package包/类
@Override
protected void fillTrie(Logger logger, Trie<Resource> trie, Corpus corpus) throws IOException, ModuleException {
	Model model = createModel(logger);
	Property typeProp = model.getProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
	Property[] labelPropertyProps = getProperties(model, labelURIs);
	int nEntries = 0;
	for (String resourceTypeURI : resourceTypeURIs) {
		Property resourceType = model.getProperty(model.expandPrefix(resourceTypeURI));
		for (Resource res : Iterators.loop(model.listSubjectsWithProperty(typeProp , resourceType))) {
			if (res.isAnon()) {
				continue;
			}
			for (Property prop : labelPropertyProps) {
				for (RDFNode node : Iterators.loop(model.listObjectsOfProperty(res, prop))) {
					String label = getNodeValue(node);
					trie.addEntry(label, res);
					nEntries++;
				}
			}
		}
	}
	logger.info("Entries: " + nEntries);
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:24,代码来源:RDFProjector.java

示例2: getIntProperty

import org.apache.jena.rdf.model.Model; //导入方法依赖的package包/类
public int getIntProperty(Model model, Resource res, String name) {

  Property anIntProperty = model.getProperty("http://example.com/owl/csvtupler/map2sparql#",name);
  Statement aStatement = res.getProperty(anIntProperty);
  if (aStatement != null) {
    return aStatement.getObject().asLiteral().getInt();
  }
  return -1;
}
 
开发者ID:tag42git,项目名称:CsvTupler,代码行数:10,代码来源:Node.java

示例3: getBooleanProperty

import org.apache.jena.rdf.model.Model; //导入方法依赖的package包/类
public boolean getBooleanProperty(Model model, Resource res, String name) {

  Property aBooleanProperty = model.getProperty("http://example.com/owl/csvtupler/map2sparql#",name);
  Statement aStatement = res.getProperty(aBooleanProperty);
  if (aStatement != null) {
    return aStatement.getObject().asLiteral().getBoolean();
  }
  return false;
}
 
开发者ID:tag42git,项目名称:CsvTupler,代码行数:10,代码来源:Node.java

示例4: getStringProperty

import org.apache.jena.rdf.model.Model; //导入方法依赖的package包/类
public String getStringProperty(Model model, Resource res, String name) {

  Property aStringProperty = model.getProperty("http://example.com/owl/csvtupler/map2sparql#",name);
  Statement aStatement = res.getProperty(aStringProperty);
  if (aStatement != null) {
    return aStatement.getObject().asLiteral().getString();
  }
  return null;
}
 
开发者ID:tag42git,项目名称:CsvTupler,代码行数:10,代码来源:Node.java

示例5: getProperties

import org.apache.jena.rdf.model.Model; //导入方法依赖的package包/类
private static Property[] getProperties(Model model, String[] uris) {
	Property[] result = new Property[uris.length];
	for (int i = 0; i < result.length; ++i) {
		result[i] = model.getProperty(model.expandPrefix(uris[i]));
	}
	return result;
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:8,代码来源:RDFProjector.java

示例6: handleMatch

import org.apache.jena.rdf.model.Model; //导入方法依赖的package包/类
@Override
protected void handleMatch(Resource value, Annotation a) {
	a.addFeature(uriFeatureName, value.getURI());
	Model model = value.getModel();
	for (Map.Entry<String,String> e : labelFeatures.entrySet()) {
		String propURI = e.getValue();
		Property prop = model.getProperty(model.expandPrefix(propURI));
		for (RDFNode node : Iterators.loop(model.listObjectsOfProperty(value, prop))) {
			a.addFeature(e.getKey(), getNodeValue(node));
		}
	}
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:13,代码来源:RDFProjector.java

示例7: buildTree

import org.apache.jena.rdf.model.Model; //导入方法依赖的package包/类
public static Node buildTree(Model model, List<Node> nodes) throws Exception {

      Property hasChildProperty = model.getProperty("http://example.com/owl/csvtupler/map2sparql#","hasChild");
      Property rootProperty = model.getProperty("http://example.com/owl/csvtupler/map2sparql#","root");

      Node root = null;
      for (Node node : nodes) {

        Statement rootStatement = node.getResource().getProperty(rootProperty);
        if (rootStatement != null && rootStatement.getObject().asLiteral().getBoolean() == true) {
          if (root != null)
            throw new Exception("Can't have multiple root nodes");
          node.setRoot(true);
          root = node;
        }
        StmtIterator hasChildStatementIterator = node.getResource().listProperties(hasChildProperty);

        while (hasChildStatementIterator.hasNext()) {
          Statement hasChildStatement = hasChildStatementIterator.next();

          Resource childRes = hasChildStatement.getObject().asResource();

          for (Node sNode : nodes) {
            if (sNode != node) {
              if (resourcesEqual(sNode.getResource(), childRes)) {
                node.addChild(sNode);
              }
            }
          }
          
        }
      }
      if (root == null)
        throw new Exception("Must have a root node");

      Deque<Node> path = new ArrayDeque<Node>();
      path.add(root);
      if (checkCycles(root, path) == true)
        throw new Exception("Can't have cycles in node tree");
      else
        return root;
    }
 
开发者ID:tag42git,项目名称:CsvTupler,代码行数:43,代码来源:NodeFactory.java


注:本文中的org.apache.jena.rdf.model.Model.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。