-
Notifications
You must be signed in to change notification settings - Fork 86
Magic service query for text search. #1732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
joka921
merged 36 commits into
ad-freiburg:master
from
Flixtastic:magic-service-query-text-search
Mar 18, 2025
Merged
Changes from 7 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
184938b
First try at implementing structures to use the MagicServiceQuery for…
Flixtastic 357b758
Fixed issues with MagicServiceQuery for word search. MagicServiceQuer…
Flixtastic fa09984
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic e93f216
Split the TextSearchQuery to the WordSearch and EntitySearch. This al…
Flixtastic 5aedb69
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic 0cc979b
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic b968bb7
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic 6a7a477
Small changes
Flixtastic 4a67b32
Removed attributes of entity and word scan that were redundant due to…
Flixtastic cb6710c
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic 50c846f
Score is now only shown when wanted
Flixtastic cee48c6
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic 2c65d22
Merge branch 'magic-service-query-text-search' of github.com:Flixtast…
Flixtastic 4111bd3
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic fd4b441
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic 06e8249
First try at a better structured service query for text search
Flixtastic b6fdd54
Changed the text search service to handle both entity and word search…
Flixtastic ad781f4
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic aa57226
Merge branch 'ad-freiburg:master' into magic-service-query-text-search
Flixtastic 5761b22
Reformatting the TextSearchQuery.cpp
Flixtastic a35975e
Moved the configs for word and entity search. Also slimmed out classe…
Flixtastic 3dc5fcc
Added IRI to magic service query for entity search. Improved accuracy…
Flixtastic 07b1a93
Added Tests for QueryPlanning for textsearch magic service query. Imp…
Flixtastic dd7b2e0
Merge branch 'master' into magic-service-query-text-search
Flixtastic 8b7921e
Further test improvements. Small clean ups
Flixtastic d77bc2d
Refactor visitTextSearch and computeResult of Entity and Word Scan
Flixtastic c398627
Renaming of Variable names in TextSearch configs and of TextSearchQue…
Flixtastic 28d11a8
Added comments for TextSearchQuery.h
Flixtastic 957824d
Addressed Sonar issues
Flixtastic 95a141a
Small suggested changes.
Flixtastic 5a7bb3e
Added readable debugging information to TextSearchConfigs and updated…
Flixtastic 8cd7b94
Addressed SonarQube issues.
Flixtastic fda30bd
Moving detailed description of TextIndexScanForEntity and TextIndexSc…
Flixtastic 850890d
Adding documentation of text search feature
Flixtastic 5188a99
Fixing SonarQube issues.
Flixtastic d4707a6
Moved the operator definition to the cpp file again
Flixtastic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright 2024, University of Freiburg, | ||
// Chair of Algorithms and Data Structures. | ||
// Author: Felix Meisen (fesemeisen@outlook.de) | ||
|
||
#include "parser/EntitySearchQuery.h" | ||
|
||
#include "parser/MagicServiceIriConstants.h" | ||
|
||
namespace parsedQuery { | ||
|
||
// ____________________________________________________________________________ | ||
void EntitySearchQuery::addParameter(const SparqlTriple& triple) { | ||
auto sipmleTriple = triple.getSimple(); | ||
TripleComponent predicate = sipmleTriple.p_; | ||
TripleComponent object = sipmleTriple.o_; | ||
Flixtastic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
auto predString = extractParameterName(predicate, ENTITY_SEARCH_IRI); | ||
|
||
// TODO find a smoother way to interpret given strings than reading them as | ||
// literals | ||
if (predString == "containedWithWord") { | ||
if (!object.isLiteral()) { | ||
throw EntitySearchException( | ||
"The parameter <containedWithWord> expects a literal consisting of " | ||
"one search word"); | ||
} | ||
std::string_view literal = object.getLiteral().toStringRepresentation(); | ||
word_ = std::string(literal.substr(1, literal.size() - 2)); | ||
} else if (predString == "containsEntity") { | ||
if (object.isLiteral()) { | ||
std::string_view literal = object.getLiteral().toStringRepresentation(); | ||
fixedEntity_ = std::string(literal.substr(1, literal.size() - 2)); | ||
} else if (object.isVariable()) { | ||
setVariable("containsEntity", object, entityVar_); | ||
} else { | ||
throw EntitySearchException( | ||
"The parameter <containsEntity> expects a literal which is " | ||
"interpreted as fixed entity or a variable to bind the entity to"); | ||
} | ||
} else if (predString == "bindScore") { | ||
setVariable("bindScore", object, scoreVar_); | ||
} else if (predString == "bindText") { | ||
setVariable("bindText", object, textVar_); | ||
} | ||
} | ||
|
||
// ____________________________________________________________________________ | ||
TextIndexScanForEntityConfiguration | ||
EntitySearchQuery::toTextIndexScanForEntityConfiguration() const { | ||
if (!word_.has_value()) { | ||
throw EntitySearchException( | ||
"Missing parameter <containedWithWord> in entity search."); | ||
} else if (!textVar_.has_value()) { | ||
throw EntitySearchException( | ||
"Missing parameter <bindText> in entity search."); | ||
} else if (!(fixedEntity_.has_value() || entityVar_.has_value())) { | ||
throw EntitySearchException( | ||
"Missing parameter <containsEntity> in entity search."); | ||
} else if (fixedEntity_.has_value() && entityVar_.has_value()) { | ||
throw EntitySearchException( | ||
"<containsEntity> should be used exactly once in entity search."); | ||
} | ||
if (entityVar_.has_value()) { | ||
return TextIndexScanForEntityConfiguration{ | ||
textVar_.value(), entityVar_.value(), word_.value(), scoreVar_}; | ||
} else { | ||
return TextIndexScanForEntityConfiguration{ | ||
textVar_.value(), fixedEntity_.value(), word_.value(), scoreVar_}; | ||
} | ||
} | ||
|
||
} // namespace parsedQuery |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.