Skip to content

Commit

Permalink
Merge branch 'release/29.x' into feature/4209-Improve-query-speed-for…
Browse files Browse the repository at this point in the history
…-large-KBs-when-using-RDF4J-Lucene-FTS-2
  • Loading branch information
reckart authored Sep 28, 2023
2 parents 205402e + 57dc94e commit 272777f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,26 +313,33 @@ public void registerKnowledgeBase(KnowledgeBase aKB, RepositoryImplConfig aCfg)
}

@Override
public void defineBaseProperties(KnowledgeBase akb)
public void defineBaseProperties(KnowledgeBase aKB)
{
// KB will initialize base properties with base IRI schema properties defined by user
if (akb.getType() == RepositoryType.LOCAL) {
ValueFactory vf = SimpleValueFactory.getInstance();

createBaseProperty(akb, new KBProperty(akb.getSubclassIri(),
vf.createIRI(akb.getSubclassIri()).getLocalName()));
createBaseProperty(akb,
new KBProperty(akb.getLabelIri(),
vf.createIRI(akb.getLabelIri()).getLocalName(), null,
XSD.STRING.stringValue()));
createBaseProperty(akb,
new KBProperty(akb.getDescriptionIri(),
vf.createIRI(akb.getDescriptionIri()).getLocalName(), null,
XSD.STRING.stringValue()));
createBaseProperty(akb, new KBProperty(akb.getTypeIri(),
vf.createIRI(akb.getTypeIri()).getLocalName()));
createBaseProperty(akb, new KBProperty(akb.getSubPropertyIri(),
vf.createIRI(akb.getSubPropertyIri()).getLocalName()));
if (aKB.getType() == RepositoryType.LOCAL) {
var readOnly = aKB.isReadOnly();
aKB.setReadOnly(false);
try {
ValueFactory vf = SimpleValueFactory.getInstance();

createBaseProperty(aKB, new KBProperty(aKB.getSubclassIri(),
vf.createIRI(aKB.getSubclassIri()).getLocalName()));
createBaseProperty(aKB,
new KBProperty(aKB.getLabelIri(),
vf.createIRI(aKB.getLabelIri()).getLocalName(), null,
XSD.STRING.stringValue()));
createBaseProperty(aKB,
new KBProperty(aKB.getDescriptionIri(),
vf.createIRI(aKB.getDescriptionIri()).getLocalName(), null,
XSD.STRING.stringValue()));
createBaseProperty(aKB, new KBProperty(aKB.getTypeIri(),
vf.createIRI(aKB.getTypeIri()).getLocalName()));
createBaseProperty(aKB, new KBProperty(aKB.getSubPropertyIri(),
vf.createIRI(aKB.getSubPropertyIri()).getLocalName()));
}
finally {
aKB.setReadOnly(readOnly);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ public void applyState()
KnowledgeBase kb = getModel().getObject().getKb();
switch (kb.getType()) {
case LOCAL:
// local knowledge bases are editable by default
kb.setReadOnly(false);

// We need to handle this manually here because the onSubmit method of the upload
// form is only called *after* the upload component has already been detached and
// as a consequence all uploaded files have been cleared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,14 @@ public void applyState()

switch (kbModel.getObject().getKb().getType()) {
case LOCAL:
// Local KBs are writeable by default
kbModel.getObject().getKb().setReadOnly(false);
// local KBs are always RDF4J + Lucene, so we can set the FTS mode accordingly
kbModel.getObject().getKb().setFullTextSearchIri(FTS_LUCENE.stringValue());
break;
case REMOTE:
// Local KBs are read-only
kbModel.getObject().getKb().setReadOnly(true);
// remote KBs are by default not using FTS but if we apply a remote DB profile,
// then it will set the FTS according to the setting in the profile
kbModel.getObject().getKb().setFullTextSearchIri(FTS_NONE.stringValue());
Expand Down

0 comments on commit 272777f

Please sign in to comment.