SPARQL 对象预测示例 - Amazon Neptune
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

SPARQL 对象预测示例

对象预测预测给定主题和谓词的对象值。

以下对象预测查询试图预测类型为 foaf:Person 的输入喜欢什么电影:

?x a foaf:Person . ?x <http://www.example.org/likes> ?m . ?m a <http://www.example.org/movie> . ## Query SELECT * WHERE { ?input a foaf:Person . SERVICE neptune-ml:inference { neptune-ml:config neptune-ml:modelType 'OBJECT_PREDICTION' ; neptune-ml:input ?input ; neptune-ml:predicate <http://www.example.org/likes> ; neptune-ml:output ?output ; neptune-ml:outputClass <http://www.example.org/movie> . } }

查询本身可以按如下方式自定义:

SELECT * WHERE { ?input a foaf:Person . SERVICE neptune-ml:inference { neptune-ml:config neptune-ml:endpoint 'node-prediction-user-movie-prediction-endpoint' ; neptune-ml:iamRoleArn 'arn:aws:iam::0123456789:role/sagemaker-role' ; neptune-ml:limit "5"^^xsd:integer ; neptune-ml:batchSize "40"^^xsd:integer ; neptune-ml:threshold "0.1"^^xsd:double ; neptune-ml:timeout "1000"^^xsd:integer ; neptune-ml:outputScore ?score ; neptune-ml:modelType 'OBJECT_PREDICTION' ; neptune-ml:input ?input ; neptune-ml:predicate <http://www.example.org/likes> ; neptune-ml:output ?output ; neptune-ml:outputClass <http://www.example.org/movie> . } }