Skip to content
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

[template] Arguments substititation, class arguments checking, arguments in params duplication #41

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@template = [*
_hum1
_=> nrel_father::
_hum2;;

_hum3
_=> nrel_father::
_hum2;;

concept_human
_-> _hum1;
_-> _hum3;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is human2 a person?

*];;
@template
=> nrel_system_identifier: [search_template];;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not
search_template = [* .... *];;


human_ivan_ivanov
<- concept_human;
=> nrel_father:
human_andrey_ivanov;;

human_pavel_ivanov
<- concept_human;
=> nrel_father:
human_andrey_ivanov;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not andreevich?


human_andrey_ivanov
<- concept_human;;

sc_node_class
-> concept_human;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add sc_node_norole_relation for nrel_system_identifier and nrel_father

Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,32 @@ TEST_F(TemplateSearchManagerTest, SearchWithContent_MultipleResultTestCase)
searchResults[0][searchLinkIdentifier] == context.HelperFindBySystemIdtf(secondCorrectResultLinkIdentifier));
}

TEST_F(TemplateSearchManagerTest, SearchWithContent_EqualResultTestCase)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no content in this template. Rename test and scs file for it

{
std::string firstHuman = "human_ivan_ivanov";
std::string secondHuman = "human_pavel_ivanov";
std::string varHumanName1 = "_hum1";
std::string varHumanName3 = "_hum3";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make const


ScMemoryContext & context = *m_ctx;

loader.loadScsFile(context, TEST_FILES_DIR_PATH + "searchWithContentEqualResultTestStucture.scs");
initialize();

ScAddr searchTemplateAddr = context.HelperFindBySystemIdtf(TEST_SEARCH_TEMPLATE_ID);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const &

inference::TemplateSearcher templateSearcher = inference::TemplateSearcher(&context);
ScTemplateParams templateParams;
std::vector<ScTemplateSearchResultItem> searchResults =
templateSearcher.searchTemplate(searchTemplateAddr, templateParams);

EXPECT_EQ(searchResults.size(), 1);
EXPECT_TRUE(searchResults[0][varHumanName1] == context.HelperFindBySystemIdtf(firstHuman) ||
searchResults[0][varHumanName1] == context.HelperFindBySystemIdtf(secondHuman));
EXPECT_TRUE(searchResults[0][varHumanName3] == context.HelperFindBySystemIdtf(firstHuman) ||
searchResults[0][varHumanName3] == context.HelperFindBySystemIdtf(secondHuman));
EXPECT_FALSE(searchResults[0][varHumanName1] == searchResults[0][varHumanName3]);
}

TEST_F(TemplateSearchManagerTest, SearchWithoutContent_NoStructuresTestCase)
{
ScMemoryContext & context = *m_ctx;
Expand Down