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

Q20-15 - story/Q20-15 #33

Open
wants to merge 69 commits into
base: develop
Choose a base branch
from
Open

Q20-15 - story/Q20-15 #33

wants to merge 69 commits into from

Conversation

ShivaniYerram
Copy link
Contributor

Guidelines for Pull Requests

If you haven't yet read our code review guidelines, please do so, You can find them here.

Please confirm the following by adding an x for each item (turn [ ] into [x]).

  • I have removed all code style changes that are not necessary (e.g. changing blanks across the whole file that don’t need to be changed, adding empty lines in parts other than your own code)
  • I am not making any changes to files that don’t have any effect (e.g. imports added that don’t need to be added)
  • I do not have any sysout statements in my code or commented out code that isn’t needed anymore
  • I am not reformatting any files in the wrong format or without cause.
  • I am not changing file encoding or line endings to something else than UTF-8, LF
  • My pull request does not show an insane amount of files being changed although my ticket only requires a few files being changed
  • I have added Javadoc/documentation where appropriate
  • I have added test cases where appropriate
  • I have explained any part of my code/implementation decisions that is not be self-explanatory

Please provide a brief description of your ticket

(you can copy the ticket if it hasn't changed)

The endpoint needs to accept a list of mappings and patterns (pattern1 -> mapping1, pattern2 -> mapping2, ...). Quadriga would then create a new "Collection Mapping" that transforms all the graphs that are matched by one of the patterns with the corresponding pattern. Basically, new groups of triples are being created (in addition to the default mapping one).

Anything else the reviewer needs to know?

... describe here ...

MaulikLim and others added 30 commits June 15, 2022 16:28
…ph node, only check for type if the concept has one
return uri + "/";
} else if (!containsHttps) {
uri = uri.replaceFirst("http", "https");
uri = uri.endsWith("/") ? uri.substring(0, uri.length() - 1) : uri;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can check whether we need a https with "/" or without "/", once Q20-16 is merged.

@ShivaniYerram ShivaniYerram reopened this Feb 28, 2024
quadriga/pom.xml Outdated
@@ -45,11 +45,13 @@
<neo4j.url>http://neo4j:quadriga@localhost:7474/</neo4j.url>
<neo4j.database>quadriga</neo4j.database>

<citesphere.base.url></citesphere.base.url>
<citesphere.base.url>/</citesphere.base.url>
Copy link
Member

Choose a reason for hiding this comment

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

this should not be here

Copy link
Member

Choose a reason for hiding this comment

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

unaddressed

if (eventGraphs == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
System.out.println(patternMappingList);
Copy link
Member

Choose a reason for hiding this comment

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

?

public ResponseEntity<List<JobPatternInfo>> mapPatternToTriples(@PathVariable String collectionId,
@RequestBody List<PatternMapping> patternMappingList) {

List<EventGraph> eventGraphs = eventGraphService.getEventGraphs(new ObjectId(collectionId));
Copy link
Member

Choose a reason for hiding this comment

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

these can be a lot of graphs. You don't want to load them all into memory. I don't think you want this done here.


}

return new ResponseEntity<>(HttpStatus.NOT_FOUND);
Copy link
Member

Choose a reason for hiding this comment

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

when would that be the case? And why does it return "not found"? what is not found?

* @param track is the URI of the status of the job.
* @param explore is the URI of the collection whose graphs are being mapped with the input patterns.
*/

Copy link
Member

Choose a reason for hiding this comment

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

remove

Copy link
Member

Choose a reason for hiding this comment

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

?

@@ -0,0 +1,33 @@
package edu.asu.diging.quadriga.core.data;
Copy link
Member

Choose a reason for hiding this comment

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

where?

@@ -0,0 +1,9 @@
package edu.asu.diging.quadriga.core.model.jobs;

public enum JobStatus {
Copy link
Member

Choose a reason for hiding this comment

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

javadoc

jobRepository.save(job);
}
} else {
mappedTripleGroup = mappedTripleGroupService.get(collectionId, MappedTripleType.CUSTOM_MAPPING);
Copy link
Member

Choose a reason for hiding this comment

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

That does not make sense. There can be multiple custom mappings for a collection, each in their own custom mapping triple group. Also, a method called get should get an element, not create it (I missed that before).

}

for (EventGraph network : networks) {
List<Graph> extractedGraphs = patternFinder.findGraphsWithPattern(patternMapping.getMetadata(), patternRoot,
Copy link
Member

Choose a reason for hiding this comment

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

is that method only finding graphs or also mapping them? It seems like it's also mapping them, in which case the method name is incorrect.

}

@Test
void testProcessJson_Success() throws NodeNotFoundException, InvalidObjectIdException, CollectionNotFoundException {
Copy link
Member

Choose a reason for hiding this comment

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

please adhere to our test naming guidelines

@jdamerow jdamerow closed this Mar 28, 2024
@ShivaniYerram ShivaniYerram reopened this Apr 10, 2024
quadriga/pom.xml Outdated
@@ -45,11 +45,13 @@
<neo4j.url>http://neo4j:quadriga@localhost:7474/</neo4j.url>
<neo4j.database>quadriga</neo4j.database>

<citesphere.base.url></citesphere.base.url>
<citesphere.base.url>/</citesphere.base.url>
Copy link
Member

Choose a reason for hiding this comment

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

unaddressed

List<EventGraph> eventGraphs = eventGraphService.getEventGraphsByCollectionId(new ObjectId(collectionId), PageRequest.of(pageNumber, pageSize));

if (eventGraphs == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
Copy link
Member

Choose a reason for hiding this comment

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

I think the logic should rather be to check if the collection exists, not the if event graphs exists. it's fine (even if it doesn't make much sense) to try to run mappings on 0 event graphs. An invalid collection id, however, should return a not found.


MappedTripleGroup mappedTripleGroup = new MappedTripleGroup();
mappedTripleGroup.set_id(new ObjectId());
mappedTripleGroup.setCollectionId(new ObjectId(collectionId));
Copy link
Member

Choose a reason for hiding this comment

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

this should not be part of the controller, that's business logic.


String jobId = jobManager.createJob(collectionId, mappedTripleGroup.get_id().toString(), eventGraphs.size());

List<JobPatternInfo> jobInfos = mapGraphToTriple.mapPatterns(collectionId, jobId, eventGraphs, patternMappingList);
Copy link
Member

Choose a reason for hiding this comment

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

same with these two lines. The controller should just call one method that takes care of the rest.

* @param track is the URI of the status of the job.
* @param explore is the URI of the collection whose graphs are being mapped with the input patterns.
*/

Copy link
Member

Choose a reason for hiding this comment

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

?

import edu.asu.diging.quadriga.core.service.AsyncPatternProcessor;

@Service
public class MapGraphToTripleImpl implements MapGraphToTriple{
Copy link
Member

Choose a reason for hiding this comment

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

bad class name. class names should be nouns.

jobInfos.add(jobInfo);
}

return jobInfos;
Copy link
Member

Choose a reason for hiding this comment

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

ah, right. I think I would structure the response differently though. multiple job infos with the same job id indicates the ids could be different. Instead, i would have one job object with an id that then has a list of mapping infos.

@@ -0,0 +1,33 @@
package edu.asu.diging.quadriga.core.data;
Copy link
Member

Choose a reason for hiding this comment

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

?

jobRepository.save(job);
}
} else {
mappedTripleGroup = mappedTripleGroupService.getMappedTripleGroupIfExistsOrAdd(collectionId, MappedTripleType.CUSTOM_MAPPING);
Copy link
Member

Choose a reason for hiding this comment

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

this does not seem right, wouldn't that always return the first custom mapping it finds?

network);
for (Graph extractedGraph : extractedGraphs) {
try {
mappedTripleService.storeMappedGraph(extractedGraph, mappedTripleGroup);
Copy link
Member

Choose a reason for hiding this comment

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

there needs to be some documentation about this somewhere, or even better, default mapping should not be called default mapping.

@jdamerow jdamerow closed this Apr 30, 2024
@pooja-thalur pooja-thalur reopened this Sep 18, 2024
@pooja-thalur pooja-thalur marked this pull request as draft September 18, 2024 19:05
@pooja-thalur pooja-thalur reopened this Dec 4, 2024
@pooja-thalur pooja-thalur marked this pull request as ready for review December 16, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants