Skip to content

Commit 96c5d23

Browse files
committed
Merge branch 'issues/#771-evaluation' into 'issues/#739-spin-lucene'
- resolve conflicts - found byway for issue #771 Signed-off-by: Jacek Grzebyta <grzebyta.dev@gmail.com>
2 parents f953d26 + c1a77dc commit 96c5d23

80 files changed

Lines changed: 2851 additions & 547 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

benchmark/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.eclipse.rdf4j</groupId>
88
<artifactId>rdf4j</artifactId>
9-
<version>2.2-SNAPSHOT</version>
9+
<version>2.3-SNAPSHOT</version>
1010
</parent>
1111

1212
<artifactId>rdf4j-benchmark</artifactId>

benchmark/src/main/java/org/eclipse/rdf4j/benchmark/ForwardChainingSchemaCachingRDFSInferencerBenchmark.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
package org.eclipse.rdf4j.benchmark;
1010

1111
import org.eclipse.rdf4j.repository.sail.SailRepository;
12-
import org.eclipse.rdf4j.sail.inferencer.fc.ForwardChainingSchemaCachingRDFSInferencer;
12+
import org.eclipse.rdf4j.sail.inferencer.fc.SchemaCachingRDFSInferencer;
1313
import org.eclipse.rdf4j.sail.memory.MemoryStore;
1414

1515
/**
@@ -19,12 +19,12 @@ public class ForwardChainingSchemaCachingRDFSInferencerBenchmark extends Initial
1919

2020
@Override
2121
SailRepository getSail(SailRepository schema) {
22-
return new SailRepository(new ForwardChainingSchemaCachingRDFSInferencer(new MemoryStore(), schema));
22+
return new SailRepository(new SchemaCachingRDFSInferencer(new MemoryStore(), schema));
2323
}
2424

2525
@Override
2626
Class getSailClass() {
27-
return ForwardChainingSchemaCachingRDFSInferencer.class;
27+
return SchemaCachingRDFSInferencer.class;
2828
}
2929

3030
}

benchmark/src/main/java/org/eclipse/rdf4j/benchmark/ReasoningBenchmark.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection;
1515
import org.eclipse.rdf4j.rio.RDFFormat;
1616
import org.eclipse.rdf4j.sail.inferencer.fc.ForwardChainingRDFSInferencer;
17-
import org.eclipse.rdf4j.sail.inferencer.fc.ForwardChainingSchemaCachingRDFSInferencer;
17+
import org.eclipse.rdf4j.sail.inferencer.fc.SchemaCachingRDFSInferencer;
1818
import org.eclipse.rdf4j.sail.memory.MemoryStore;
1919
import org.openjdk.jmh.annotations.Benchmark;
2020
import org.openjdk.jmh.annotations.BenchmarkMode;
@@ -125,7 +125,7 @@ public void forwardChainingSchemaCachingRDFSInferencer()
125125
throws IOException
126126
{
127127
SailRepository sail = new SailRepository(
128-
new ForwardChainingSchemaCachingRDFSInferencer(new MemoryStore()));
128+
new SchemaCachingRDFSInferencer(new MemoryStore()));
129129
sail.initialize();
130130

131131
try (SailRepositoryConnection connection = sail.getConnection()) {
@@ -164,7 +164,7 @@ public void forwardChainingSchemaCachingRDFSInferencerMultipleTransactions()
164164
throws IOException
165165
{
166166
SailRepository sail = new SailRepository(
167-
new ForwardChainingSchemaCachingRDFSInferencer(new MemoryStore()));
167+
new SchemaCachingRDFSInferencer(new MemoryStore()));
168168
sail.initialize();
169169

170170
try (SailRepositoryConnection connection = sail.getConnection()) {
@@ -187,7 +187,7 @@ public void forwardChainingSchemaCachingRDFSInferencerSchema()
187187
throws IOException
188188
{
189189
SailRepository sail = new SailRepository(
190-
new ForwardChainingSchemaCachingRDFSInferencer(new MemoryStore(), createSchema()));
190+
new SchemaCachingRDFSInferencer(new MemoryStore(), createSchema()));
191191
sail.initialize();
192192

193193
try (SailRepositoryConnection connection = sail.getConnection()) {
@@ -206,7 +206,7 @@ public void forwardChainingSchemaCachingRDFSInferencerMultipleTransactionsSchema
206206
throws IOException
207207
{
208208
SailRepository sail = new SailRepository(
209-
new ForwardChainingSchemaCachingRDFSInferencer(new MemoryStore(), createSchema()));
209+
new SchemaCachingRDFSInferencer(new MemoryStore(), createSchema()));
210210
sail.initialize();
211211

212212
try (SailRepositoryConnection connection = sail.getConnection()) {

compliance/queryresultio/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleBackgroundTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ public void testSingleVarResults()
8181
assertRegex(
8282
"\\?a\n" + "<foo:bar>\n"
8383
+ "(2.0(E0)?|\"2.0\"\\^\\^<http://www.w3.org/2001/XMLSchema#double>)\n" + "_:bnode3\n"
84-
+ "\"''single-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
84+
+ "\"?''single-quoted string(\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\n"
8585
+ "\"\\\\\"\\\\\"double-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
86-
+ "\"space at the end \"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
87-
+ "\"space at the end \"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
86+
+ "\"?space at the end (\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\n"
87+
+ "\"?space at the end (\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\n"
8888
+ "\"\\\\\"\\\\\"double-quoted string with no datatype\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
8989
+ "\"newline at the end \\\\n\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n?",
9090
toString(createTupleSingleVarMultipleBindingSets()));
@@ -96,11 +96,11 @@ public void testmultipleVarResults()
9696
{
9797
assertRegex(
9898
"\\?a\t\\?b\t\\?c\n"
99-
+ "<foo:bar>\t_:bnode\t\"baz\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
99+
+ "<foo:bar>\t_:bnode\t(baz|\"baz\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)\n"
100100
+ "(1|\"1\"\\^\\^<http://www.w3.org/2001/XMLSchema#integer>)\t\t\"Hello World!\"@en\n"
101-
+ "<http://example.org/test/ns/bindingA>\t\"http://example.com/other/ns/bindingB\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t<http://example.com/other/ns/binding,C>\n"
102-
+ "\"string with newline at the end \\\\n\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"string with space at the end \"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\" \"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
103-
+ "\"''single-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"\\\\\"\\\\\"double-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"\\\\t\\\\tunencoded tab characters followed by encoded \\\\t\\\\t\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n?",
101+
+ "<http://example.org/test/ns/bindingA>\t\"?http://example.com/other/ns/bindingB(\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\t<http://example.com/other/ns/binding,C>\n"
102+
+ "\"string with newline at the end \\\\n\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"?string with space at the end (\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\t\"? (\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\n"
103+
+ "\"?''single-quoted string(\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\t\"\\\\\"\\\\\"double-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"\\\\t\\\\tunencoded tab characters followed by encoded \\\\t\\\\t\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n?",
104104
toString(createTupleMultipleBindingSets()));
105105
}
106106

compliance/queryresultio/src/test/java/org/eclipse/rdf4j/query/resultio/text/tsv/SPARQLTSVTupleTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ public void testSingleVarResults()
7070
assertRegex(
7171
"\\?a\n" + "<foo:bar>\n"
7272
+ "(2.0(E0)?|\"2.0\"\\^\\^<http://www.w3.org/2001/XMLSchema#double>)\n" + "_:bnode3\n"
73-
+ "\"''single-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
73+
+ "\"?''single-quoted string(\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\n"
7474
+ "\"\\\\\"\\\\\"double-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
75-
+ "\"space at the end \"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
76-
+ "\"space at the end \"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
75+
+ "\"?space at the end (\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\n"
76+
+ "\"?space at the end (\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\n"
7777
+ "\"\\\\\"\\\\\"double-quoted string with no datatype\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
7878
+ "\"newline at the end \\\\n\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n?",
7979
toString(createTupleSingleVarMultipleBindingSets()));
@@ -85,11 +85,11 @@ public void testmultipleVarResults()
8585
{
8686
assertRegex(
8787
"\\?a\t\\?b\t\\?c\n"
88-
+ "<foo:bar>\t_:bnode\t\"baz\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
88+
+ "<foo:bar>\t_:bnode\t(baz|\"baz\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)\n"
8989
+ "(1|\"1\"\\^\\^<http://www.w3.org/2001/XMLSchema#integer>)\t\t\"Hello World!\"@en\n"
90-
+ "<http://example.org/test/ns/bindingA>\t\"http://example.com/other/ns/bindingB\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t<http://example.com/other/ns/binding,C>\n"
91-
+ "\"string with newline at the end \\\\n\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"string with space at the end \"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\" \"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n"
92-
+ "\"''single-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"\\\\\"\\\\\"double-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"\\\\t\\\\tunencoded tab characters followed by encoded \\\\t\\\\t\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n?",
90+
+ "<http://example.org/test/ns/bindingA>\t\"?http://example.com/other/ns/bindingB(\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\t<http://example.com/other/ns/binding,C>\n"
91+
+ "\"string with newline at the end \\\\n\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"?string with space at the end (\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\t\"? (\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\n"
92+
+ "\"?''single-quoted string(\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?)?\t\"\\\\\"\\\\\"double-quoted string\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\t\"\\\\t\\\\tunencoded tab characters followed by encoded \\\\t\\\\t\"(\\^\\^<http://www.w3.org/2001/XMLSchema#string>)?\n?",
9393
toString(createTupleMultipleBindingSets()));
9494
}
9595

compliance/rio/src/test/java/org/eclipse/rdf4j/rio/turtle/CustomTurtleParserTest.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
import java.io.StringWriter;
1414
import java.util.Collections;
1515

16+
import org.eclipse.rdf4j.model.IRI;
1617
import org.eclipse.rdf4j.model.Literal;
1718
import org.eclipse.rdf4j.model.Model;
1819
import org.eclipse.rdf4j.model.Namespace;
19-
import org.eclipse.rdf4j.model.URI;
2020
import org.eclipse.rdf4j.model.ValueFactory;
2121
import org.eclipse.rdf4j.model.impl.LinkedHashModel;
2222
import org.eclipse.rdf4j.model.impl.NamespaceImpl;
@@ -40,13 +40,13 @@
4040

4141
/**
4242
* Custom tests for Turtle Parser
43-
*
43+
*
4444
* @author Peter Ansell
4545
*/
4646
public class CustomTurtleParserTest {
4747

4848
@Rule
49-
public Timeout timeout = new Timeout(1000000);
49+
public Timeout timeout = Timeout.millis(1000000);
5050

5151
private ValueFactory vf;
5252

@@ -183,8 +183,8 @@ public void testLiteralWithNewlines()
183183
String okLiteralString = "Literal \n without \n new line at the beginning. \n ";
184184
String errLiteralString = "\n Literal \n with \n new line at the beginning. \n ";
185185

186-
URI mySubject = vf.createURI(namespace, "Subject");
187-
URI myPredicate = vf.createURI(namespace, "Predicate");
186+
IRI mySubject = vf.createIRI(namespace, "Subject");
187+
IRI myPredicate = vf.createIRI(namespace, "Predicate");
188188
Literal myOkObject = vf.createLiteral(okLiteralString);
189189
Literal myErrObject = vf.createLiteral(errLiteralString);
190190

@@ -301,7 +301,7 @@ public void testSES2013BlankNodeSemiColonBNodeSpaceURI()
301301
Model model = Rio.parse(new StringReader("<urn:a> a _:c2; <urn:b> <urn:c> ."), "", RDFFormat.TURTLE);
302302

303303
assertEquals(2, model.size());
304-
assertTrue(model.contains(vf.createURI("urn:a"), vf.createURI("urn:b"), vf.createURI("urn:c")));
304+
assertTrue(model.contains(vf.createIRI("urn:a"), vf.createIRI("urn:b"), vf.createIRI("urn:c")));
305305
}
306306

307307
@Test
@@ -311,7 +311,7 @@ public void testSES2013BlankNodeSemiColonBNodeURI()
311311
Model model = Rio.parse(new StringReader("<urn:a> a _:c2;<urn:b> <urn:c> ."), "", RDFFormat.TURTLE);
312312

313313
assertEquals(2, model.size());
314-
assertTrue(model.contains(vf.createURI("urn:a"), vf.createURI("urn:b"), vf.createURI("urn:c")));
314+
assertTrue(model.contains(vf.createIRI("urn:a"), vf.createIRI("urn:b"), vf.createIRI("urn:c")));
315315
}
316316

317317
@Test
@@ -411,8 +411,8 @@ public void testSES2165LiteralSpaceDatatypeNewline()
411411
RDFFormat.TURTLE);
412412

413413
assertEquals(1, model.size());
414-
assertTrue(model.contains(vf.createURI("urn:a"), vf.createURI("urn:b"),
415-
vf.createLiteral("testliteral", vf.createURI("urn:datatype"))));
414+
assertTrue(model.contains(vf.createIRI("urn:a"), vf.createIRI("urn:b"),
415+
vf.createLiteral("testliteral", vf.createIRI("urn:datatype"))));
416416
}
417417

418418
@Test
@@ -423,8 +423,8 @@ public void testSES2165LiteralSpaceDatatypeTab()
423423
RDFFormat.TURTLE);
424424

425425
assertEquals(1, model.size());
426-
assertTrue(model.contains(vf.createURI("urn:a"), vf.createURI("urn:b"),
427-
vf.createLiteral("testliteral", vf.createURI("urn:datatype"))));
426+
assertTrue(model.contains(vf.createIRI("urn:a"), vf.createIRI("urn:b"),
427+
vf.createLiteral("testliteral", vf.createIRI("urn:datatype"))));
428428
}
429429

430430
@Test
@@ -435,8 +435,8 @@ public void testSES2165LiteralSpaceDatatypeCarriageReturn()
435435
RDFFormat.TURTLE);
436436

437437
assertEquals(1, model.size());
438-
assertTrue(model.contains(vf.createURI("urn:a"), vf.createURI("urn:b"),
439-
vf.createLiteral("testliteral", vf.createURI("urn:datatype"))));
438+
assertTrue(model.contains(vf.createIRI("urn:a"), vf.createIRI("urn:b"),
439+
vf.createLiteral("testliteral", vf.createIRI("urn:datatype"))));
440440
}
441441

442442
@Test
@@ -447,8 +447,8 @@ public void testSES2165LiteralSpaceDatatypeSpace()
447447
RDFFormat.TURTLE);
448448

449449
assertEquals(1, model.size());
450-
assertTrue(model.contains(vf.createURI("urn:a"), vf.createURI("urn:b"),
451-
vf.createLiteral("testliteral", vf.createURI("urn:datatype"))));
450+
assertTrue(model.contains(vf.createIRI("urn:a"), vf.createIRI("urn:b"),
451+
vf.createLiteral("testliteral", vf.createIRI("urn:datatype"))));
452452
}
453453

454454
@Test
@@ -460,8 +460,8 @@ public void testSES2165LiteralSpaceDatatypeComment()
460460
RDFFormat.TURTLE);
461461

462462
assertEquals(1, model.size());
463-
assertTrue(model.contains(vf.createURI("urn:a"), vf.createURI("urn:b"),
464-
vf.createLiteral("testliteral", vf.createURI("urn:datatype"))));
463+
assertTrue(model.contains(vf.createIRI("urn:a"), vf.createIRI("urn:b"),
464+
vf.createLiteral("testliteral", vf.createIRI("urn:datatype"))));
465465
}
466466

467467
@Test
@@ -504,7 +504,7 @@ public void testParsingNamespacesWithOverride()
504504
RDFFormat.TURTLE, aConfig, vf, new ParseErrorLogger());
505505

506506
assertEquals(1, model.size());
507-
assertTrue(model.contains(vf.createURI("urn:a"), vf.createURI("urn:not_skos:broader"),
508-
vf.createURI("urn:b")));
507+
assertTrue(model.contains(vf.createIRI("urn:a"), vf.createIRI("urn:not_skos:broader"),
508+
vf.createIRI("urn:b")));
509509
}
510510
}

compliance/sparql/src/test/java/org/eclipse/rdf4j/query/parser/sparql/ArbitraryLengthPathTest.java

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
*******************************************************************************/
88
package org.eclipse.rdf4j.query.parser.sparql;
99

10-
import junit.framework.TestCase;
11-
1210
import org.eclipse.rdf4j.model.ValueFactory;
11+
import org.eclipse.rdf4j.model.vocabulary.RDF;
12+
import org.eclipse.rdf4j.model.vocabulary.RDFS;
1313
import org.eclipse.rdf4j.query.QueryLanguage;
1414
import org.eclipse.rdf4j.repository.Repository;
1515
import org.eclipse.rdf4j.repository.RepositoryConnection;
@@ -20,6 +20,8 @@
2020
import org.junit.Before;
2121
import org.junit.Test;
2222

23+
import junit.framework.TestCase;
24+
2325
/**
2426
* @author james
2527
*/
@@ -91,6 +93,35 @@ public void test100000()
9193
assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
9294
}
9395

96+
@Test
97+
public void testDirection()
98+
throws Exception
99+
{
100+
ValueFactory vf = con.getValueFactory();
101+
con.add(vf.createIRI("urn:test:a"), vf.createIRI("urn:test:rel"), vf.createIRI("urn:test:b"));
102+
con.add(vf.createIRI("urn:test:b"), vf.createIRI("urn:test:rel"), vf.createIRI("urn:test:a"));
103+
String sparql = "ASK { <urn:test:a> <urn:test:rel>* <urn:test:b> . <urn:test:b> <urn:test:rel>* <urn:test:a> }";
104+
assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
105+
}
106+
107+
@Test
108+
public void testSimilarPatterns()
109+
throws Exception
110+
{
111+
ValueFactory vf = con.getValueFactory();
112+
con.add(vf.createIRI("urn:test:a"), RDF.TYPE, vf.createIRI("urn:test:c"));
113+
con.add(vf.createIRI("urn:test:b"), RDF.TYPE, vf.createIRI("urn:test:d"));
114+
con.add(vf.createIRI("urn:test:c"), RDFS.SUBCLASSOF, vf.createIRI("urn:test:e"));
115+
con.add(vf.createIRI("urn:test:d"), RDFS.SUBCLASSOF, vf.createIRI("urn:test:f"));
116+
String sparql = "ASK { \n"
117+
+ " values (?expectedTargetClass55555 ?expectedTargetClass5544T) {(<urn:test:e> <urn:test:f>)}.\n"
118+
+ " <urn:test:a> a ?linkTargetClass55555 .\n"
119+
+ " ?linkTargetClass55555 rdfs:subClassOf* ?expectedTargetClass55555 .\n"
120+
+ " <urn:test:b> a ?linkTargetClass55556 .\n"
121+
+ " ?linkTargetClass55556 rdfs:subClassOf* ?expectedTargetClass5544T . }";
122+
assertTrue(con.prepareBooleanQuery(QueryLanguage.SPARQL, sparql).evaluate());
123+
}
124+
94125
private void populate(int n)
95126
throws RepositoryException
96127
{

core/console/src/main/java/org/eclipse/rdf4j/console/Create.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ private void createRepository(final String templateName)
105105
() -> new RepositoryConfigException("missing repository node"));
106106
final RepositoryConfig repConfig = RepositoryConfig.create(graph, repositoryNode);
107107
repConfig.validate();
108-
boolean proceed = RepositoryConfigUtil.hasRepositoryConfig(systemRepo, repConfig.getID())
109-
? consoleIO.askProceed(
110-
"WARNING: you are about to overwrite the configuration of an existing repository!",
111-
false)
112-
: true;
113-
if (proceed) {
108+
String overwrite = "WARNING: you are about to overwrite the configuration of an existing repository!";
109+
boolean proceedOverwrite = RepositoryConfigUtil.hasRepositoryConfig(systemRepo,
110+
repConfig.getID()) ? consoleIO.askProceed(overwrite, false) : true;
111+
String suggested = this.state.getManager().getNewRepositoryID(repConfig.getID());
112+
String invalid = "WARNING: There are potentially incompatible characters in the repository id.";
113+
boolean proceedInvalid = !suggested.startsWith(repConfig.getID())
114+
? consoleIO.askProceed(invalid, false) : true;
115+
if (proceedInvalid && proceedOverwrite) {
114116
try {
115117
RepositoryConfigUtil.updateRepositoryConfigs(systemRepo, repConfig);
116118
consoleIO.writeln("Repository created");

core/http/client/src/main/java/org/eclipse/rdf4j/http/client/RDF4JProtocolSession.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.nio.charset.Charset;
2020
import java.util.ArrayList;
2121
import java.util.List;
22+
import java.util.Map;
2223
import java.util.Objects;
2324
import java.util.concurrent.ExecutorService;
2425
import java.util.regex.Matcher;
@@ -764,7 +765,11 @@ protected HttpUriRequest getQueryMethod(QueryLanguage ql, String query, String b
764765
builder.setEntity(new UrlEncodedFormEntity(getQueryMethodParameters(ql, query, baseURI, dataset,
765766
includeInferred, maxQueryTime, bindings), UTF8));
766767
}
767-
768+
// functionality to provide custom http headers as required by the
769+
// applications
770+
for (Map.Entry<String, String> additionalHeader : getAdditionalHttpHeaders().entrySet()) {
771+
builder.addHeader(additionalHeader.getKey(), additionalHeader.getValue());
772+
}
768773
return builder.build();
769774
}
770775

@@ -793,7 +798,11 @@ protected HttpUriRequest getUpdateMethod(QueryLanguage ql, String update, String
793798
builder.setEntity(new UrlEncodedFormEntity(getUpdateMethodParameters(ql, update, baseURI, dataset,
794799
includeInferred, maxExecutionTime, bindings), UTF8));
795800
}
796-
801+
// functionality to provide custom http headers as required by the
802+
// applications
803+
for (Map.Entry<String, String> additionalHeader : getAdditionalHttpHeaders().entrySet()) {
804+
builder.addHeader(additionalHeader.getKey(), additionalHeader.getValue());
805+
}
797806
return builder.build();
798807
}
799808

core/http/workbench/src/main/java/org/eclipse/rdf4j/workbench/proxy/CookieHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected String getCookie(final HttpServletRequest req, final HttpServletRespon
6060

6161
private void initCookie(final Cookie cookie, final HttpServletRequest req) {
6262
final String context = req.getContextPath();
63-
cookie.setPath(null == context ? "/" : context);
63+
cookie.setPath(context.isEmpty() ? "/" : context);
6464
if (maxAge != null) {
6565
cookie.setMaxAge(Integer.parseInt(maxAge));
6666
}

0 commit comments

Comments
 (0)