/** * @param string a string to quote and escape * @return a string, surrounded with double quotes and escaped */ public static String quoteString(String string) { return "\"" + StringUtil.escapeString(string) + "\""; }
@Override public Consumer<GraknTx> build(){ return (GraknTx tx) -> { SampleKBLoader.loadFromFile(tx, schemaFile); SampleKBLoader.loadFromFile(tx, dataFile); SampleKBLoader.loadFromFile(tx, rulesFile); }; } }
private static TxType convert(GraknTxType txType) { switch (txType) { case READ: return TxType.Read; case WRITE: return TxType.Write; case BATCH: return TxType.Batch; default: throw CommonUtil.unreachableStatement("Unrecognised " + txType); } }
static <T> GraphTraversal<T, Vertex> outSubs(GraphTraversal<T, Vertex> traversal) { // These traversals make sure to only navigate types by checking they do not have a `THING_TYPE_LABEL_ID` property return union(traversal, ImmutableSet.of( __.<Vertex>not(__.has(THING_TYPE_LABEL_ID.name())).not(__.hasLabel(Schema.BaseType.SHARD.name())), __.repeat(__.out(SUB.getLabel())).emit() )).unfold(); }
/** * Thrown when trying to create a {@link SchemaConcept} using a unique property which is already taken. * For example this happens when using an already taken {@link Label} */ public static PropertyNotUniqueException cannotCreateProperty(Concept concept, Schema.VertexProperty property, Object value){ return create(UNIQUE_PROPERTY_TAKEN.getMessage(property.name(), value, concept)); } }
/** * The name of the entity role type in an entity-role relation representing an OWL data property */ default Label entityRole(Label resourceLabel) { return Schema.ImplicitType.HAS_OWNER.getLabel(resourceLabel); } /**
public GraknSession newSession() { GraknSession session = (GraknTestUtil.usingJanus()) ? EmbeddedGraknSession.createEngineSession(randomKeyspace()) : EmbeddedGraknSession.inMemory(randomKeyspace()); openedSessions.add(session); return session; }
public static Argument<Long> min_k(long minK) { return new Argument<>(MIN_K, minK); }
@Override public String uri() { return uri.toString(); }
public static SampleKBLoader empty(){ return new SampleKBLoader(null); }
/** * Make a name for a resource relation type representing the value of an OWL data property. */ default Label resourceRelation(Label resourceLabel) { return Schema.ImplicitType.HAS.getLabel(resourceLabel); } /**
@Override protected void buildSchema(GraknTx tx) { SampleKBLoader.loadFromFile(tx, "ldbc-snb-schema.gql"); SampleKBLoader.loadFromFile(tx, "ldbc-snb-product-schema.gql"); }
public static Argument<Long> size(long size) { return new Argument<>(SIZE, size); }
/** * Make a name for a resource role player representing the value of an OWL data property. */ default Label resourceRole(Label resourceLabel) { return Schema.ImplicitType.HAS_VALUE.getLabel(resourceLabel); } }
@Override protected void buildRules(GraknTx tx) { SampleKBLoader.loadFromFile(tx, "admission-rules.gql"); } }
public static Argument<ConceptId> contains(ConceptId conceptId) { return new Argument<>(CONTAINS, conceptId); }
@Override protected void buildInstances(GraknTx tx) { SampleKBLoader.loadFromFile(tx, "ldbc-snb-data.gql"); } }
public static Argument<Long> k(long k) { return new Argument<>(K, k); }
@Override protected void buildRules(GraknTx tx) { SampleKBLoader.loadFromFile(tx, "ldbc-snb-rules.gql"); }