Search in sources :

Example 11 with NotSupportException

use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph-toolchain by apache.

the class PropertyKeyAPI method clear.

public PropertyKey.PropertyKeyWithTask clear(PropertyKey propertyKey) {
    if (this.client.apiVersionLt("0.65")) {
        throw new NotSupportException("action clear on property key");
    }
    String id = propertyKey.name();
    Map<String, Object> params = ImmutableMap.of("action", "clear");
    Object pkey = this.checkCreateOrUpdate(propertyKey);
    RestResult result = this.client.put(this.path(), id, pkey, params);
    return result.readObject(PropertyKey.PropertyKeyWithTask.class);
}
Also used : RestResult(com.baidu.hugegraph.rest.RestResult) NotSupportException(com.baidu.hugegraph.exception.NotSupportException) PropertyKey(com.baidu.hugegraph.structure.schema.PropertyKey)

Example 12 with NotSupportException

use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph by apache.

the class InMemoryDBTable method query.

@Override
public Iterator<BackendEntry> query(BackendSession session, Query query) {
    String page = query.page();
    if (page != null && !page.isEmpty()) {
        throw new NotSupportException("paging by InMemoryDBStore");
    }
    Map<Id, BackendEntry> rs = this.store;
    if (query instanceof IdPrefixQuery) {
        IdPrefixQuery pq = (IdPrefixQuery) query;
        rs = this.queryByIdPrefix(pq.start(), pq.inclusiveStart(), pq.prefix(), rs);
    }
    if (query instanceof IdRangeQuery) {
        IdRangeQuery rq = (IdRangeQuery) query;
        rs = this.queryByIdRange(rq.start(), rq.inclusiveStart(), rq.end(), rq.inclusiveEnd(), rs);
    }
    // Query by id(s)
    if (query.idsSize() > 0) {
        rs = this.queryById(query.ids(), rs);
    }
    // Query by condition(s)
    if (query.conditionsSize() > 0) {
        ConditionQuery condQuery = (ConditionQuery) query;
        if (condQuery.containsScanRelation()) {
            return this.queryByRange(condQuery);
        }
        rs = this.queryByFilter(query.conditions(), rs);
    }
    Iterator<BackendEntry> iterator = rs.values().iterator();
    long offset = query.offset() - query.actualOffset();
    if (offset >= rs.size()) {
        query.goOffset(rs.size());
        return QueryResults.emptyIterator();
    }
    if (offset > 0L) {
        query.goOffset(offset);
        iterator = this.skipOffset(iterator, offset);
    }
    if (!query.noLimit() && query.total() < rs.size()) {
        iterator = this.dropTails(iterator, query.limit());
    }
    return iterator;
}
Also used : BackendEntry(com.baidu.hugegraph.backend.store.BackendEntry) TextBackendEntry(com.baidu.hugegraph.backend.serializer.TextBackendEntry) ConditionQuery(com.baidu.hugegraph.backend.query.ConditionQuery) NotSupportException(com.baidu.hugegraph.exception.NotSupportException) Id(com.baidu.hugegraph.backend.id.Id) IdRangeQuery(com.baidu.hugegraph.backend.query.IdRangeQuery) IdPrefixQuery(com.baidu.hugegraph.backend.query.IdPrefixQuery)

Example 13 with NotSupportException

use of com.baidu.hugegraph.exception.NotSupportException in project incubator-hugegraph by apache.

the class Reflection method registerMethodsToFilter.

public static void registerMethodsToFilter(Class<?> containingClass, String... methodNames) {
    if (REGISTER_METHODS_TO_FILTER_MOTHOD == null) {
        throw new NotSupportException("Reflection.registerMethodsToFilterMethod()");
    }
    try {
        REGISTER_METHODS_TO_FILTER_MOTHOD.setAccessible(true);
        REGISTER_METHODS_TO_FILTER_MOTHOD.invoke(REFLECTION_CLAZZ, containingClass, methodNames);
    } catch (IllegalAccessException | InvocationTargetException e) {
        throw new HugeException("Failed to register class '%s' methods to filter: %s", containingClass, Arrays.toString(methodNames));
    }
}
Also used : NotSupportException(com.baidu.hugegraph.exception.NotSupportException) HugeException(com.baidu.hugegraph.HugeException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

NotSupportException (com.baidu.hugegraph.exception.NotSupportException)13 HugeException (com.baidu.hugegraph.HugeException)4 Id (com.baidu.hugegraph.backend.id.Id)3 Relation (com.baidu.hugegraph.backend.query.Condition.Relation)3 BackendEntry (com.baidu.hugegraph.backend.store.BackendEntry)3 Shard (com.baidu.hugegraph.backend.store.Shard)3 RestResult (com.baidu.hugegraph.rest.RestResult)3 Aggregate (com.baidu.hugegraph.backend.query.Aggregate)2 TextBackendEntry (com.baidu.hugegraph.backend.serializer.TextBackendEntry)2 ArrayList (java.util.ArrayList)2 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 BackendException (com.baidu.hugegraph.backend.BackendException)1 IdHolder (com.baidu.hugegraph.backend.page.IdHolder)1 BatchIdHolder (com.baidu.hugegraph.backend.page.IdHolder.BatchIdHolder)1 FixedIdHolder (com.baidu.hugegraph.backend.page.IdHolder.FixedIdHolder)1 PagingIdHolder (com.baidu.hugegraph.backend.page.IdHolder.PagingIdHolder)1 IdHolderList (com.baidu.hugegraph.backend.page.IdHolderList)1 PageState (com.baidu.hugegraph.backend.page.PageState)1 SortByCountIdHolderList (com.baidu.hugegraph.backend.page.SortByCountIdHolderList)1