-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: develop
Are you sure you want to change the base?
Conversation
…ph node, only check for type if the concept has one
…nd query by 'equal_to' field otherwise
…for a pattern match
return uri + "/"; | ||
} else if (!containsHttps) { | ||
uri = uri.replaceFirst("http", "https"); | ||
uri = uri.endsWith("/") ? uri.substring(0, uri.length() - 1) : uri; |
There was a problem hiding this comment.
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.
…ed for some remaining changes.
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> |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
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> |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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. | ||
*/ | ||
|
There was a problem hiding this comment.
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{ |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
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]
).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 ...