本文整理汇总了Java中org.apache.jena.rdf.model.NodeIterator类的典型用法代码示例。如果您正苦于以下问题:Java NodeIterator类的具体用法?Java NodeIterator怎么用?Java NodeIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NodeIterator类属于org.apache.jena.rdf.model包,在下文中一共展示了NodeIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listSystemBeans
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
public static List<SystemBean> listSystemBeans(Model model, Resource involvingResource) {
List<SystemBean> systems = new ArrayList<>();
if (model == null) {
return systems;
}
// iterate over all systems
NodeIterator systemIterator = model.listObjectsOfProperty(involvingResource, HOBBIT.involvesSystemInstance);
RDFNode node;
while (systemIterator.hasNext()) {
node = systemIterator.next();
if (node.isResource()) {
systems.add(getSystemBean(model, node.asResource()));
}
}
return systems;
}
示例2: createParamValueBeans
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
private static void createParamValueBeans(Model model, Resource taskResource, NodeIterator parameterIterator,
Map<String, ConfigurationParamValueBean> parameters) {
RDFNode node;
Resource parameter;
Property paraProp;
String parameterUri;
while (parameterIterator.hasNext()) {
node = parameterIterator.next();
if (node.isResource()) {
parameter = node.asResource();
parameterUri = parameter.getURI();
paraProp = model.getProperty(parameterUri);
if (model.contains(taskResource, paraProp) && !parameters.containsKey(parameterUri)) {
ConfigurationParamValueBean paramBean = new ConfigurationParamValueBean();
paramBean.setId(parameterUri);
paramBean.setValue(RdfHelper.getStringValue(model, taskResource, paraProp));
parameters.put(parameterUri, paramBean);
}
}
}
}
示例3: parseValidationResult
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
private void parseValidationResult() {
final NodeIterator isValidProperty =
reportModel.listObjectsOfProperty(new PropertyImpl(DESCRIPTION_CONFORMS));
final boolean isValid = isValidProperty.next().asLiteral().getBoolean();
if (!isValid) {
for (Object subject : reportModel.listObjectsOfProperty(
new PropertyImpl(DESCRIPTION_RESULT)).toSet()) {
errors.put(subject.toString(), createErrorObject(reportModel, (Resource) subject));
}
}
}
示例4: getImageName
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
protected String getImageName(Model model, String subjUri) {
if (model == null) {
return null;
}
Resource subj = model.getResource(subjUri);
NodeIterator iterator = model.listObjectsOfProperty(subj, HOBBIT.imageName);
if (iterator.hasNext()) {
RDFNode node = iterator.next();
if (node.isLiteral()) {
return node.asLiteral().getString();
}
}
return null;
}
示例5: getAPIs
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
protected Set<String> getAPIs(Model model, Resource resource, boolean isBenchmark) {
Set<String> apis = new HashSet<>();
NodeIterator apisList = model.listObjectsOfProperty(resource,
isBenchmark ? HOBBIT.hasAPI : HOBBIT.implementsAPI);
while (apisList.hasNext()) {
RDFNode n = apisList.next();
apis.add(n.toString());
}
return apis;
}
示例6: getUsedImages
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
protected Set<String> getUsedImages(Model model, Resource resource) {
Set<String> images = new HashSet<>();
NodeIterator imagesList = model.listObjectsOfProperty(resource, HOBBIT.usesImage);
while (imagesList.hasNext()) {
RDFNode n = imagesList.next();
images.add(n.toString());
}
return images;
}
示例7: getImageName
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
protected static String getImageName(Model model, String subjUri) {
if (model == null) {
return null;
}
Resource subj = model.getResource(subjUri);
NodeIterator iterator = model.listObjectsOfProperty(subj, HOBBIT.imageName);
if (iterator.hasNext()) {
RDFNode node = iterator.next();
if (node.isLiteral()) {
return node.asLiteral().getString();
}
}
return null;
}
示例8: getAPIs
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
protected static Set<String> getAPIs(Model model, Resource resource, boolean isBenchmark) {
Set<String> apis = new HashSet<>();
NodeIterator apisList = model.listObjectsOfProperty(resource,
isBenchmark ? HOBBIT.hasAPI : HOBBIT.implementsAPI);
while (apisList.hasNext()) {
RDFNode n = apisList.next();
apis.add(n.toString());
}
return apis;
}
示例9: getChallengeTasksFromUri
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
private List<ExperimentConfiguration> getChallengeTasksFromUri(String challengeUri) {
Model model = getChallengeFromUri(challengeUri);
if (model == null) {
LOGGER.error("Couldn't get model for challenge {} . Aborting.", challengeUri);
return null;
}
Resource challengeResource = model.getResource(challengeUri);
Calendar executionDate = RdfHelper.getDateValue(model, challengeResource, HOBBIT.executionDate);
ResIterator taskIterator = model.listSubjectsWithProperty(HOBBIT.isTaskOf, challengeResource);
List<ExperimentConfiguration> experiments = new ArrayList<>();
while (taskIterator.hasNext()) {
Resource challengeTask = taskIterator.next();
String challengeTaskUri = challengeTask.getURI();
// get benchmark information
String benchmarkUri = RdfHelper.getStringValue(model, challengeTask, HOBBIT.involvesBenchmark);
String experimentId, systemUri, serializedBenchParams;
// iterate participating system instances
NodeIterator systemInstanceIterator = model.listObjectsOfProperty(challengeTask,
HOBBIT.involvesSystemInstance);
RDFNode sysInstance;
while (systemInstanceIterator.hasNext()) {
sysInstance = systemInstanceIterator.next();
if (sysInstance.isURIResource()) {
systemUri = sysInstance.asResource().getURI();
experimentId = generateExperimentId();
serializedBenchParams = RabbitMQUtils
.writeModel2String(createExpModelForChallengeTask(model, challengeTaskUri, systemUri));
experiments.add(new ExperimentConfiguration(experimentId, benchmarkUri, serializedBenchParams,
systemUri, challengeUri, challengeTaskUri, executionDate));
} else {
LOGGER.error("Couldn't get the benchmark for challenge task \"{}\". This task will be ignored.",
challengeTaskUri);
}
}
}
return experiments;
}
示例10: getSerializedSystemParams
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
protected static String getSerializedSystemParams(ExperimentConfiguration config, ImageManager imageManager) {
Model systemModel = imageManager.getSystemModel(config.systemUri);
Model benchmarkModel = imageManager.getBenchmarkModel(config.benchmarkUri);;
// Check the benchmark model for parameters that should be forwarded to the
// system
// if(benchmarkModel.contains(null, RDF.type, HOBBIT.ForwardedParameter)) {
if (benchmarkModel.contains(null, RDF.type, HOBBIT.ForwardedParameter)) {
Model benchParams = RabbitMQUtils.readModel(config.serializedBenchParams);
Property parameter;
NodeIterator objIterator;
Resource system = systemModel.getResource(config.systemUri);
Resource experiment = benchParams.getResource(Constants.NEW_EXPERIMENT_URI);
// Get an iterator for all these parameters
ResIterator iterator = benchmarkModel.listResourcesWithProperty(RDF.type, HOBBIT.ForwardedParameter);
while (iterator.hasNext()) {
// Get the parameter
parameter = benchmarkModel.getProperty(iterator.next().getURI());
// Get its value
objIterator = benchParams.listObjectsOfProperty(experiment, parameter);
// If there is a value, add it to the system model
while (objIterator.hasNext()) {
systemModel.add(system, parameter, objIterator.next());
}
}
}
return RabbitMQUtils.writeModel2String(systemModel);
}
示例11: parseBenchmarkParameters
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
/**
* Retrieves benchmark parameters of the given benchmark from the given RDF
* model and adds them to the given {@link BenchmarkBean}.
*
* @param model
* the RDF model containing the benchmark parameters
* @param benchmark
* the {@link Resource} representing the benchmark
* @param benchmarkBean
* the {@link BenchmarkBean} to which the parameters should be
* added
*/
public static void parseBenchmarkParameters(Model model, Resource benchmark, BenchmarkBean benchmarkBean) {
NodeIterator nodeIterator = model.listObjectsOfProperty(benchmark, HOBBIT.hasParameter);
RDFNode node;
if (nodeIterator.hasNext()) {
benchmarkBean.setConfigurationParams(new ArrayList<>());
benchmarkBean.setConfigurationParamNames(new ArrayList<>());
}
while (nodeIterator.hasNext()) {
node = nodeIterator.next();
if (node.isResource()) {
parseBenchmarkParameter(model, node.asResource(), benchmarkBean);
}
}
}
示例12: getChallengeTask
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
public static ChallengeTaskBean getChallengeTask(Model model, Resource taskResource) {
if (model == null) {
return null;
}
ChallengeTaskBean task = new ChallengeTaskBean();
task.setName(RdfHelper.getLabel(model, taskResource));
task.setDescription(RdfHelper.getDescription(model, taskResource));
Resource benchmarkResource = RdfHelper.getObjectResource(model, taskResource, HOBBIT.involvesBenchmark);
if (benchmarkResource != null) {
task.setBenchmark(createBenchmarkBean(model, benchmarkResource));
task.getBenchmark().setSystems(listSystemBeans(model, taskResource));
}
task.setConfigurationParams(createParamValueBeans(model, taskResource, benchmarkResource));
task.setId(taskResource.getURI());
List<String> rankingKPIs = new ArrayList<>();
Resource rankingKPIsSequence = RdfHelper.getObjectResource(model, taskResource, HOBBIT.rankingKPIs);
if (rankingKPIsSequence != null) {
SeqImpl sequence = new SeqImpl(rankingKPIsSequence, (ModelCom) model);
NodeIterator sequenceIterator = sequence.iterator();
while (sequenceIterator.hasNext()) {
RDFNode node = sequenceIterator.next();
if (node.isResource()) {
rankingKPIs.add(node.asResource().toString());
}
}
}
task.setRankingKPIs(rankingKPIs);
return task;
}
示例13: exportMembers
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
private void exportMembers(final Model model, final Set<URI> inboundMembers) {
for (final String p : config.getPredicates()) {
final NodeIterator members = model.listObjectsOfProperty(createProperty(p));
while (members.hasNext()) {
export(URI.create(members.nextNode().toString()));
}
}
if (inboundMembers != null) {
for (final URI inbound : inboundMembers) {
export(inbound);
}
}
}
示例14: objectsOfProperty
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
public static List<RDFNode> objectsOfProperty(Model model, Property property, Resource subject,
RDFNode objectToIgnore) {
List<RDFNode> objects = new ArrayList<>();
NodeIterator iterator = model.listObjectsOfProperty(subject, property);
while (iterator.hasNext()) {
RDFNode node = iterator.next();
if (!node.equals(objectToIgnore)) {
objects.add(node);
}
}
return objects;
}
示例15: getConcepts
import org.apache.jena.rdf.model.NodeIterator; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see eu.modelwriter.semantic.IBase#getConcepts()
*/
public Set<RDFNode> getConcepts() {
Set<RDFNode> concepts = new LinkedHashSet<RDFNode>();
final NodeIterator it = model.listObjects();
while (it.hasNext()) {
concepts.add(it.next());
}
return concepts;
}