Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,4 @@ public interface StorageLifecycle {
*/
StorageConfig getConfig();

/**
* Checks whether the storage has been successfully initialized and is running.
*
* @return {@code true} if the storage is in {@link LifecycleState#RUNNING} state
*/
default boolean isInitialized() {
return getState() == LifecycleState.RUNNING;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,61 +54,4 @@ public interface BulkOperations {
*/
MutationResult clearContexts(List<Resource> contexts, boolean silent) throws StorageException;

/**
* Clears all contexts (deletes entire model).
*
* @return Bulk mutation result with all deleted statements
* @throws StorageException if operation fails
*/
default MutationResult clearAll() throws StorageException {
return clearContexts(null, false);
}

/**
* Adds statements from source context to target context.
* Statements remain in source context.
*
* @param sourceContext Source context
* @param targetContext Target context
* @param silent If true, don't fail if source doesn't exist
* @return Bulk mutation result
* @throws StorageException if operation fails
* @throws IllegalArgumentException if contexts are null
*/
default MutationResult addGraph(Resource sourceContext, Resource targetContext, boolean silent)
throws StorageException {
throw new UnsupportedOperationException("addGraph not implemented - Model API doesn't support this operation natively");
}


/**
* Undeclares (deletes) a context and all its statements.
*
* @param context Context to undeclare
* @return Bulk mutation result with deleted statements
* @throws StorageException if operation fails
* @throws IllegalArgumentException if context is null
*/
default MutationResult undeclareContext(Resource context) throws StorageException {
if (context == null) {
throw new IllegalArgumentException("Context cannot be null");
}
return clearContexts(List.of(context), false);
}

/**
* Undeclares (deletes) multiple contexts and all their statements in a single batch operation.
* More efficient than calling undeclareContext() multiple times.
*
* @param contexts List of contexts to undeclare
* @return Bulk mutation result with all deleted statements
* @throws StorageException if operation fails
* @throws IllegalArgumentException if contexts is null or empty
*/
default MutationResult undeclareContexts(List<Resource> contexts) throws StorageException {
if (contexts == null || contexts.isEmpty()) {
throw new IllegalArgumentException("Contexts list cannot be null or empty");
}
return clearContexts(contexts, false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,36 +60,6 @@ MutationResult insertStatement(Resource subject, IRI predicate, Value object, Re
MutationResult deleteStatements(Resource subject, IRI predicate, Value object, Resource... contexts)
throws StorageException;

/**
* Updates a statement (delete + insert in one operation).
*
* @param oldStatement Statement to delete
* @param newStatement Statement to insert
* @return Mutation result
* @throws StorageException if operation fails
* @throws IllegalArgumentException if oldStatement or newStatement is null
*/
default MutationResult updateStatement(Statement oldStatement, Statement newStatement)
throws StorageException {
if (oldStatement == null || newStatement == null) {
throw new IllegalArgumentException("Both oldStatement and newStatement must be non-null");
}

MutationResult deleteResult = deleteStatement(oldStatement);
if (deleteResult.isFailure()) {
return deleteResult;
}

MutationResult insertResult = insertStatement(newStatement);
if (insertResult.isFailure()) {
return MutationResult.failure(
"Insert failed after delete: " + insertResult.getMessage()
);
}

return insertResult;
}

/**
* Clears statements from the specified contexts.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,4 @@ public static int loadPluginsFromJar(File jarFile) throws Exception {
return count;
}


/**
* Clears all loaded class loaders.
*/
public static void clear() {
logger.info("Clearing {} loaded class loaders", loadedClassLoaders.size());
loadedClassLoaders.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ public Map<String, Object> getProperties() {
return properties;
}

/**
* Returns whether transaction support is enabled.
*
* @return {@code true} if transaction support is enabled
*/
public boolean hasTransactionSupport() {
return transactionSupport;
}

/**
* Returns the storage type from properties.
*
Expand Down Expand Up @@ -135,17 +126,6 @@ public Builder property(String key, Object value) {
return this;
}

/**
* Enables or disables transaction support.
*
* @param enable {@code true} to enable transaction support
* @return this builder for method chaining
*/
public Builder transactionSupport(boolean enable) {
this.transactionSupport = enable;
return this;
}

/**
* Builds the {@link StorageConfig} instance with the current configuration.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,4 @@ public enum ErrorCode {
this.description = description;
}

public String getCode() {
return code;
}

public String getDescription() {
return description;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ public StorageException(ErrorCode code, String message, Throwable cause) {
this.code = code;
}

/**
* Returns the error code.
*
* @return Error code
*/
public ErrorCode getCode() {
return code;
}

@Override
public String toString() {
return "StorageException{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,6 @@ public BulkBuilder message(String message) {
return this;
}

public void incrementSuccess() {
this.successCount++;
}


public BulkBuilder addSuccess(Statement statement) {
if (statement != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,4 @@ public record StorageStatistics(
}
}

/**
* Checks whether the storage is empty (contains no statements).
*
* @return {@code true} if {@code statementCount == 0}
*/
public boolean isEmpty() {
return statementCount == 0;
}

/**
* Calculates the average number of statements per unique subject.
*
* @return the average statements per subject, or {@code 0.0} if no subjects exist
*/
public double getAverageStatementsPerSubject() {
return subjectCount > 0 ? (double) statementCount / subjectCount : 0.0;
}

/**
* Calculates the average number of statements per unique predicate.
*
*
* @return the average statements per predicate, or {@code 0.0} if no predicates exist
*/
public double getAverageStatementsPerPredicate() {
return predicateCount > 0 ? (double) statementCount / predicateCount : 0.0;
}

/**
* Calculates the average number of statements per named graph (context).
*
*
* @return the average statements per context, or {@code 0.0} if no contexts exist
*/
public double getAverageStatementsPerContext() {
return contextCount > 0 ? (double) statementCount / contextCount : 0.0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,4 @@ public enum IsolationLevel {
this.level = level;
}

/**
* Returns the numeric isolation level.
* Higher number means stricter isolation.
*
* @return Numeric level
*/
public int getLevel() {
return level;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,6 @@ public interface TransactionManager {
*/
Optional<Transaction> getCurrentTransaction();

/**
* Checks if a transaction is active on the current thread.
*
* @return true if a transaction is active
*/
default boolean hasActiveTransaction() {
return getCurrentTransaction().map(Transaction::isActive).orElse(false);
}

/**
* Returns the default isolation level used for new transactions.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,6 @@ public boolean remove(Statement stmt) {
return true;
}

/**
* Checks if a statement exists in the underlying Graph.
*
* @param stmt the statement to check
* @return true if the statement exists
*/
public boolean contains(Statement stmt) {
Edge edge = statementToEdge(stmt);
return graph.exist(edge);
}

/**
* Finds all statements matching the given pattern.
*
Expand Down
Loading
Loading