我想知道在另一个SELECT中应用计数后如何在sparql查询中获取MAX值。我的代码是:
resource "aws_api_gateway_integration" "integration" {
...
...
uri = "arn:aws:apigateway:{region}:firehose:PutRecord/{service_api}"
}
非常感谢!
答案 0 :(得分:1)
在我们开始调试之前,您的查询应采用标准的SPARQL语法:
SELECT ?advisorName (MAX(?c) AS ?m)
WHERE
{ { SELECT ?advisorName (COUNT(DISTINCT ?category) AS ?c)
WHERE
{ ?student rdf:type nobel:Laureate ;
owl:sameAs ?dbpStudent ;
foaf:name ?studentName ;
nobel:nobelPrize ?pStudent .
?pStudent nobel:category ?category
FILTER ( afn:namespace(?dbpStudent) = str(dbr:) )
SERVICE <http://dbpedia.org/sparql>
{ { ?dbpStudent dbo:doctoralAdvisor ?dbpAdvisor }
UNION
{ ?dbpAdvisor dbo:doctoralStudent ?dbpStudent }
?dbpAdvisor rdfs:label ?advisorName
FILTER ( lang(?advisorName) = "en" )
}
}
GROUP BY ?advisorName
}
}
GROUP BY ?advisorName
ORDER BY DESC(?c)
我不理解的东西:
group by
上有?dbpStudent
,因为没有这样的绑定,因为它没有被内部SELECT查询返回所以我的问题是,查询的总体目标是什么?
一旦我们确定了您的查询应该做什么,我们就可以通过检查中间结果来开始调试。