As far as I read from the grammar of SPARQL https://www.w3.org/TR/sparql11-query/#sparqlGrammar it is allowed to have literals as the subject in a triple:
[75] TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty | TriplesNode PropertyList
[106] VarOrTerm ::= Var | GraphTerm
[109] GraphTerm ::= iri | RDFLiteral | NumericLiteral | BooleanLiteral | BlankNode | NIL
So it would be possible to have a triple such as:
(3, rdfs:label, 'three')
I can handle such triples in Python's rdflib, but when I try to make a federated SPARQL query with SERVICE in Virtuoso version 06.01.3127, Virtuoso complains. Here is an error message from my execution at a local install at http://localhost:8890/sparql
Virtuoso 37000 Error SP031: SPARQL compiler: No one quad map pattern is suitable for GRAPH _:_::default_8_4 { 3 <http://www.w3.org/2000/01/rdf-schema#label> ?s } triple at line 8
SPARQL query:
define sql:big-data-const 0
#output-format:text/html
define sql:signal-void-variables 1 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?s WHERE {
SERVICE <http://127.0.0.1:5000/sparql> {
SELECT ?s WHERE {
3 rdfs:label ?s .
}
}
}
Is this a Virtuoso issue or is this a more general SPARQL/RDF issue, - or a programming error that I make?
TriplesSameSubject ::= VarOrTerm PropertyListNotEmpty
seems already to have been introduced in the first SPARQL w3.org/TR/rdf-sparql-query/#rTriplesSameSubject – Finn Årup Nielsen