PREFIX rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rpath: <https://w3id.org/lodsight/rdf-path#>
PREFIX spin:  <http://spinrdf.org/spin#>

CONSTRUCT {
  [] a spin:ConstraintViolation ;
    spin:violationRoot ?path ;
    spin:violationPath rpath:start ;
    rdfs:label "Path is not continuous."@en .
}
WHERE {
  {
    SELECT ?path
    WHERE {
      ?path a rpath:Path ;
        rpath:edges/rdf:rest*/rdf:first ?edge .
      ?edge rpath:start ?start .
      FILTER NOT EXISTS {
        [] rpath:end ?start .
      }
    }
    GROUP BY ?path
    HAVING (COUNT(DISTINCT ?start) > 1)
  }
}

PREFIX rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rpath: <https://w3id.org/lodsight/rdf-path#>
PREFIX spin:  <http://spinrdf.org/spin#>

CONSTRUCT {
  [] a spin:ConstraintViolation ;
    spin:violationRoot ?next ;
    spin:violationPath rpath:start ;
    spin:violationValue ?o ;
    rdfs:label "Path is not continuous."@en .
}
WHERE {
  [] rdf:first/rpath:end/rdf:type ?o ;
    rdf:rest/rdf:first ?next .
  FILTER NOT EXISTS {
    ?next rpath:start/rdf:type ?o .
  }
}
