• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Individual类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.jena.ontology.Individual的典型用法代码示例。如果您正苦于以下问题:Java Individual类的具体用法?Java Individual怎么用?Java Individual使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Individual类属于org.apache.jena.ontology包,在下文中一共展示了Individual类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: renderHierarchy

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
protected static void renderHierarchy(PrintStream out, OntClass cls, List<Object> occurs, int depth) {
  renderClassDescription(out, cls, depth);
  out.println();

  // recurse to the next level down
  if (cls.canAs(OntClass.class) && !occurs.contains(cls)) {
    for (Iterator<?> i = cls.listSubClasses(true); i.hasNext(); ) {
      OntClass sub = (OntClass) i.next();

      // we push this expression on the occurs list before we recurse
      occurs.add(cls);
      renderHierarchy(out, sub, occurs, depth + 1);
      occurs.remove(cls);
    }
    for (Iterator<?> i = cls.listInstances(); i.hasNext(); ) {
      Individual individual = (Individual) i.next();
      renderURI(out, individual.getModel(), individual.getURI());
      out.print(" [");
      for (Iterator<?> j = individual.listLabels(null); j.hasNext(); ) {
        out.print(((Literal) j.next()).getString() + ", ");
      }
      out.print("] ");
      out.println();
    }
  }
}
 
开发者ID:apache,项目名称:incubator-sdap-mudrod,代码行数:27,代码来源:LocalOntology.java


示例2: inferClasses

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
@Override
public Set<URI> inferClasses(final URI uri, final WebResource resource, final Ontology ontology) {

    final OntModel model = resolveImports(ont(ontology));
    model.add(parse(resource));

    final Individual individual = model.getIndividual(uri.toString());

    if (individual != null) {
        return individual
                .listRDFTypes(false)
                .filterKeep(Resource::isURIResource)
                .mapWith(Resource::getURI)
                .mapWith(URI::create)
                .toSet();
    } else {
        LOG.info("<{}> does not make any statements about itself, " +
                "so we can't infer anything about it nor bind extensions to it", uri);
        return Collections.emptySet();
    }

}
 
开发者ID:fcrepo4-labs,项目名称:fcrepo-api-x,代码行数:23,代码来源:JenaOntologyService.java


示例3: map

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
@Override
public void map(List<DIF> pojoList, Properties props) {
  // create the base model
  OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
  ontModel.setNsPrefix("dif_v9.8.2", MUDROD_GCMD_DIF_9_8_2);
  ontModel.setNsPrefix("geo", "http://www.opengis.net/ont/geosparql#");
  ontModel.read(SWEET_REPR_DATA_PRODUCT, null, "TURTLE");

  // get the https://sweetontology.net/reprDataProduct/Dataset class reference
  Resource dataset = ontModel.getResource(SWEET_REPR_DATA_PRODUCT_NS + "Dataset");
  // create the https://sweetontology.net/reprDataProduct/PODAACDataset class
  // reference
  OntClass podaacDataset = ontModel.createClass(PODAAC_DATASET + "PODAACDataset");
  // make PODAACDataset a subclass of Dataset
  podaacDataset.addSuperClass(dataset);
  // create an individual for each DIF POJO
  for (DIF dif : pojoList) {
    Individual gcmdDif = podaacDataset.createIndividual(PODAAC_DATASET + dif.getEntryID());
    buildIndividual(ontModel, dif, gcmdDif);
  }
  writeOntologyModel(ontModel, props);
}
 
开发者ID:ESIPFed,项目名称:eskg,代码行数:23,代码来源:PODAACOntologyMapper.java


示例4: addStackTrace

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
protected void addStackTrace(Individual error, ErrorDocument errorDoc)
        throws IOException {
    StringBuilder sb = new StringBuilder();
    addStackTrace(sb, errorDoc);
    if (sb.length() > 0) {
        error.addLiteral(provModel.stackTrace, sb.toString());
    }

    for (T2Reference errRef : errorDoc.getErrorReferences()) {
        URI errorURI = URI.create(uriGenerator.makeT2ReferenceURI(errRef
                .toUri().toASCIIString()));
        Individual nestedErr = provModel.createError(errorURI);
        provModel.setWasDerivedFrom(error, nestedErr);
        describeEntity(errRef);
    }
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:17,代码来源:W3ProvenanceExport.java


示例5: getContentAsModel

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
public OntModel getContentAsModel() {
	OntModel result = createOntologyModel();
	try {
		populateModelFromString(result, getContentAsString());

		// Check it is not still called changeme
		List<Individual> individuals = result.listIndividuals(clazz)
				.toList();
		if (individuals.isEmpty()) {
			errors.setText("No valid individuals");
			return null;
		}
		for (Individual i : individuals)
			if (i.getURI().endsWith("changeme")) {
				errors.setText("Name has not been changed");
				return null;
			}

		errors.setText("No errors found");
		return result;
	} catch (Throwable ex) { // syntax error?
		errors.setText(ex.getMessage());
		return null;
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-plugin-component,代码行数:26,代码来源:TurtleInputPanel.java


示例6: addKeyPair

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
public void addKeyPair(Individual dictionary, long position,
        Individual listItem) {
    dictionary.addProperty(hadMember, listItem);
    Individual keyPair = model.createIndividual(KeyEntityPair);
    keyPair.addProperty(pairEntity, listItem);
    keyPair.addLiteral(pairKey, position);
    dictionary.addProperty(hadDictionaryMember, keyPair);

}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:10,代码来源:ProvModel.java


示例7: setEndedAtTime

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
public Individual setEndedAtTime(Individual endedActivity, Calendar time) {
    if (time == null) {
        logger.warn("Unknown end time");
        return null;
    }
    return setEndedAtTime(endedActivity, model.createTypedLiteral(time));
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:8,代码来源:ProvModel.java


示例8: setStartedAtTime

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
public Individual setStartedAtTime(Individual startedActivity, Calendar time) {
    if (time == null) {
        logger.warn("Unknown start time");
        return null;
    }
    return setStartedAtTime(startedActivity, model.createTypedLiteral(time));
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:8,代码来源:ProvModel.java


示例9: setUsed

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
public Individual setUsed(Individual activity, Individual usedEntity) {
    activity.addProperty(used, usedEntity);
    Individual usage = model.createIndividual(Usage);
    activity.addProperty(qualifiedUsage, usage);
    usage.addProperty(entity, usedEntity);
    return usage;
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:8,代码来源:ProvModel.java


示例10: setWasAssociatedWith

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
public Individual setWasAssociatedWith(Individual activity,
        Individual associatedAgent, Individual plan) {
    activity.setPropertyValue(wasAssociatedWith, associatedAgent);
    Individual association = model.createIndividual(Association);
    activity.setPropertyValue(qualifiedAssociation, association);
    association.setPropertyValue(agent, associatedAgent);
    if (plan != null) {
        association.setPropertyValue(hadPlan, plan);
    }
    return association;
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:12,代码来源:ProvModel.java


示例11: setWasGeneratedBy

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
public Individual setWasGeneratedBy(Individual generated,
        Individual generatingActivity) {
    generated.setPropertyValue(wasGeneratedBy, generatingActivity);
    Individual generation = model.createIndividual(Generation);
    generated.setPropertyValue(qualifiedGeneration, generation);
    generation.setPropertyValue(activity, generatingActivity);
    return generation;

}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:10,代码来源:ProvModel.java


示例12: setWasInformedBy

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
public Individual setWasInformedBy(Individual informed, Individual informer) {
    informed.setPropertyValue(wasInformedBy, informer);
    Individual communication = model.createIndividual(Communication);
    informed.setPropertyValue(qualifiedCommunication, communication);
    communication.setPropertyValue(activity, informer);
    return communication;
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:8,代码来源:ProvModel.java


示例13: dummy

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
@Test
public void dummy() throws Exception {
    ProvModel provModel = new WfprovModel();
    Individual bundle = provModel.createBundle(uuid());
    assertEquals("Bundle", bundle.getOntClass().getLocalName());
    
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:8,代码来源:TestWfprovModel.java


示例14: createEntity

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
@Test
public void createEntity() throws Exception {
    Individual ent = provModel.createEntity(URI
            .create("http://example.com/fred#test"));
    provModel.createEntity(URI.create("http://example.com/test"));
    OntModel model = provModel.model;
    model.write(System.out, "TURTLE", "http://example.com/fred");
    model.write(System.out, "RDF/XML", "http://example.com/fred");

    WriterGraphRIOT writer = RDFDataMgr.createGraphWriter(RDFFormat.TURTLE_BLOCKS);
    writer.write(System.out, model.getBaseModel().getGraph(), RiotLib.prefixMap(model.getGraph()), "http://example.com/fred", new Context());

}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:14,代码来源:TestTavernaProvModel.java


示例15: describeEntity

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
protected Individual describeEntity(T2Reference t2Ref) throws IOException {
    URI dataURI = URI.create(uriGenerator.makeT2ReferenceURI(t2Ref.toUri()
            .toASCIIString()));

    Individual artifact = describedEntities.get(dataURI);
    if (artifact != null) {
        return artifact;
    }
    artifact = provModel.createArtifact(dataURI);
    describedEntities.put(dataURI, artifact);

    if (t2Ref.getReferenceType() == T2ReferenceType.ErrorDocument) {
        Individual error = provModel.createError(dataURI);
        ErrorDocument errorDoc = saver.getReferenceService()
                .getErrorDocumentService().getError(t2Ref);
        addMessageIfNonEmpty(error, errorDoc.getMessage());
        // getExceptionMEssage added by addStackTrace
        addStackTrace(error, errorDoc);
    } else if (t2Ref.getReferenceType() == T2ReferenceType.IdentifiedList) {
        IdentifiedList<T2Reference> list = saver.getReferenceService()
                .getListService().getList(t2Ref);
        Individual dictionary = provModel.createDictionary(dataURI);

        int pos = 0;
        for (T2Reference ref : list) {
            URI itemURI = URI.create(uriGenerator.makeT2ReferenceURI(ref
                    .toUri().toASCIIString()));
            Individual listItem = provModel.createArtifact(itemURI);
            provModel.addKeyPair(dictionary, pos++, listItem);
            describeEntity(ref);
        }
        if (list.isEmpty()) {
            artifact.addRDFType(provModel.EmptyCollection);
            artifact.addRDFType(provModel.EmptyDictionary);
        }
    }

    return artifact;
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:40,代码来源:W3ProvenanceExport.java


示例16: findRO

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
private Individual findRO(OntModel model, URI base) {
	try (ClosableIterable<? extends OntResource> instances = iterate(aggregation
			.listInstances())) {
		for (OntResource o : instances)
			// System.out.println("Woo " + o);
			return o.asIndividual();
	}
	// Fallback - resolve as "/"
	// TODO: Ensure it's an Aggregation?
	return model.getIndividual(base.toString());
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:12,代码来源:RDFToManifest.java


示例17: getAgents

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
private List<Agent> getAgents(URI base, Individual in,
		ObjectProperty property) {
	List<Agent> creators = new ArrayList<>();
	for (Individual agent : listObjectProperties(in, property)) {
		Agent a = new Agent();
		if (agent.getURI() != null)
			a.setUri(relativizeFromBase(agent.getURI(), base));

		RDFNode name = agent.getPropertyValue(foafName);
		if (name != null && name.isLiteral())
			a.setName(name.asLiteral().getLexicalForm());
		creators.add(a);
	}
	return creators;
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:16,代码来源:RDFToManifest.java


示例18: listObjectProperties

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
private Set<Individual> listObjectProperties(OntResource ontResource,
		ObjectProperty prop) {
	LinkedHashSet<Individual> results = new LinkedHashSet<>();
	try (ClosableIterable<RDFNode> props = iterate(ontResource
			.listPropertyValues(prop))) {
		for (RDFNode node : props) {
			if (!node.isResource() || !node.canAs(Individual.class))
				continue;
			results.add(node.as(Individual.class));
		}
	}
	return results;
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:14,代码来源:RDFToManifest.java


示例19: addRevision

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
private void addRevision(OntModel model,
		Revision revision) {
	OntClass VersionableResource = model.createClass("http://purl.org/wf4ever/roevo#VersionableResource");
	VersionableResource.addSuperClass(Prov_o.Entity);
	Individual revisionResource = model.createIndividual(revision.getIdentifier().toASCIIString(), 
			VersionableResource);
	revisionResource.addRDFType(Prov_o.Entity);
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:9,代码来源:ROEvoSerializer.java


示例20: addPrevious

import org.apache.jena.ontology.Individual; //导入依赖的package包/类
private void addPrevious(OntModel model,
		Revision revision, Revision previous) {
	OntClass VersionableResource = model.createClass("http://purl.org/wf4ever/roevo#VersionableResource");
	VersionableResource.addSuperClass(Prov_o.Entity);
	
	Individual revisionResource = model.createIndividual(revision.getIdentifier().toASCIIString(), 
			VersionableResource);
	Individual previousResource = model.createIndividual(previous.getIdentifier().toASCIIString(), 
			VersionableResource);
	revisionResource.addProperty(Prov_o.wasRevisionOf, previousResource);
}
 
开发者ID:apache,项目名称:incubator-taverna-language,代码行数:12,代码来源:ROEvoSerializer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BlockStemMelon类代码示例发布时间:2022-05-22
下一篇:
Java Clustering类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap