/** * Returns the property key with the given name. If automatic type making is enabled, it will make the property key * using the configured default type maker if a key with the given name does not exist. * * The default implementation simply calls the {@link #getOrCreatePropertyKey(String name) getOrCreatePropertyKey} method * * @param name name of the property key to return * @param value the value of the property key. This param is not used by the default * implementation * @return the property key with the given name * @throws IllegalArgumentException if a property key with the given name does not exist or if the * type with the given name is not a property key * @see PropertyKey */ default PropertyKey getOrCreatePropertyKey(String name, Object value) { return getOrCreatePropertyKey(name); }
protected final boolean hasSingleType() { return types.length == 1 && schemaInspector.getRelationType(types[0]) != null; }
@Override public Q orderBy(String keyName, org.apache.tinkerpop.gremlin.process.traversal.Order order) { Preconditions.checkArgument(schemaInspector.containsPropertyKey(keyName), "Provided key does not exist: %s", keyName); PropertyKey key = schemaInspector.getPropertyKey(keyName); Preconditions.checkArgument(key != null && order != null, "Need to specify and key and an order"); Preconditions.checkArgument(Comparable.class.isAssignableFrom(key.dataType()), "Can only order on keys with comparable data type. [%s] has datatype [%s]", key.name(), key.dataType()); Preconditions.checkArgument(!(key instanceof SystemRelationType), "Cannot use system types in ordering: %s", key); Preconditions.checkArgument(!orders.containsKey(key)); Preconditions.checkArgument(orders.isEmpty(), "Only a single sort order is supported on vertex queries"); orders.add(key, Order.convert(order)); return getThis(); }
/** * Whether this query is asking for the value of an {@link org.janusgraph.graphdb.types.system.ImplicitKey}. * <p> * Handling of implicit keys is completely distinct from "normal" query execution and handled extra * for completeness reasons. * * @param returnType * @return */ protected final boolean isImplicitKeyQuery(RelationCategory returnType) { return returnType != RelationCategory.EDGE && types.length == 1 && constraints.isEmpty() && schemaInspector.getRelationType(types[0]) instanceof ImplicitKey; }
protected final RelationType getSingleType() { Preconditions.checkArgument(hasSingleType()); return schemaInspector.getRelationType(types[0]); }