Neptune のフルテキスト検索を使用した SPARQL クエリの例 - Amazon Neptune

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

Neptune のフルテキスト検索を使用した SPARQL クエリの例

Amazon Neptune でフルテキスト検索を使用した SPARQL クエリの例は次のとおりです。

SPARQL の match クエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint.com' . neptune-fts:config neptune-fts:queryType 'match' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:query 'michael' . neptune-fts:config neptune-fts:return ?res . } }

SPARQL の prefix クエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint.com' . neptune-fts:config neptune-fts:queryType 'prefix' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:query 'mich' . neptune-fts:config neptune-fts:return ?res . } }

SPARQL の fuzzy クエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint.com' . neptune-fts:config neptune-fts:queryType 'fuzzy' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:query 'mikael' . neptune-fts:config neptune-fts:return ?res . } }

SPARQL の term クエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint.com' . neptune-fts:config neptune-fts:queryType 'term' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:query 'Dr. Kunal' . neptune-fts:config neptune-fts:return ?res . } }

SPARQL の query_string クエリの例

このクエリは、複数のフィールドを指定します。

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint.com' . neptune-fts:config neptune-fts:queryType 'query_string' . neptune-fts:config neptune-fts:query 'mikael~ OR rondelli' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:field foaf:surname . neptune-fts:config neptune-fts:return ?res . } }

SPARQL の simple_query_string クエリの例

次のクエリでは、ワイルドカード ('*') 文字を使用してフィールドを指定します。

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint.com' . neptune-fts:config neptune-fts:queryType 'simple_query_string' . neptune-fts:config neptune-fts:query 'mikael~ | rondelli' . neptune-fts:config neptune-fts:field '*' . neptune-fts:config neptune-fts:return ?res . } }

SPARQL 文字列フィールドによる並べ替えのクエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint' . neptune-fts:config neptune-fts:queryType 'query_string' . neptune-fts:config neptune-fts:query 'mikael~ | rondelli' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:sortOrder 'asc' . neptune-fts:config neptune-fts:sortBy foaf:name . neptune-fts:config neptune-fts:return ?res . } }

SPARQL 非文字列フィールドによる並べ替えのクエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint' . neptune-fts:config neptune-fts:queryType 'query_string' . neptune-fts:config neptune-fts:query 'mikael~ | rondelli' . neptune-fts:config neptune-fts:field foaf:name.value . neptune-fts:config neptune-fts:sortOrder 'asc' . neptune-fts:config neptune-fts:sortBy dc:date.value . neptune-fts:config neptune-fts:return ?res . } }

SPARQL ID によるソートのクエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint' . neptune-fts:config neptune-fts:queryType 'query_string' . neptune-fts:config neptune-fts:query 'mikael~ | rondelli' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:sortOrder 'asc' . neptune-fts:config neptune-fts:sortBy 'Neptune#fts.entity_id' . neptune-fts:config neptune-fts:return ?res . } }

SPARQL ラベル によるソートのクエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint' . neptune-fts:config neptune-fts:queryType 'query_string' . neptune-fts:config neptune-fts:query 'mikael~ | rondelli' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:sortOrder 'asc' . neptune-fts:config neptune-fts:sortBy 'Neptune#fts.entity_type' . neptune-fts:config neptune-fts:return ?res . } }

SPARQL doc_type によるソートのクエリの例

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint' . neptune-fts:config neptune-fts:queryType 'query_string' . neptune-fts:config neptune-fts:query 'mikael~ | rondelli' . neptune-fts:config neptune-fts:field foaf:name . neptune-fts:config neptune-fts:sortOrder 'asc' . neptune-fts:config neptune-fts:sortBy 'Neptune#fts.document_type' . neptune-fts:config neptune-fts:return ?res . } }

SPARQL で Lucene 構文を使用する例

Lucene 構文は OpenSearch の query_string クエリでのみサポートされています。

PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX neptune-fts: <http://aws.amazon.com/neptune/vocab/v01/services/fts#> SELECT * WHERE { SERVICE neptune-fts:search { neptune-fts:config neptune-fts:endpoint 'http://your-es-endpoint' . neptune-fts:config neptune-fts:queryType 'query_string' . neptune-fts:config neptune-fts:queryType 'query_string' . neptune-fts:config neptune-fts:query 'predicates.\\foaf\\name.value:micheal AND predicates.\\foaf\\surname.value:sh' . neptune-fts:config neptune-fts:field ‘’ . neptune-fts:config neptune-fts:return ?res . } }