Skip to content

Commit

Permalink
starts
Browse files Browse the repository at this point in the history
  • Loading branch information
bigerl committed Jul 10, 2023
1 parent 2026e5b commit fcfca4f
Show file tree
Hide file tree
Showing 23 changed files with 324 additions and 1,328 deletions.
13 changes: 13 additions & 0 deletions example-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ connections:
user: "dba"
password: "dba"
endpoint: "http://localhost:8890/sparql"
dataset: DatasetName
- name: "Virtuoso6"
user: "dba"
password: "dba"
Expand All @@ -28,6 +29,7 @@ tasks:
queries:
path: "/home/bigerl/IdeaProjects/IGUANA/LICENSE"
timeout: 0.02s
connection: Virtuoso7
completionTarget:
duration: 1000s
workers:
Expand All @@ -36,24 +38,35 @@ tasks:
queries:
path: "/home/bigerl/IdeaProjects/IGUANA/LICENSE"
timeout: 180s
connection: Virtuoso7
completionTarget:
duration: 1000s
requestType: get query
- number: 4
type: "SPARQLProtocolWorker"
connection: Virtuoso7
completionTarget:
duration: 1000s
queries:
path: "/home/bigerl/IdeaProjects/IGUANA/LICENSE"
timeout: 100s
acceptHeader: "application/sparql-results+json"
- type: stresstest
workers:
- type: "SPARQLProtocolWorker"
connection: Virtuoso7
number: 16
requestType: get query
queries:
path: "/home/bigerl/IdeaProjects/IGUANA/LICENSE"
timeout: 180s
completionTarget:
duration: 1000s
- number: 4
requestType: get query
connection: Virtuoso7
completionTarget:
duration: 1000s
type: "SPARQLProtocolWorker"
queries:
path: "/home/bigerl/IdeaProjects/IGUANA/LICENSE"
Expand Down
34 changes: 0 additions & 34 deletions src/main/java/org/aksw/iguana/cc/config/CONSTANTS.java

This file was deleted.

42 changes: 0 additions & 42 deletions src/main/java/org/aksw/iguana/cc/config/elements/MetricConfig.java

This file was deleted.

17 changes: 12 additions & 5 deletions src/main/java/org/aksw/iguana/cc/controller/MainController.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.aksw.iguana.cc.controller;

import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.ParameterException;
import com.beust.jcommander.*;
import org.aksw.iguana.cc.suite.IguanaSuiteParser;
import org.aksw.iguana.cc.suite.Suite;
import org.slf4j.Logger;
Expand All @@ -17,15 +15,24 @@
*/
public class MainController {


public static class Args {
@Parameter(description = "Suite file describing the configuration of the experiment.")
private Path suitePath;
public class PathConverter implements IStringConverter<Path> {
@Override
public Path convert(String value) {
return Path.of(value);
}
}


@Parameter(names = {"--ignore-schema", "-is"}, description = "Do not check the schema before parsing the suite file.")
private boolean ignoreShema = false;

@Parameter(names = "--help", help = true)
private boolean help;

@Parameter(description = "suite file {yml,yaml,json}", arity = 1, required = true, converter = PathConverter.class)
private Path suitePath;
}


Expand Down

This file was deleted.

90 changes: 46 additions & 44 deletions src/main/java/org/aksw/iguana/cc/lang/LanguageProcessor.java
Original file line number Diff line number Diff line change
@@ -1,55 +1,57 @@
package org.aksw.iguana.cc.lang;

import org.apache.http.Header;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.jena.rdf.model.Model;
import org.json.simple.parser.ParseException;
import org.xml.sax.SAXException;

import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.time.Instant;
import java.util.List;
import java.util.concurrent.TimeoutException;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import java.util.ServiceLoader;

/**
* Language Processor tells how to handle Http responses as well as how to analyze queries and generate stats.
* Interface for abstract language processors that work on InputStreams.
*/
public interface LanguageProcessor {

/**
* Returns the prefix used for the queries (e.g. sparql, query or document)
* @return
*/
String getQueryPrefix();

/**
* Method to generate Triple Statistics for provided queries
*
*
* @param taskID
* @return Model with the triples to add to the results
*/
Model generateTripleStats(List<QueryWrapper> queries, String resourcePrefix, String taskID);


public abstract class LanguageProcessor {
/**
* Gets the result size of a given HTTP response
*
* @param response
* @return
* @throws ParserConfigurationException
* @throws SAXException
* @throws ParseException
* @throws IOException
* Provides the content type that a LanguageProcessor consumes.
*/
Long getResultSize(CloseableHttpResponse response) throws ParserConfigurationException, SAXException, ParseException, IOException;

Long getResultSize(Header contentTypeHeader, ByteArrayOutputStream content, long contentLength) throws ParserConfigurationException, SAXException, ParseException, IOException;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ContentType {
String value();
}

public interface LanguageProcessingData {
Class<? extends LanguageProcessor> processor();
}

public abstract LanguageProcessingData process(InputStream inputStream);

final private static Map<String, Class<? extends LanguageProcessor>> processors = new HashMap<>();

static {
for (LanguageProcessor processor : ServiceLoader.load(LanguageProcessor.class)) {
LanguageProcessor.ContentType contentType = processor.getClass().getAnnotation(LanguageProcessor.ContentType.class);
if (contentType != null) {
processors.put(contentType.value(), processor.getClass());
}
}
}

public static LanguageProcessor getInstance(String contentType) {
Class<? extends LanguageProcessor> processorClass = processors.get(contentType);
if (processorClass != null) {
try {
return processorClass.getDeclaredConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException | InvocationTargetException |
NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
throw new IllegalArgumentException("No LanguageProcessor for ContentType " + contentType);
}

long readResponse(InputStream inputStream, ByteArrayOutputStream responseBody) throws IOException, TimeoutException;

}
31 changes: 0 additions & 31 deletions src/main/java/org/aksw/iguana/cc/lang/QueryWrapper.java

This file was deleted.

Loading

0 comments on commit fcfca4f

Please sign in to comment.