Ejemplo n.º 1
0
  public Graph importJob(JobInstance job, final String baseUri) throws GoIntegrationException {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Attempting to import job " + job);
    }

    JobXmlViewModel xmlModel = new JobXmlViewModel(job);
    Graph jobGraph = rdfizer.importURIUsingGRDDL(xmlModel, baseUri);
    URIReference jobURI = jobGraph.getURIReference(xmlModel.httpUrl(baseUri));
    importArtifactsForJob(jobURI, jobGraph);

    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Done building jobs graph with " + jobGraph.size() + " triples");
    }

    return jobGraph;
  }
Ejemplo n.º 2
0
  private String jobArtifactsPath(URIReference jobResource, Graph jobsGraph) {
    String selectArtifactRoot =
        GoOntology.URI_PREFIX
            + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> "
            + "SELECT DISTINCT ?pathFromArtifactRoot WHERE { "
            + "<"
            + jobResource.getURIText()
            + "> cruise:hasArtifacts ?artifacts . "
            + "  ?artifacts a cruise:Artifacts . "
            + "  ?artifacts cruise:pathFromArtifactRoot ?pathFromArtifactRoot ."
            + "}";

    BoundVariables bv = jobsGraph.selectFirst(selectArtifactRoot);
    return (bv == null) ? null : bv.getString("pathFromArtifactRoot");
  }
Ejemplo n.º 3
0
  private List<String> unitTestArtifactPathsForJob(Graph graph, URIReference jobURI) {
    String selectArtifactPaths =
        GoOntology.URI_PREFIX
            + "prefix xsd: <http://www.w3.org/2001/XMLSchema#> "
            + "SELECT DISTINCT ?artifactPath WHERE { "
            + "<"
            + jobURI.getURIText()
            + "> cruise:hasArtifacts ?artifacts . "
            + "?artifacts a cruise:Artifacts . "
            + "?artifacts cruise:hasArtifact ?artifact . "
            + "?artifact cruise:artifactPath ?artifactPath . "
            + "?artifact cruise:artifactType 'unit'^^xsd:string "
            + "}";

    List<BoundVariables> bvs = graph.select(selectArtifactPaths);

    List<String> result = new ArrayList<>(bvs.size());
    for (BoundVariables bv : bvs) {
      result.add(bv.getString("artifactPath"));
    }
    return result;
  }