View a markdown version of this page

제한이 있는 관계 조회에 대한 explain 출력 예제 - Amazon Neptune

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

제한이 있는 관계 조회에 대한 explain 출력 예제

이 쿼리는 route 유형을 사용하여 두 익명 노드 간의 관계를 찾고 최대 10개를 반환합니다. 다시 말하지만 explain 모드는 details이고, 출력 형식은 기본 ASCII 형식입니다.

여기서 DFEPipelineScan은 익명 노드 ?anon_node7에서 시작하여 다른 익명 노드 ?anon_node21에서 끝나는 엣지를 스캔하며, 관계 유형은 ?p_type1로 저장됩니다. ?p_type1에 대한 필터가 el://route(여기서 el은 엣지 레이블 약자)가 되며, 쿼리 문자열에서 [p:route]에 해당합니다.

DFEDrainArguments 열과 같이 10으로 제한된 출력 솔루션을 수집합니다. DFEDrain은 제한에 도달하거나 모든 솔루션이 생성되면 종료됩니다(둘 중 먼저 발생하는 시점).

이 쿼리explain를 호출하려면:

AWS CLI
aws neptunedata execute-open-cypher-explain-query \ --endpoint-url https://your-neptune-endpoint:port \ --open-cypher-query "MATCH ()-[p:route]->() RETURN p LIMIT 10" \ --explain-mode details

자세한 내용은 AWS CLI 명령 참조의 execute-open-cypher-explain-query를 참조하세요.

SDK
import boto3 from botocore.config import Config client = boto3.client( 'neptunedata', endpoint_url='https://your-neptune-endpoint:port', config=Config(read_timeout=None, retries={'total_max_attempts': 1}) ) response = client.execute_open_cypher_explain_query( openCypherQuery='MATCH ()-[p:route]->() RETURN p LIMIT 10', explainMode='details' ) print(response['results'].read().decode('utf-8'))

다른 언어의 AWS SDK 예제는 섹션을 참조하세요AWS SDK.

awscurl
awscurl https://your-neptune-endpoint:port/openCypher \ --region us-east-1 \ --service neptune-db \ -X POST \ -d "query=MATCH ()-[p:route]->() RETURN p LIMIT 10" \ -d "explain=details"
참고

이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. us-east-1을 Neptune 클러스터의 리전으로 바꿉니다.

curl
curl https://your-neptune-endpoint:port/openCypher \ -d "query=MATCH ()-[p:route]->() RETURN p LIMIT 10" \ -d "explain=details"

explain 출력:

Query: MATCH ()-[p:route]->() RETURN p LIMIT 10 ╔════╤════════╤════════╤═══════════════════╤════════════════════╤═════════════════════╤══════════╤═══════════╤═══════╤═══════════╗ ║ ID │ Out #1 │ Out #2 │ Name │ Arguments │ Mode │ Units In │ Units Out │ Ratio │ Time (ms) ║ ╠════╪════════╪════════╪═══════════════════╪════════════════════╪═════════════════════╪══════════╪═══════════╪═══════╪═══════════╣ ║ 0 │ 1 │ - │ SolutionInjection │ solutions=[{}] │ - │ 0 │ 1 │ 0.00 │ 0 ║ ╟────┼────────┼────────┼───────────────────┼────────────────────┼─────────────────────┼──────────┼───────────┼───────┼───────────╢ ║ 1 │ 2 │ - │ DFESubquery │ subQuery=subQuery1 │ - │ 0 │ 10 │ 0.00 │ 5.00 ║ ╟────┼────────┼────────┼───────────────────┼────────────────────┼─────────────────────┼──────────┼───────────┼───────┼───────────╢ ║ 2 │ - │ - │ TermResolution │ vars=[?p] │ id2value_opencypher │ 10 │ 10 │ 1.00 │ 1.00 ║ ╚════╧════════╧════════╧═══════════════════╧════════════════════╧═════════════════════╧══════════╧═══════════╧═══════╧═══════════╝ subQuery1 ╔════╤════════╤════════╤═════════════════╤═══════════════════════════════════════════════════════════╤══════╤══════════╤═══════════╤═══════╤═══════════╗ ║ ID │ Out #1 │ Out #2 │ Name │ Arguments │ Mode │ Units In │ Units Out │ Ratio │ Time (ms) ║ ╠════╪════════╪════════╪═════════════════╪═══════════════════════════════════════════════════════════╪══════╪══════════╪═══════════╪═══════╪═══════════╣ ║ 0 │ 1 │ - │ DFEPipelineScan │ pattern=Edge((?anon_node7)-[?p:?p_type1]->(?anon_node21)) │ - │ 0 │ 1000 │ 0.00 │ 0.66 ║ ║ │ │ │ │ inlineFilters=[(?p_type1 IN [<el://route>])] │ │ │ │ │ ║ ║ │ │ │ │ patternEstimate=26219 │ │ │ │ │ ║ ╟────┼────────┼────────┼─────────────────┼───────────────────────────────────────────────────────────┼──────┼──────────┼───────────┼───────┼───────────╢ ║ 1 │ 2 │ - │ DFEProject │ columns=[?p] │ - │ 1000 │ 1000 │ 1.00 │ 0.14 ║ ╟────┼────────┼────────┼─────────────────┼───────────────────────────────────────────────────────────┼──────┼──────────┼───────────┼───────┼───────────╢ ║ 2 │ - │ - │ DFEDrain │ limit=10 │ - │ 1000 │ 0 │ 0.00 │ 0.11 ║ ╚════╧════════╧════════╧═════════════════╧═══════════════════════════════════════════════════════════╧══════╧══════════╧═══════════╧═══════╧═══════════╝