我在 Sparql 中有一个很长的查询,我想按数字字段“sentiment”对结果进行排序,如果我在 SELECT 和 GROUPBY 中包含该字段,一切正常,否则会崩溃。但是我想呈现查询而不像在 SQL 查询中那样显示“情绪”字段。这在 SPARQL 中可行吗?
查询是:
SELECT ?Sentiment ?Restaurant ?Name ?Address ?Score ?City ?State (SAMPLE(?photo) as ?image) SAMPLE(?Text) as ?text) (SAMPLE(?Review) as ?review) (SAMPLE(?TStyle) as ?style) (SAMPLE(?TAmbiance) as ?ambient) (SAMPLE(?TService) as ?service)
where { ?Restaurant :hasName ?Name;
:Dish ?Dish;
:Score ?Score;
:hasAddress ?Address;
:photo ?photo;
:HasReview ?Review;
:Parking ?Parking;
:CreditCard ?CreditCard;
:Delivery ?Delivery;
:Kids ?Kids;
:hasTopic ?o;
:Sentiment ?Sentiment.
?Address :hasCity ?City;
:hasState ?State;
:Lat ?Lat;
:Long ?Long.
?Review :Text ?Text.
BIND (exists{?Restaurant :hasTopic :style} AS ?TStyle).
BIND (exists{?Restaurant :hasTopic :ambiance} AS ?TAmbiance).
BIND (exists{?Restaurant :hasTopic :service} AS ?TService).
FILTER(contains(str(?Text), "sushi"))
} GROUP BY ?Restaurant ?Name ?Address ?Score ?City ?State ?Sentiment
ORDER BY DESC((?Sentiment))
如何在不显示“情绪”字段本身或总体上改进查询的情况下形成查询并对结果进行排序?
谢谢。