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

Feature/person, event, OU dynapi crud #3908

Draft
wants to merge 39 commits into
base: dynapi-1.14
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4a2bf00
Added n3 files for person crud operations.
ivanmrsulja May 31, 2023
07b2bd2
Updated RDF.
ivanmrsulja Jun 1, 2023
361206e
Added person_for_deleting internal parameter definition.
ivanmrsulja Jun 1, 2023
4994514
Updated n3 files so they support optional fields for person entity.
ivanmrsulja Jun 8, 2023
1a444b5
Updated RDF types and removed redundant definitions.
ivanmrsulja Jun 9, 2023
10975c3
Updated n3 files so that conditional steps are properly setup.
ivanmrsulja Jun 9, 2023
b0ae28d
Updated n3 files.
ivanmrsulja Jun 12, 2023
25ce0d1
Updated parameter definitions with optional configuration.
ivanmrsulja Jun 15, 2023
ccec51f
Updated n3 files. Made fetch parameters optional.
ivanmrsulja Jun 16, 2023
a13b21a
Added delete endpoint using construct queries.
ivanmrsulja Jun 21, 2023
aba6ebe
Added UPDATE endpoint as well as mandatory label field.
ivanmrsulja Jun 22, 2023
8f5df5b
Updated delete operation to delete label.
ivanmrsulja Jun 22, 2023
35aae4b
Fixed .n3 notation syntax in partial creation of resource.
ivanmrsulja Jun 22, 2023
7923f5d
Updated update workflow.
ivanmrsulja Jun 22, 2023
4ba24e7
Updated endpoints so all procedures use resource_id parameter for fet…
ivanmrsulja Jun 23, 2023
0c9c3d2
Fixed deletion bug, switched to using vivoweb.org abox assertion.
ivanmrsulja Jun 30, 2023
f5663f0
Added experimental multi language support.
ivanmrsulja Jul 31, 2023
f1e09b0
Implemented access controll in person CRUD endpoints.
ivanmrsulja Aug 2, 2023
e25b264
Started implementing person position creation loop.
ivanmrsulja Aug 10, 2023
3f623fc
Merge branch 'feature/person-dynapi-crud' of https://github.com/ivanm…
ivanmrsulja Aug 10, 2023
967a2c5
Started working on executable descriptor.
ivanmrsulja Aug 16, 2023
d2870b3
Fixed formatting.
ivanmrsulja Aug 16, 2023
26b4f47
Added internal key parameters for position entity. Added JSOn contain…
ivanmrsulja Aug 17, 2023
faf7dc5
Added position key checks and construct query to create them. Fixed s…
ivanmrsulja Aug 24, 2023
089b3fd
Fixed some bugs with type conversion.
ivanmrsulja Aug 25, 2023
46ab030
Added fetching person with all positions, fixed some bugs.
ivanmrsulja Aug 30, 2023
d819819
Added parameter substitution to generated uri to try to overcome pers…
ivanmrsulja Sep 1, 2023
6c2a49d
Added OU procedures. Fixed bugs when reading person.
ivanmrsulja Sep 4, 2023
f49bf1a
Added creation and update of OUs with payload as specified as in issu…
ivanmrsulja Sep 5, 2023
b73ba5b
Renamed units to unit in file name.
ivanmrsulja Sep 5, 2023
0a0c049
Added person positions update. Found a way to embed JSON into SPARQL …
ivanmrsulja Sep 6, 2023
ca97eb2
Added event n3 files with creation, deletion and basic reads. Fixed s…
ivanmrsulja Sep 8, 2023
4cd1e6b
Refactored .n3 files.
ivanmrsulja Sep 11, 2023
6c88b7c
Removed old implementations, refactored OU related files.
ivanmrsulja Sep 12, 2023
5f78f09
Fixed person position creation bug. Started working on refactoring pe…
ivanmrsulja Sep 18, 2023
a908411
Refactoring person .n3 files.
ivanmrsulja Sep 21, 2023
6284dd9
Refactoring person n3 files. Switched deletion fetch to full union.
ivanmrsulja Sep 22, 2023
d76add0
Finished refactoring. Fixed person creation bug when providing an inc…
ivanmrsulja Sep 25, 2023
aa48c89
Fixed person position reading bug.
ivanmrsulja Oct 4, 2023
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,210 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
@prefix dynapi: <https://vivoweb.org/ontology/vitro-dynamic-api#> .
@prefix dynapi_java: <java:edu.cornell.mannlib.vitro.webapp.dynapi.components#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix creation_properties: <https://vivoweb.org/procedure/create_event/creation_properties/> .
@prefix unpacking_properties: <https://vivoweb.org/procedure/create_event/unpacking_properties/> .
@prefix execute_template: <https://vivoweb.org/procedure/create_event/execute_template/> .
@prefix creation_parameter: <https://vivoweb.org/procedure/event/parameter/> .
@prefix whitelist_access: <https://vivoweb.org/procedure/event/access/> .
@prefix event_condition: <https://vivoweb.org/condition/event/> .
@prefix dynapi_model: <https://vivoweb.org/ontology/vitro-dynamic-api/model/> .

###############################################
### CREATE
###############################################

<https://vivoweb.org/procedure/create_event>
a dynapi:Procedure ;
rdfs:label "Create an event"@en-US ;
dynapi:accessWhitelist whitelist_access:admin ;
dynapi:hasFirstStep creation_properties:step1 ;
dynapi:providesParameter creation_parameter:uri .

creation_properties:step1
a dynapi:OperationalStep ;
rdfs:label "creation of an event step 1"@en-US ;
dynapi:hasOperation execute_template:n3_template_subject ;
dynapi:hasNextStep creation_properties:conditional_for_step2 .

creation_properties:conditional_for_step2
a dynapi:ConditionalStep ;
rdfs:label "conditional step for event type check"@en-US ;
dynapi:nextIfSatisfied creation_properties:step2 ;
dynapi:nextIfNotSatisfied creation_properties:conditional_for_step3 ;
dynapi:hasCondition event_condition:type_check .

creation_properties:step2
a dynapi:OperationalStep ;
rdfs:label "creation of an event step 2"@en-US ;
dynapi:hasOperation execute_template:n3_template_type ;
dynapi:hasNextStep creation_properties:conditional_for_step3 .

creation_properties:conditional_for_step3
a dynapi:ConditionalStep ;
rdfs:label "conditional step for event name check"@en-US ;
dynapi:nextIfSatisfied creation_properties:step3 ;
dynapi:nextIfNotSatisfied creation_properties:conditional_for_step4 ;
dynapi:hasCondition event_condition:name_check .

creation_properties:step3
a dynapi:OperationalStep ;
rdfs:label "creation of an event step 3"@en-US ;
dynapi:hasOperation execute_template:n3_template_name ;
dynapi:hasNextStep creation_properties:conditional_for_step4 .

creation_properties:conditional_for_step4
a dynapi:ConditionalStep ;
rdfs:label "conditional step for event abbreviation check"@en-US ;
dynapi:nextIfSatisfied creation_properties:step4 ;
dynapi:nextIfNotSatisfied creation_properties:conditional_for_step5 ;
dynapi:hasCondition event_condition:abbreviation_check .

creation_properties:step4
a dynapi:OperationalStep ;
rdfs:label "creation of an event step 4"@en-US ;
dynapi:hasOperation execute_template:n3_template_abbreviation ;
dynapi:hasNextStep creation_properties:conditional_for_step5 .

creation_properties:conditional_for_step5
a dynapi:ConditionalStep ;
rdfs:label "conditional step for event startDate check"@en-US ;
dynapi:nextIfSatisfied creation_properties:step5 ;
dynapi:nextIfNotSatisfied creation_properties:conditional_for_step6 ;
dynapi:hasCondition event_condition:startDate_check .

creation_properties:step5
a dynapi:OperationalStep ;
rdfs:label "creation of an event step 5"@en-US ;
dynapi:hasOperation execute_template:n3_template_startDate ;
dynapi:hasNextStep creation_properties:conditional_for_step6 .

creation_properties:conditional_for_step6
a dynapi:ConditionalStep ;
rdfs:label "conditional step for event endDate check"@en-US ;
dynapi:nextIfSatisfied creation_properties:step6 ;
dynapi:nextIfNotSatisfied creation_properties:conditional_for_step7 ;
dynapi:hasCondition event_condition:endDate_check .

creation_properties:step6
a dynapi:OperationalStep ;
rdfs:label "creation of an event step 6"@en-US ;
dynapi:hasOperation execute_template:n3_template_endDate ;
dynapi:hasNextStep creation_properties:conditional_for_step7 .

creation_properties:conditional_for_step7
a dynapi:ConditionalStep ;
rdfs:label "conditional step for event place check"@en-US ;
dynapi:nextIfSatisfied creation_properties:step7 ;
dynapi:nextIfNotSatisfied creation_properties:conditional_for_step8and9 ;
dynapi:hasCondition event_condition:place_check .

creation_properties:step7
a dynapi:OperationalStep ;
rdfs:label "creation of an event step 7"@en-US ;
dynapi:hasOperation execute_template:n3_template_place ;
dynapi:hasNextStep creation_properties:conditional_for_step8and9 .

creation_properties:conditional_for_step8and9
a dynapi:ConditionalStep ;
rdfs:label "conditional step for event venue check"@en-US ;
dynapi:nextIfSatisfied creation_properties:conditional_for_step8 ;
dynapi:hasCondition event_condition:eventVenue_check .

creation_properties:conditional_for_step8
a dynapi:ConditionalStep ;
rdfs:label "conditional step for event venue name check"@en-US ;
dynapi:nextIfSatisfied creation_properties:step8_unpack ;
dynapi:nextIfNotSatisfied creation_properties:create_eventVenue ;
dynapi:hasCondition event_condition:contains_event_name_key .

creation_properties:step8_unpack
a dynapi:OperationalStep ;
dynapi:hasNextStep creation_properties:create_eventVenue ;
dynapi:hasOperation unpacking_properties:get_event_venue_name .

creation_properties:create_eventVenue
a dynapi:OperationalStep ;
dynapi:hasOperation execute_template:event_venue_construct_query_fill_in .

###############################################
### N3 TEMPLATE PARTIAL ENTITY CREATION
###############################################

execute_template:n3_template_subject
a dynapi:N3Template ;
rdfs:label "create event N3 Template"@en-US ;
dynapi:hasModel dynapi_model:abox_assertions ;
dynapi:requiresParameter creation_parameter:uri ;
dynapi:N3TextAdditions
"""
?uri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/NET/c4dm/event.owl#Event> ;
""" .

execute_template:n3_template_type
a dynapi:N3Template ;
rdfs:label "create event type N3 Template"@en-US ;
dynapi:hasModel dynapi_model:abox_assertions ;
dynapi:requiresParameter creation_parameter:uri ;
dynapi:requiresParameter creation_parameter:type ;
dynapi:N3TextAdditions "?uri <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType> ?type . " .

execute_template:n3_template_name
a dynapi:N3Template ;
rdfs:label "create event name N3 Template"@en-US ;
dynapi:hasModel dynapi_model:abox_assertions ;
dynapi:requiresParameter creation_parameter:uri ;
dynapi:requiresParameter creation_parameter:name ;
dynapi:N3TextAdditions "?uri <http://www.w3.org/2006/vcard/ns#Name> ?name . " .

execute_template:n3_template_abbreviation
a dynapi:N3Template ;
rdfs:label "create event abbreviation N3 Template"@en-US ;
dynapi:hasModel dynapi_model:abox_assertions ;
dynapi:requiresParameter creation_parameter:uri ;
dynapi:requiresParameter creation_parameter:abbreviation ;
dynapi:N3TextAdditions "?uri <http://vivoweb.org/ontology/core#abbreviation> ?abbreviation . " .

execute_template:n3_template_startDate
a dynapi:N3Template ;
rdfs:label "create event startDate N3 Template"@en-US ;
dynapi:hasModel dynapi_model:abox_assertions ;
dynapi:requiresParameter creation_parameter:uri ;
dynapi:requiresParameter creation_parameter:startDate ;
dynapi:N3TextAdditions "?uri <http://vivoweb.org/ontology/core#start> ?startDate . " .

execute_template:n3_template_endDate
a dynapi:N3Template ;
rdfs:label "create event endDate N3 Template"@en-US ;
dynapi:hasModel dynapi_model:abox_assertions ;
dynapi:requiresParameter creation_parameter:uri ;
dynapi:requiresParameter creation_parameter:endDate ;
dynapi:N3TextAdditions "?uri <http://vivoweb.org/ontology/core#end> ?endDate . " .

execute_template:n3_template_place
a dynapi:N3Template ;
rdfs:label "create event place N3 Template"@en-US ;
dynapi:hasModel dynapi_model:abox_assertions ;
dynapi:requiresParameter creation_parameter:uri ;
dynapi:requiresParameter creation_parameter:place ;
dynapi:N3TextAdditions "?uri <http://www.w3.org/2006/vcard/ns#Address> ?place . " .

execute_template:event_venue_construct_query_fill_in
a dynapi:N3Template ;
dynapi:hasModel dynapi_model:abox_assertions ;
dynapi:requiresParameter creation_parameter:venueName ;
dynapi:requiresParameter creation_parameter:venueURI ;
dynapi:requiresParameter creation_parameter:uri ;
dynapi:N3TextAdditions
"""
@prefix dynapi: <https://vivoweb.org/ontology/vitro-dynamic-api#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

?venueURI <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2006/vcard/ns#Individual> ;
<http://www.w3.org/2006/vcard/ns#Name> ?venueName .

?uri <http://vivoweb.org/ontology/core#hasPublicationVenue> ?venueURI .
""" .
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
@prefix dynapi: <https://vivoweb.org/ontology/vitro-dynamic-api#> .
@prefix dynapi_java: <java:edu.cornell.mannlib.vitro.webapp.dynapi.components#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix event_fetching: <https://vivoweb.org/procedure/delete_event/get_event_from_dynamic_api_graph/> .
@prefix event_removal: <https://vivoweb.org/procedure/delete_event/remove_from_dynamic_api_model/> .
@prefix procedure_unloading: <https://vivoweb.org/procedure/delete_event/unload_procedure_from_procedure_pool/> .
@prefix whitelist_access: <https://vivoweb.org/procedure/event/access/> .
@prefix deletion_parameter: <https://vivoweb.org/procedure/event/parameter/> .
@prefix dynapi_model: <https://vivoweb.org/ontology/vitro-dynamic-api/model/> .

###############################################
### DELETE
###############################################

<https://vivoweb.org/procedure/delete_event>
a dynapi:Procedure ;
rdfs:label "Deleting a OU"@en-US ;
dynapi:accessWhitelist whitelist_access:admin ;
dynapi:hasFirstStep event_fetching:step .

event_fetching:step
a dynapi:OperationalStep ;
dynapi:hasNextStep event_removal:step ;
dynapi:hasOperation event_fetching:operation .

event_fetching:operation
a dynapi:SparqlConstructQuery ;
dynapi:sparqlQueryText """
prefix dynapi: <https://vivoweb.org/ontology/vitro-dynamic-api#>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
CONSTRUCT {
?resource_id
rdf:type <http://purl.org/NET/c4dm/event.owl#Event> ;
<http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType> ?type ;
<http://www.w3.org/2006/vcard/ns#Name> ?name ;
<http://vivoweb.org/ontology/core#abbreviation> ?abbreviation ;
<http://vivoweb.org/ontology/core#start> ?startDate ;
<http://vivoweb.org/ontology/core#end> ?endDate ;
<http://www.w3.org/2006/vcard/ns#Address> ?place ;
<http://vivoweb.org/ontology/core#hasPublicationVenue> ?eventVenueURI .

?eventVenueURI
rdf:type <http://www.w3.org/2006/vcard/ns#Individual> ;
<http://www.w3.org/2006/vcard/ns#Name> ?eventVenueName .

} WHERE {
?resource_id a <http://purl.org/NET/c4dm/event.owl#Event> .
OPTIONAL { ?uri <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType> ?typeOptional }
OPTIONAL { ?uri <http://www.w3.org/2006/vcard/ns#Name> ?nameOptional }
OPTIONAL { ?uri <http://vivoweb.org/ontology/core#abbreviation> ?abbreviationOptional }
OPTIONAL { ?uri <http://vivoweb.org/ontology/core#start> ?startDateOptional }
OPTIONAL { ?uri <http://vivoweb.org/ontology/core#end> ?endDateOptional }
OPTIONAL { ?uri <http://www.w3.org/2006/vcard/ns#Address> ?placeOptional }
OPTIONAL {
?resource_id <http://vivoweb.org/ontology/core#hasPublicationVenue> ?eventVenueURI .
OPTIONAL { ?eventVenueURI <http://www.w3.org/2006/vcard/ns#Name> ?eventVenueName }
}
}
""" ;
dynapi:providesParameter deletion_parameter:event_graph ;
dynapi:requiresParameter deletion_parameter:resource_id ;
dynapi:hasModel dynapi_model:full_union .

event_removal:step
a dynapi:OperationalStep ;
dynapi:hasNextStep procedure_unloading:step ;
dynapi:hasOperation event_removal:operation .

event_removal:operation
a dynapi:ModelWriter ;
dynapi:retractionModel deletion_parameter:event_graph ;
dynapi:targetModel dynapi_model:abox_assertions .

procedure_unloading:step
a dynapi:OperationalStep ;
dynapi:hasOperation procedure_unloading:operation .

procedure_unloading:operation
a dynapi:ProcedurePoolAtomicOperation ;
dynapi:poolOperationType "unload" ;
dynapi:requiresParameter deletion_parameter:resource_id .
Loading
Loading