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

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

SPARQL 对象分类示例

对于 Neptune ML 中的 SPARQL 对象分类,模型是根据其中一个谓词值进行训练的。当给定主题中还没有该谓词时,这很有用。

使用对象分类模型只能推理分类谓词值。

下面的查询试图预测类型为 foaf:Person 的所有输入的 <http://www.example.org/team> 谓词值:

SELECT * WHERE { ?input a foaf:Person . SERVICE neptune-ml:inference { neptune-ml:config neptune-ml:modelType 'OBJECT_CLASSIFICATION' ; neptune-ml:input ?input ; neptune-ml:predicate <http://www.example.org/team> ; neptune-ml:output ?output . } }

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

SELECT * WHERE { ?input a foaf:Person . SERVICE neptune-ml:inference { neptune-ml:config neptune-ml:endpoint 'node-prediction-account-balance-endpoint' ; neptune-ml:iamRoleArn 'arn:aws:iam::0123456789:role/sagemaker-role' ; neptune-ml:batchSize "40"^^xsd:integer ; neptune-ml:timeout "1000"^^xsd:integer ; neptune-ml:modelType 'OBJECT_CLASSIFICATION' ; neptune-ml:input ?input ; neptune-ml:predicate <http://www.example.org/team> ; neptune-ml:output ?output . } }