zoukankan      html  css  js  c++  java
  • stardog graphql 简单操作

    预备环境:
    下载stardog 软件包

    graphql 查询地址

    • 创建一个简单数据库
    ./stardog-admin db create -nstarwars
    • graphql 查询方式
    http 地址:
    http://localhost:5820/starwars/graphql
    或者命令行:
    ./stardog graphql starwars "{ Human { name }}"
    curl -G -vsku admin:admin --data-urlencode query="{ Human { name }}" localhost:5820/starwars/graphql

    添加schema

    • 简单schema定义
    schema {
        query: QueryType
    }
    
    type QueryType {
        Character: Character
        Human(id: Int, first: Int, skip: Int, orderBy: ID): Human
        Droid(id: Int): Droid
    }
    
    interface Character {
        id: Int!
        name: String!
        friends(id: Int): [Character]
        appearsIn: [Episode]
    }
    
    type Human implements Character {
        iri: ID!
        id: Int!
        name: String!
        friends(id: Int): [Character]
        appearsIn: [Episode]
    }
    
    type Droid implements Character {
        id: Int!
        name: String!
        friends(id: Int): [Character]
        appearsIn: [Episode]
        primaryFunction: String
    }
    
    type Episode {
      index: Int!
      name: String!
    }
    • 添加schema
    ./stardog graphql schema --add characters starwars ../app.graphql
    • 查询schema
    http://localhost:5820/starwars/graphql/characters
    • 效果

    http basic 认证header 生成说明

    • 创建base64 编码
    echo "Basic $(echo -n "admin:admin" | base64)"
    • 添加header
    {
      "Authorization":"Basic YWRtaW46YWRtaW4="
    }

    参考资料

    https://www.stardog.com/docs/#_introduction_2

  • 相关阅读:
    poj2752Seek the Name, Seek the Fame【kmp next数组应用】
    poj1961Period【kmp next数组】
    poj2406(kmp next数组)
    KMP原理
    0529
    0428
    2045年4月25日
    0421
    黄金连分数【大数】
    学习linux内核时常碰到的汇编指令(1)
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/9672823.html
Copyright © 2011-2022 走看看