public class Utility extends Object
| Constructor and Description |
|---|
Utility() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkTypesCompatible(Type parent,
Type child) |
static void |
computeRoleCombinations(Set<String> vars,
Set<RoleType> roles,
Map<String,String> roleMap,
Set<Map<String,String>> roleMaps) |
static String |
createFreshVariable(Set<String> vars,
String var)
generate a fresh variable avoiding global variables and variables from the same query
|
static Rule |
createPropertyChainRule(RelationType relation,
String fromRoleName,
String toRoleName,
LinkedHashMap<RelationType,javafx.util.Pair<String,String>> chain,
GraknGraph graph) |
static Rule |
createReflexiveRule(RelationType relType,
GraknGraph graph)
create reflexive rule R(from: X, to: X) :- R(from: X,to: Y)
|
static Rule |
createSubPropertyRule(RelationType parent,
RelationType child,
Map<String,String> roleMappings,
GraknGraph graph)
creates rule parent :- child
|
static Rule |
createTransitiveRule(RelationType relType,
String fromRoleName,
String toRoleName,
GraknGraph graph)
create transitive rule R(from: X, to: Y) :- R(from: X,to: Z), R(from: Z, to: Y)
|
static Set<RoleType> |
getCompatibleRoleTypes(Type type,
Type relType) |
static Set<RoleType> |
getNonMetaSuperRoleTypes(RoleType role) |
static RoleType |
getNonMetaTopRole(RoleType role) |
static void |
printAnswers(Set<Map<String,Concept>> answers) |
static <T> Set<T> |
subtractSets(Set<T> A,
Set<T> B) |
public static void computeRoleCombinations(Set<String> vars, Set<RoleType> roles, Map<String,String> roleMap, Set<Map<String,String>> roleMaps)
public static String createFreshVariable(Set<String> vars, String var)
vars - vars to be avoidedvar - variable to be generated a fresh replacementpublic static Rule createTransitiveRule(RelationType relType, String fromRoleName, String toRoleName, GraknGraph graph)
relType - transitive relation typefromRoleName - from directional role type type nametoRoleName - to directional role type type namegraph - graphpublic static Rule createReflexiveRule(RelationType relType, GraknGraph graph)
relType - reflexive relation typegraph - graphpublic static Rule createSubPropertyRule(RelationType parent, RelationType child, Map<String,String> roleMappings, GraknGraph graph)
parent - relation type of parentchild - relation type of childroleMappings - map of corresponding role type type namesgraph - graphpublic static Rule createPropertyChainRule(RelationType relation, String fromRoleName, String toRoleName, LinkedHashMap<RelationType,javafx.util.Pair<String,String>> chain, GraknGraph graph)
Copyright © 2016 Grakn Labs Ltd. All rights reserved.