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


Java QuerySolution.contains方法代码示例

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


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

示例1: writeInputOutput

import org.apache.jena.query.QuerySolution; //导入方法依赖的package包/类
/**
 * Writes a single input or output to the Writer
 * @param inputOutput The input or output
 * @throws IOException Any errors in writing which may have occurred
 */
private void writeInputOutput(QuerySolution inputOutput) throws IOException {
    // List of options for this node
    List<String> nodeOptions = new ArrayList<>();
    nodeOptions.add("fillcolor=\"#94DDF4\"");

    // Label for the node
    String label;
    if (inputOutput.contains("label")) {
        label = inputOutput.get("label").toString();
    } else {
        label = rdfService.labelFromName(inputOutput.get("name").toString());
    }
    nodeOptions.add("label=\"" + label + "\"");

    // Write the line for the node
    String inputOutputName = rdfService.stepNameFromURI(gitPath, inputOutput.get("name").toString());
    writeLine("    \"" + inputOutputName + "\" [" + String.join(",", nodeOptions) + "];");
}
 
开发者ID:common-workflow-language,项目名称:cwlviewer,代码行数:24,代码来源:RDFDotWriter.java

示例2: writeSteps

import org.apache.jena.query.QuerySolution; //导入方法依赖的package包/类
/**
 * Writes a set of steps from a workflow to the Writer
 * @param workflowUri The URI of the workflow in the model
 * @param subworkflow Whether these are steps of a subworkflow
 * @throws IOException Any errors in writing which may have occurred
 */
private void writeSteps(String workflowUri, boolean subworkflow) throws IOException {

    ResultSet steps = rdfService.getSteps(workflowUri);
    Set<String> addedSteps = new HashSet<>();
    while (steps.hasNext()) {
        QuerySolution step = steps.nextSolution();
        String stepName = rdfService.stepNameFromURI(gitPath, step.get("step").toString());

        // Only write each step once
        if (!addedSteps.contains(stepName)) {
            String label;
            if (step.contains("label")) {
                label = step.get("label").toString();
            } else {
                label = rdfService.labelFromName(stepName);
            }

            // Distinguish nested workflows
            CWLProcess runType = rdfService.strToRuntype(step.get("runtype").toString());
            if (runType == CWLProcess.WORKFLOW) {
                writeLine("  \"" + stepName + "\" [label=\"" + label +
                        "\", fillcolor=\"#F3CEA1\"];");
            } else {
                writeLine("  \"" + stepName + "\" [label=\"" + label + "\"];");
            }
            addedSteps.add(stepName);
        }
    }

}
 
开发者ID:common-workflow-language,项目名称:cwlviewer,代码行数:37,代码来源:RDFDotWriter.java

示例3: generateTestFromResult

import org.apache.jena.query.QuerySolution; //导入方法依赖的package包/类
private Optional<TestCase> generateTestFromResult(TestGenerator tg, Pattern tgPattern, QuerySolution row, SchemaSource schemaSource) {
    Set<String> references = new HashSet<>();
    String description;

    Collection<Binding> bindings = new ArrayList<>();
    for (PatternParameter p : tgPattern.getParameters()) {
        if (row.contains(p.getId())) {
            RDFNode n = row.get(p.getId());
            Binding b;
            try {
                b = new Binding(p, n);
            } catch (NullPointerException | IllegalArgumentException e) {
                log.error("Non valid binding for parameter {} in AutoGenerator: {}", p.getId(), tg.getUri(), e);
                continue;
            }
            bindings.add(b);
            if (n.isResource() && !"loglevel".equalsIgnoreCase(p.getId())) {
                references.add(n.toString().trim().replace(" ", ""));
            }
        } else {
            log.error("Not bindings for parameter {} in AutoGenerator: {}", p.getId(), tg.getUri());
            break;
        }
    }
    if (bindings.size() != tg.getPattern().getParameters().size()) {
        log.error("Bindings for pattern {} do not match in AutoGenerator: {}", tgPattern.getId(), tg.getUri());
        return Optional.empty();
    }

    if (row.get("DESCRIPTION") != null) {
        description = row.get("DESCRIPTION").toString();
    } else {
        log.error("No ?DESCRIPTION variable found in AutoGenerator: {}", tg.getUri());
        return Optional.empty();
    }


    Set<ResultAnnotation> patternBindedAnnotations = tgPattern.getBindedAnnotations(bindings);
    patternBindedAnnotations.addAll(tg.getAnnotations());
    Resource tcResource = ResourceFactory.createResource(TestUtils.generateTestURI(schemaSource.getPrefix(), tgPattern, bindings, tg.getUri()));
    PatternBasedTestCaseImpl tc = new PatternBasedTestCaseImpl(
            tcResource,
            new TestCaseAnnotation(
                    tcResource, TestGenerationType.AutoGenerated,
                    tg.getUri(),
                    schemaSource.getSourceType(),
                    schemaSource.getUri(),
                    references,
                    description,
                    null,
                    patternBindedAnnotations),
            tgPattern,
            bindings
    );
    new TestCaseValidator(tc).validate();
    return Optional.of(tc);
}
 
开发者ID:AKSW,项目名称:RDFUnit,代码行数:58,代码来源:TagRdfUnitTestGenerator.java


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