List of usage examples for org.apache.commons.collections15 MultiMap size
int size();
From source file:de.uniba.wiai.kinf.pw.projects.lillytab.reasoner.abox.LinkMap.java
private Collection<Pair<R, IABoxNode<I, L, K, R>>> getAllEntries(final IABox<I, L, K, R> abox, final MultiMap<R, NodeID> map) { final List<Pair<R, IABoxNode<I, L, K, R>>> list = new ArrayList<>(map.size()); for (Map.Entry<R, NodeID> mapEntry : MultiMapEntryIterable.decorate(map.entrySet())) { list.add(Pair.wrap(mapEntry.getKey(), abox.getNode(mapEntry.getValue()))); }/*from ww w . j a v a2 s.c om*/ return list; }
From source file:org.openanzo.datasource.nodecentric.internal.NodeCentricResetService.java
/** * Reset the database/*from w ww . ja v a 2s. com*/ * * @param connectionContext * NodeCentric specific context, which contains connection to run queries against * @param hardReset * if true, all tables are dropped and not just truncated * @param statements * statements to use to initialize database * @return ValuePair containing servers new URI and ID * @throws AnzoException */ protected URI resetDatabase(NodeCentricOperationContext connectionContext, boolean hardReset, MultiMap<URI, Statement> statements) throws AnzoException { datasource.resetDatasource(); Pair<Long, URI> serverURI = null; boolean[] result = lockDB(connectionContext); if (result[1]) { try { serverURI = resetDatabaseTables(connectionContext, hardReset); if (statements != null && statements.size() > 0) { resetGraph(statements, connectionContext, serverURI.second); } else { if (rdfInitFiles != null && rdfInitFiles.size() > 0) { initializeProvidedRoles(connectionContext, serverURI.second); } else { initializeDefaultRoles(connectionContext, serverURI.second); } } unLockDB(connectionContext, true, serverURI.first); return serverURI.second; } catch (AnzoException ae) { if (result[0]) { BaseSQL.dropTable(connectionContext.getStatementProvider(), connectionContext.getConnection(), connectionContext.getConfiguration().getUsesUppercase() ? NodeCentricDatasource.serverUpper : NodeCentricDatasource.serverLower); } throw ae; } } else { if (result[0]) { BaseSQL.dropTable(connectionContext.getStatementProvider(), connectionContext.getConnection(), connectionContext.getConfiguration().getUsesUppercase() ? NodeCentricDatasource.serverUpper : NodeCentricDatasource.serverLower); } throw new AnzoException(ExceptionConstants.RDB.FAILED_INITIALZE_DB); } }
From source file:org.openanzo.datasource.update.MultiStageUpdatesProcessor.java
/** * Process a set of IUpdateTransactions and return results * /* ww w . ja v a 2s . c o m*/ * @param context * NodeCentric specific context, which contains connection to run queries against * @param backend * backend for data * @param queryService * reference to the IQueryService, used for precondition checks * @param authorizationService * reference to the authorization service used to check permission on graphs * @param eventListeners * set of listeners that listen for ACL events * @param statements * Data to add to server * @param graphTemplate * Template of statements for creating a new graph * @param reseting * Is the server resetting * @param bulkUpdate * Is this a bulk update * @return UpdateResults from update * @throws AnzoException */ public static Updates update(IOperationContext context, IServerQuadStore backend, IQueryService queryService, IAuthorizationService authorizationService, Collection<IAuthorizationEventListener> eventListeners, MultiMap<URI, Statement> statements, Collection<Statement> graphTemplate, boolean reseting, boolean bulkUpdate) throws AnzoException { long start = System.currentTimeMillis(); IUpdates updates = convertStatementsToUpdates(context, bulkUpdate, statements, graphTemplate, backend); if (log.isDebugEnabled()) { log.debug(LogUtils.TIMING_MARKER, "MULTISTAGE_UPDATEPROC CONVERT,{},{}", Long.toString(System.currentTimeMillis() - start), statements.size()); } Updates results = update(context, backend, queryService, authorizationService, eventListeners, updates, reseting); return results; }
From source file:org.openanzo.rdf.MemQuadStore.java
/** * Remove indexes for this statement/*from ww w. ja va2s .c om*/ * * @param stmt * statement to deindex */ private void removeMaps(Statement stmt) { Resource c = stmt.getNamedGraphUri(); Resource s = stmt.getSubject(); URI p = stmt.getPredicate(); Value o = stmt.getObject(); subjectMap.remove(s, stmt); predMap.remove(p, stmt); objMap.remove(o, stmt); namedGraphMap.remove(c, stmt); MultiMap<Value, Statement> poIndexMap = poIndex.get(p); if (poIndexMap != null) { poIndexMap.remove(o, stmt); if (poIndexMap.size() == 0) { poIndex.remove(p); } } MultiMap<Resource, Statement> psIndexMap = psIndex.get(p); if (psIndexMap != null) { psIndexMap.remove(s, stmt); if (psIndexMap.size() == 0) { psIndex.remove(p); } } }