@Override public Stream<Role> toCompatibleRoles(Role entryRole) { return entryRole.subs(); } }
public static Collection<? extends SchemaConcept> allSchemaElementsFrom(GraknTx graph) { Set<SchemaConcept> allSchemaConcepts = new HashSet<>(); allSchemaConcepts.addAll(graph.admin().getMetaConcept().subs().collect(toSet())); allSchemaConcepts.addAll(graph.admin().getMetaRole().subs().collect(toSet())); allSchemaConcepts.addAll(graph.admin().getMetaRule().subs().collect(toSet())); return allSchemaConcepts; }
private Role role() { return random.choose(tx.admin().getMetaRole().subs().collect(toSet())); }
/** * Get all the {@link SchemaConcept}s in a graph. * @return a stream of all {@link SchemaConcept}s with non-reserved IDs */ private Stream<? extends SchemaConcept> schemaConcepts(){ Stream<? extends Type> types = tx.admin().getMetaConcept().subs(); Stream<Role> roles = tx.admin().getMetaRole().subs(); Stream<Rule> rules = tx.admin().getMetaRule().subs(); return Stream.of(types, roles, rules) .flatMap(Function.identity()) .filter(t -> !Schema.MetaSchema.isMetaLabel(t.label())); } }
public static void printWholeCompletionMessage(MigrationOptions options){ System.out.println("Migration complete."); if(options.isVerbose()) { System.out.println("Gathering information about migrated data. If in a hurry, you can ctrl+c now."); GraknTx tx = new Grakn(options.getUri()).session(options.getKeyspace()).transaction(GraknTxType.WRITE); QueryBuilder qb = tx.graql(); StringBuilder builder = new StringBuilder(); builder.append("Graph schema contains:\n"); builder.append("\t ").append(tx.admin().getMetaEntityType().instances().count()).append(" entity types\n"); builder.append("\t ").append(tx.admin().getMetaRelationType().instances().count()).append(" relation types\n"); builder.append("\t ").append(tx.admin().getMetaRole().subs().count()).append(" roles\n\n"); builder.append("\t ").append(tx.admin().getMetaAttributeType().instances().count()).append(" resource types\n"); builder.append("\t ").append(tx.admin().getMetaRule().subs().count()).append(" rules\n\n"); builder.append("Graph data contains:\n"); builder.append("\t ").append(qb.match(var("x").isa(label(ENTITY.getLabel()))).aggregate(count()).execute()).append(" entities\n"); builder.append("\t ").append(qb.match(var("x").isa(label(RELATIONSHIP.getLabel()))).aggregate(count()).execute()).append(" relations\n"); builder.append("\t ").append(qb.match(var("x").isa(label(ATTRIBUTE.getLabel()))).aggregate(count()).execute()).append(" resources\n"); builder.append("\t ").append(qb.match(var("x").isa(label(RULE.getLabel()))).aggregate(count()).execute()).append(" rules\n\n"); System.out.println(builder); tx.close(); } }
boolean subRoleNotFoundInRelates = superRelate.subs().noneMatch(sub -> relatesLabels.contains(sub.label()));