Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
MaillPierre committed Aug 30, 2024
1 parent 3836383 commit 9d8ae03
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public class CreateImpl extends CreateTriple implements Creator {
Stack stack;
String base;
private boolean renameBlankNode = true;
private String resource;
private Node node;
Load load;
int count = 1;

Expand Down Expand Up @@ -69,12 +67,6 @@ public static CreateImpl create(Graph g, Load ld) {
return new CreateImpl(g, ld);
}

// init
// TODO: check
// public void graph(String src) {
// source = addGraph(src);
// }

@Override
public void graph(Atom src) {
stack.add(source);
Expand Down Expand Up @@ -102,7 +94,6 @@ public void triple(Atom graph, Atom subject, Atom property, Atom object) {
}

Node getGraph(Atom graph) {
//return graph == null ? addDefaultGraphNode() : addGraph(graph);
if (graph == null) {
return addDefaultGraphNode();
}
Expand Down
15 changes: 0 additions & 15 deletions corese-core/src/main/java/fr/inria/corese/core/load/Load.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,6 @@ public void setEngine(QueryEngine eng) {
qengine = eng;
}

// public void setPlugin(LoadPlugin p) {
// if (p != null) {
// plugin = p;
// hasPlugin = true;
// }
// }

// public void setBuild(BuildImpl b) {
// if (b != null) {
// build = b;
// }
// }

public void setMax(int n) {
maxFile = n;
}
Expand Down Expand Up @@ -853,7 +840,6 @@ void loadTurtle(Reader stream, String path, String base, String name) throws Loa
}

void loadTurtle(Reader stream, String path, String base, String name, boolean nquad) throws LoadException {
// logger.info("Load Turtle: " + path);
CreateImpl cr = CreateImpl.create(getGraph(), this);
cr.graph(Constant.create(name));
cr.setRenameBlankNode(renameBlankNode);
Expand Down Expand Up @@ -882,7 +868,6 @@ void loadTurtle(Reader stream, String path, String base, String name, boolean nq

// load RDFa
void loadRDFa(Reader stream, String path, String base, String name) throws LoadException {
// logger.info("Load RDFa: " + path);
CoreseRDFaTripleSink sink = new CoreseRDFaTripleSink(getGraph(), null);
sink.setHelper(renameBlankNode, getLimit());

Expand Down
71 changes: 37 additions & 34 deletions sparql/src/main/java/fr/inria/corese/sparql/triple/api/Creator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,41 @@
import fr.inria.corese.sparql.triple.parser.RDFList;

/**
*
* Interface to create edges from Turtle parser
* @author Olivier Corby, INRIA 2012
*
*/
public interface Creator {

boolean accept(Atom subject, Atom predicate, Atom object);
boolean raiseLimit();

void start();

void finish();

void triple(Atom graph, Atom subject, Atom predicate, Atom object);
void triple(Atom subject, Atom predicate, Atom object);

void triple(Atom predicate, List<Atom> l);

default void triple(Atom predicate, List<Atom> list, boolean nested) {
triple(predicate, list);
}

void graph(Atom graph);

void endGraph(Atom graph);

void list(RDFList l);

void setRenameBlankNode(boolean b);

boolean isRenameBlankNode();

void setLimit(int limit);
*
* Interface to create edges from Turtle parser
*
* @author Olivier Corby, INRIA 2012
*
*/
public interface Creator {

boolean accept(Atom subject, Atom predicate, Atom object);

boolean raiseLimit();

void start();

void finish();

void triple(Atom graph, Atom subject, Atom predicate, Atom object);

void triple(Atom subject, Atom predicate, Atom object);

void triple(Atom predicate, List<Atom> l);

default void triple(Atom predicate, List<Atom> list, boolean nested) {
triple(predicate, list);
}

void graph(Atom graph);

void endGraph(Atom graph);

void list(RDFList l);

void setRenameBlankNode(boolean b);

boolean isRenameBlankNode();

void setLimit(int limit);
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static LoadTurtle create(String file, Creator cr) {
return null;
}

void setCreator(Creator c) {
public void setCreator(Creator c) {
create = c;
}

Expand All @@ -78,7 +78,7 @@ public Creator getCreator() {

private void setLoader(InputStream stream, Creator c, String base) {
parser = new SparqlCorese(stream);
parser.setHandler(new ParserHandler());
parser.setHandler(new ParserHandler());
setLoader(parser, c, base);
}

Expand All @@ -87,7 +87,7 @@ private void setLoader(Reader stream, Creator c, String base) {
parser.setHandler(new ParserHandler());
setLoader(parser, c, base);
}

private void setLoader(SparqlCorese parser, Creator c, String base) {
try {
ASTQuery ast = ASTQuery.create();
Expand All @@ -102,23 +102,20 @@ private void setLoader(SparqlCorese parser, Creator c, String base) {

public void load() throws QueryLexicalException, QuerySyntaxException {
try {
//logger.info("start parser");
if (isNquad()) {
parser.nquad();
}
else {
} else {
parser.load();
}
//logger.info("finish parser");

for (EngineException e : parser.getHandler().getErrorList()) {
throw new QuerySyntaxException(e.getMessage());
}
} catch (JavaccParseException e) {
if (e.isStop()) {
// parser stop after limit
logger.info("finish parser after limit");
}
else {
} else {
throw new QuerySyntaxException(e.getMessage());
}
} catch (TokenMgrError e) {
Expand Down

0 comments on commit 9d8ae03

Please sign in to comment.