我正在编写一个 SPARQL 查询,其中我正在创建一个 RDF 图。我正在使用 SPARQL 构造。作为我工作的要求,我必须连接两个主题值并将其与 CONSTRUCT 语句一起使用。我试图做以下事情(我的 RDF 图在 Virtuoso 中):
prefix map: <#>
prefix db: <>
prefix vocab: <vocab/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#>
prefix jdbc: <http://d2rq.org/terms/jdbc/>
prefix fn: <http://www.w3.org/2005/xpath-functions#>
CONSTRUCT {
?p1 a d2rq:ClassMap
}
FROM <http://www.ndssl.bi.vt.edu/fuse>
WHERE
{
<http://www.ndssl.bi.vt.edu/fuse#DataSource> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class>.
<http://www.ndssl.bi.vt.edu/fuse#OracleDataSource> <http://www.w3.org/2000/01/rdf-schema#subClassOf> <http://www.ndssl.bi.vt.edu/fuse#DataSource>.
?DB <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.ndssl.bi.vt.edu/fuse#OracleDataSource>.
<http://www.ndssl.bi.vt.edu/fuse#HouseholdsWithinAdminRegion> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class>.
?Table <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.ndssl.bi.vt.edu/fuse#HouseholdsWithinAdminRegion>.
BIND(CONCAT(?DB, ?Table) AS ?p1)
}
但是,我收到以下错误:
Virtuoso RDF01 Error Bad variable value in CONSTRUCT: "http://www.ndssl.bi.vt.edu/fuse#PROTOPOPhttp://www.ndssl.bi.vt.edu/fuse#MIAMI_HOUSEHOLD_2009_1" (tag 246 box flags 0) is not a valid subject, only object of a triple can be a literal
请让我知道如何解决它。