Skip to content

Instantly share code, notes, and snippets.

@crapthings
Last active July 23, 2018 03:44
Show Gist options
  • Save crapthings/21f5d40369016cafdda443cf5fb7e47d to your computer and use it in GitHub Desktop.
Save crapthings/21f5d40369016cafdda443cf5fb7e47d to your computer and use it in GitHub Desktop.

基础

查看所有三元组

SELECT * WHERE {
  ?subject ?predict ?object .
}

'?' 代表 变量 '*' 代表 输出所有表达式里的变量 '.' 代表 每行的结尾,单行可以省略

查看所有用户创建的三元组

SELECT * WHERE {
  GRAPH ?g { ?subject ?predict ?object } .
}
SELECT DISTINCT * WHERE {
  ?things a ?type .  
}

'DISTINCT' 代表 去重复 'a' 代表 rdf:type

查看所有 owl 类

SELECT DISTINCT * WHERE {
  ?classes a owl:Class .
  # ?classes a ?type . 
}

查看所有个体

SELECT DISTINCT * WHERE {
  ?individuals a owl:NamedIndividual .  
}

查看所有对象(宾语、受词)属性

SELECT DISTINCT * WHERE {
  ?objectProperties a owl:ObjectProperty .  
}

查看所有对象(个体、数据)属性

SELECT DISTINCT * WHERE {
  ?objectProperties a owl:DatatypeProperty .  
}

查看已有的关联

SELECT DISTINCT * WHERE {
  ?node1 ?edge ?node2 .
  ?edge a owl:ObjectProperty .
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment