當前位置: 首頁>>代碼示例>>Java>>正文


Java Resource.getURI方法代碼示例

本文整理匯總了Java中org.apache.jena.rdf.model.Resource.getURI方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.getURI方法的具體用法?Java Resource.getURI怎麽用?Java Resource.getURI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.jena.rdf.model.Resource的用法示例。


在下文中一共展示了Resource.getURI方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: modelToBenchmarkMetaData

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
public BenchmarkMetaData modelToBenchmarkMetaData(Model model) throws Exception {
    BenchmarkMetaData result = new BenchmarkMetaData();

    // find benchmark subject
    Resource benchmark = getResource(model, HOBBIT.Benchmark);
    // if there is no benchmark resource
    if (benchmark == null) {
        LOGGER.error("Couldn't find a benchmark resource in the given benchmark meta data model. Returning null.");
        return null;
    }
    // set URI
    result.benchmarkUri = benchmark.getURI();
    // find name
    result.benchmarkName = getName(model, benchmark);
    // find description
    result.benchmarkDescription = getDescription(model, benchmark);
    // find APIs
    result.implementedApis = getAPIs(model, benchmark, true);
    // find used images
    result.usedImages = getUsedImages(model, benchmark);

    return result;
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:24,代碼來源:ImageManagerImpl.java

示例2: modelToSystemMetaData

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
public List<SystemMetaData> modelToSystemMetaData(Model model) throws Exception {
    List<SystemMetaData> results = new ArrayList<>();

    // find all system subjects
    List<Resource> systems = getResources(model, HOBBIT.SystemInstance);
    for (Resource system : systems) {
        SystemMetaData result = new SystemMetaData();
        // set URI
        result.systemUri = system.getURI();
        // find name
        result.systemName = getName(model, system);
        // find description
        result.systemDescription = getDescription(model, system);
        // find image name
        result.system_image_name = getImage(model, system);
        // find APIs
        result.implementedApis = getAPIs(model, system, false);
        // find used images
        result.usedImages = getUsedImages(model, system);
        // append to results
        results.add(result);
    }

    return results;
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:26,代碼來源:ImageManagerImpl.java

示例3: getBenchmarkUri

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
protected String getBenchmarkUri(Model model) {
    // find benchmark subject
    Resource benchmark = null;
    ResIterator subjects = model.listSubjectsWithProperty(RDF.type, HOBBIT.Benchmark);
    if (subjects.hasNext()) {
        benchmark = subjects.next();
    }

    // check if benchmark was actually found
    if (benchmark == null) {
        return null;
    }

    // set URI
    return benchmark.getURI();
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:17,代碼來源:ImageManagerImpl.java

示例4: modelToBenchmarkMetaData

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
protected static ExtBenchmarkMetaData modelToBenchmarkMetaData(Model model, Resource benchmark) throws Exception {
    ExtBenchmarkMetaData result = new ExtBenchmarkMetaData();

    // set URI
    result.benchmarkUri = benchmark.getURI();
    // find name
    result.benchmarkName = getName(model, benchmark);
    // find description
    result.benchmarkDescription = getDescription(model, benchmark);
    // find APIs
    result.implementedApis = getAPIs(model, benchmark, true);

    result.model = model;

    return result;
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:17,代碼來源:FileBasedImageManager.java

示例5: getBenchmarkUri

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
protected static String getBenchmarkUri(Model model) {
    // find benchmark subject
    Resource benchmark = null;
    ResIterator subjects = model.listSubjectsWithProperty(RDF.type, HOBBIT.Benchmark);
    if (subjects.hasNext()) {
        benchmark = subjects.next();
    }

    // check if benchmark was actually found
    if (benchmark == null) {
        return null;
    }

    // set URI
    return benchmark.getURI();
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:17,代碼來源:FileBasedImageManager.java

示例6: createBenchmarkBean

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
/**
 * Creates a {@link BenchmarkBean} from the given RDF model by collecting
 * all benchmark-relevant information found for the given benchmark
 * {@link Resource}.
 *
 * @param model
 *            the RDF model containing the benchmark model
 * @param benchmarkResource
 *            the {@link Resource} representing the benchmark
 * @return a {@link BenchmarkBean} containing the found information
 */
public static <T extends BenchmarkBean> T createBenchmarkBean(Model model, Resource benchmarkResource, T bean) {
    String label = RdfHelper.getLabel(model, benchmarkResource);
    if (label == null) {
        label = benchmarkResource.getURI();
        LOGGER.info("Benchmark {} model does not have a label.", label);
    }
    String description = RdfHelper.getDescription(model, benchmarkResource);
    if (description == null) {
        LOGGER.info("Benchmark {} model does not have a description.", benchmarkResource.getURI());
    }

    bean.setId(benchmarkResource.getURI());
    bean.setName(label);
    bean.setDescription(description);
    parseBenchmarkParameters(model, benchmarkResource, bean);

    Map<String, KeyPerformanceIndicatorBean> kpiMap = new HashMap<>();
    createKPIBeans(model, benchmarkResource, model.listResourcesWithProperty(RDF.type, HOBBIT.KPI), kpiMap);
    bean.setKpis(new ArrayList<>(kpiMap.values()));
    return bean;
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:33,代碼來源:RdfModelHelper.java

示例7: createParamValueBeans

import org.apache.jena.rdf.model.Resource; //導入方法依賴的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);
            }
        }
    }
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:22,代碼來源:RdfModelHelper.java

示例8: getTriples

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
/**
 * Gets all triples for resource r and property p. If outgoing is true it
 * returns all triples with <r,p,o>, else <s,p,r>
 *
 * @param r
 *            the resource
 * @param p
 *            the property
 * @param outgoing
 *            whether to get outgoing or ingoing triples
 * @return A set of triples
 */
public Set<Triple> getTriples(Resource r, Property p, boolean outgoing) {
	Set<Triple> result = new HashSet<Triple>();
	try {
		String q;
		if (outgoing) {
			q = "SELECT ?o where { <" + r.getURI() + "> <" + p.getURI() + "> ?o." + "?o rdfs:label []}";
		} else {
			q = "SELECT ?o where { ?o <" + p.getURI() + "> <" + r.getURI() + ">." + "?o rdfs:label []}";
		}
		q += " LIMIT " + maxShownValuesPerProperty + 1;
		QueryExecution qe = qef.createQueryExecution(q);
		ResultSet results = qe.execSelect();
		if (results.hasNext()) {
			while (results.hasNext()) {
				RDFNode n = results.next().get("o");
				result.add(Triple.create(r.asNode(), p.asNode(), n.asNode()));
			}
		}
		qe.close();
	} catch (Exception e) {
		e.printStackTrace();
	}
	return result;
}
 
開發者ID:dice-group,項目名稱:BENGAL,代碼行數:37,代碼來源:Verbalizer.java

示例9: Label

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
protected Label(Resource resource, String value, Language language) throws ModelException {
	try {
		this.resource = resource;
		this.uri = new URI(resource.getURI());
		this.value = value;
		this.language = language;
	} catch (URISyntaxException e) {
		throw new ModelException("Unable to generate URI from resource: '%s'", resource.toString());
	}
}
 
開發者ID:Smartlogic-Semaphore-Limited,項目名稱:Java-APIs,代碼行數:11,代碼來源:Label.java

示例10: evaluateString

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
@Override
public String evaluateString(EvaluationContext ctx, Element elt) {
	Resource res = resourceMap.get(elt);
	if (res.isAnon()) {
		return "";
	}
	return res.getURI();
}
 
開發者ID:Bibliome,項目名稱:alvisnlp,代碼行數:9,代碼來源:URILibrary.java

示例11: getNodeValue

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
private static String getNodeValue(RDFNode node) {
	if (node.isLiteral()) {
		Literal lit = node.asLiteral();
		return lit.getLexicalForm();
	}
	if (node.isResource()) {
		Resource res = node.asResource();
		return res.getURI();
	}
	throw new RuntimeException("RDF node " + node + " is neither a literal nor a resource!");
}
 
開發者ID:Bibliome,項目名稱:alvisnlp,代碼行數:12,代碼來源:RDFProjector.java

示例12: modelToSystemMetaData

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
public List<SystemMetaData> modelToSystemMetaData(Model model) throws Exception {
    List<SystemMetaData> results = new ArrayList<>();

    // find all system subjects
    List<Resource> systems = RdfHelper.getSubjectResources(model, RDF.type, HOBBIT.SystemInstance);
    for (Resource system : systems) {
        ExtSystemMetaData result = new ExtSystemMetaData();
        // set URI
        result.systemUri = system.getURI();
        // find name
        result.systemName = getName(model, system);
        // find description
        result.systemDescription = getDescription(model, system);
        // find image name
        result.system_image_name = getImage(model, system);
        // find APIs
        result.implementedApis = getAPIs(model, system, false);
        // FIXME We should query the part of the model that is important for
        // the system instead of adding everything
        result.model = model;
        // find used images
        result.usedImages = getUsedImages(model, system);
        // append to results
        results.add(result);
    }

    return results;
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:29,代碼來源:FileBasedImageManager.java

示例13: getChallengeTasksFromUri

import org.apache.jena.rdf.model.Resource; //導入方法依賴的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;
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:38,代碼來源:PlatformController.java

示例14: getSystemBean

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
public static SystemBean getSystemBean(Model model, Resource systemResource) {
    if (model == null) {
        return null;
    }
    return new SystemBean(systemResource.getURI(), RdfHelper.getLabel(model, systemResource),
            RdfHelper.getDescription(model, systemResource));
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:8,代碼來源:RdfModelHelper.java

示例15: createKPIBeans

import org.apache.jena.rdf.model.Resource; //導入方法依賴的package包/類
private static void createKPIBeans(Model model, Resource resource, ResIterator parameterIterator,
        Map<String, KeyPerformanceIndicatorBean> kpis) {
    Resource kpi;
    Property kpiProp;
    String parameterUri;
    while (parameterIterator.hasNext()) {
        kpi = parameterIterator.next();
        parameterUri = kpi.getURI();
        kpiProp = model.getProperty(parameterUri);
        // If the KPI has not been seen before AND (it is either used as
        // property with the given resource OR the given resource is
        // connected via hobbit:measuresKPI with the KPI)
        if ((model.contains(resource, kpiProp) || model.contains(resource, HOBBIT.measuresKPI, kpi))
                && !kpis.containsKey(parameterUri)) {
            KeyPerformanceIndicatorBean kpiBean = new KeyPerformanceIndicatorBean();
            kpiBean.setId(parameterUri);
            kpiBean.setValue(RdfHelper.getStringValue(model, resource, kpiProp));

            kpiBean.setName(RdfHelper.getLabel(model, kpiProp));
            if (kpiBean.getName() == null) {
                kpiBean.setName(kpi.getURI());
                LOGGER.info("The benchmark parameter {} does not have a label.", kpi.getURI());
            }
            kpiBean.setDescription(RdfHelper.getDescription(model, kpiProp));
            if (kpiBean.getDescription() == null) {
                LOGGER.info("The benchmark parameter {} does not have a description.", kpi.getURI());
            }
            NodeIterator nodeIterator = model.listObjectsOfProperty(kpi, RDFS.range);
            RDFNode node;
            if (nodeIterator.hasNext()) {
                node = nodeIterator.next();
                if (node.isResource()) {
                    Resource typeResource = node.asResource();
                    kpiBean.setRange(typeResource.getURI());
                    // If this is an XSD resource
                    if (XSD.getURI().equals(typeResource.getNameSpace())) {
                        kpiBean.setDatatype(parseXsdType(typeResource));
                    }
                }
            }
            Resource ranking = RdfHelper.getObjectResource(model, kpi, HOBBIT.ranking);
            if (ranking != null) {
                kpiBean.setRanking(ranking.toString());
            }
            kpis.put(parameterUri, kpiBean);
        }
    }
}
 
開發者ID:hobbit-project,項目名稱:platform,代碼行數:49,代碼來源:RdfModelHelper.java


注:本文中的org.apache.jena.rdf.model.Resource.getURI方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。