Skip to content

Proposing new SPARQL 1.1 compliance tests #305

@RobinTF

Description

@RobinTF

This is a follow-up issue to my comment in #243 (comment).
Here's a list of compliance tests I came up with, for review. If they don't contain any mistakes I plan on eventually creating a PR for each individual one:

Relative IRI

Dataset

default

Query

BASE <http://example.com/xxx/abc>
SELECT (<> AS ?res0) (<def> AS ?res1) (<#ghi> AS ?res2) (<./jkl> AS ?res3) (<../mno> AS ?res4) (</pqr> AS ?res5) {}

Expected Result

?res0	?res1	?res2	?res3	?res4	?res5
<http://example.com/xxx/abc>	<http://example.com/xxx/def>	<http://example.com/xxx/abc#ghi>	<http://example.com/xxx/jkl>	<http://example.com/mno>	<http://example.com/pqr>

Language Tags case insensitivity

Dataset

default

Query

SELECT (""@en = ""@EN AS ?res0) (LANG(""@en) = LANG(""@EN) AS ?res1) (STRLANG("", "en") = STRLANG("", "EN") AS ?res2) {}

Expected Result

?res0	?res1	?res2
true	true	true

Nested Graphs 1

Dataset

default

graph1.ttl

@prefix : <http://example.com/> .
:s :p :o
:s1 :p :o1

graph2.ttl

@prefix : <http://example.com/> .
:s :p :o
:s2 :p :o2

Query

PREFIX : <http://example.com/>
SELECT ?s ?o WHERE {
  GRAPH ?g {
    GRAPH ?g {
      ?s :p ?o
    }
  }
}
ORDER BY ?s ?o

Expected Result

?s	?o
<http://example.com/s> <http://example.com/o>
<http://example.com/s> <http://example.com/o>
<http://example.com/s1> <http://example.com/o1>
<http://example.com/s2> <http://example.com/o2>

Nested Graphs 2

Dataset

default

graph1.ttl

@prefix : <http://example.com/> .
:s :p :o
:s1 :p :o1

graph2.ttl

@prefix : <http://example.com/> .
:s :p :o
:s2 :p :o2

Query

PREFIX : <http://example.com/>
SELECT ?s ?o WHERE {
  GRAPH ?g1 {
    GRAPH ?g0 {
      ?s :p ?o
    }
  }
}
ORDER BY ?s ?o

Expected Result

?s	?o
<http://example.com/s> <http://example.com/o>
<http://example.com/s> <http://example.com/o>
<http://example.com/s> <http://example.com/o>
<http://example.com/s> <http://example.com/o>
<http://example.com/s1> <http://example.com/o1>
<http://example.com/s1> <http://example.com/o1>
<http://example.com/s2> <http://example.com/o2>
<http://example.com/s2> <http://example.com/o2>

Nested Graphs 3

Dataset

default

graph1.ttl

@prefix : <http://example.com/> .
:s :p :o
:s1 :p :o1

graph2.ttl

@prefix : <http://example.com/> .
:s :p :o
:s2 :p :o2

Query

PREFIX : <http://example.com/>
SELECT ?s ?o WHERE {
  GRAPH ?g {
    GRAPH <graph1.ttl> {
      ?s :p ?o
    }
  }
}
ORDER BY ?s ?o

Expected Result

?s	?o
<http://example.com/s> http://example.com/o>
<http://example.com/s> http://example.com/o>
<http://example.com/s1> http://example.com/o1>
<http://example.com/s1> http://example.com/o1>

Nested Graphs 4

Dataset

default

graph1.ttl

@prefix : <http://example.com/> .
:s :p :o
:s1 :p :o1

graph2.ttl

@prefix : <http://example.com/> .
:s :p :o
:s2 :p :o2

Query

PREFIX : <http://example.com/>
SELECT ?s ?o WHERE {
  GRAPH <graph1.ttl> {
    GRAPH ?g {
      ?s :p ?o
    }
  }
}
ORDER BY ?s ?o

Expected Result

?s	?o
<http://example.com/s> <http://example.com/o>
<http://example.com/s> <http://example.com/o>
<http://example.com/s1> <http://example.com/o1>
<http://example.com/s2> <http://example.com/o2>

Graph with VALUES

Dataset

default

graph1.ttl

@prefix : <> .
:s :p :o

graph2.ttl

@prefix : <> .
:s :p :o

Query

SELECT ?x ?g WHERE {
  GRAPH ?g {
    VALUES ?x { 1 2 }
  }
}
ORDER BY ?x ?g

Expected Result

?x	?g
1	<graph1.ttl>
1	<graph2.ttl>
2	<graph1.ttl>
2	<graph2.ttl>

Graph with LIMIT/OFFSET with VALUES

Dataset

default

graph1.ttl

@prefix : <> .
:s :p :o

graph2.ttl

@prefix : <> .
:s :p :o

Query

PREFIX : <http://example.com/>
SELECT ?x WHERE {
  GRAPH ?g {
    SELECT ?x {
      VALUES ?x { 1 2 3 }
    }
    ORDER BY ?x
    OFFSET 1
    LIMIT 1
  }
}

Expected Result

?x
2
2

Graph with LIMIT/OFFSET

Dataset

default

graph1.ttl

@prefix : <http://example.com/> .
:s :p :o
:s1 :p :o1
:s1 :p :o2
:s1 :p :o3

graph2.ttl

@prefix : <http://example.com/> .
:s :p :o
:s2 :p :o1
:s2 :p :o2

graph3.ttl

@prefix : <http://example.com/> .
:s :p :o

Query

PREFIX : <http://example.com/>
SELECT ?s ?o WHERE {
  GRAPH ?g {
    SELECT ?s ?o {
      ?s :p ?o
    }
    ORDER BY ?s ?o
    OFFSET 1
    LIMIT 2
  }
}
ORDER BY ?s ?o

Expected Result

?s	?o
<http://example.com/s1> <http://example.com/o1>
<http://example.com/s1> <http://example.com/o2>
<http://example.com/s2> <http://example.com/o1>
<http://example.com/s2> <http://example.com/o2>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions