All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.boreal.backward_chaining.evaluators.RewritingOutput Maven / Gradle / Ivy

Go to download

InteGraal has been designed in a modular way, in order to facilitate software reuse and extension. It should make it easy to test new scenarios and techniques, in particular by combining algorithms. The main features of Graal are currently the following: (1) internal storage to store data by using a SQL or RDF representation (Postgres, MySQL, HSQL, SQLite, Remote SPARQL endpoints, Local in-memory triplestores) as well as a native in-memory representation (2) data-integration capabilities for exploiting federated heterogeneous data-sources through mappings able to target systems such as SQL, RDF, and black-box (e.g. Web-APIs) (3) algorithms for query-answering over heterogeneous and federated data based on query rewriting and/or forward chaining (or chase)

The newest version!
package fr.boreal.backward_chaining.evaluators;

import java.io.Serializable;
import java.util.Objects;
import java.util.Optional;

import fr.boreal.model.query.api.Query;
import fr.boreal.model.query.impl.UnionFOQuery;
import fr.lirmm.boreal.util.object_analyzer.ObjectAnalizer;

public record RewritingOutput(Query query, UnionFOQuery rewritings, Optional message)
		implements Serializable {

	public RewritingOutput {
		Objects.requireNonNull(query);
		Objects.requireNonNull(rewritings);
		Objects.requireNonNull(message);
	}

	public String printRewritingCount() {

		if (rewritings.getQueries().isEmpty()) {
			if (message.isEmpty()) {
				throw new IllegalStateException("no rewritings no error message");
			}
			return message.get();
		}

		String template = "Number of rewritings for %s : %s";
		return String.format(template, query, getInfos());
	}

	public String printOnlyRewritingCount() {

		if (rewritings.getQueries().isEmpty()) {
			if (message.isEmpty()) {
				throw new IllegalStateException("no rewritings no error message");
			}
			return message.get();
		}

		String template = "Number of rewritings : %s";

		return String.format(template, getInfos());
	}

	private String getInfos() {
        return ObjectAnalizer.info(rewritings) + "\t";
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy