SPARQL object classification examples - Amazon Neptune

SPARQL object classification examples

For SPARQL object classification in Neptune ML, the model is trained on one of the predicate values. This is useful where that predicate is not already present with a given subject.

Only categorical predicate values can be inferred using the object classification model.

The following query seeks to predict the <http://www.example.org/team> predicate value for all the inputs of type foaf:Person:

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 . } }

This query can be customized as follows:

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 . } }