diff --git a/productMods/WEB-INF/ontologies/app/loadedAtStartup/PropertyConfig.n3 b/productMods/WEB-INF/ontologies/app/loadedAtStartup/PropertyConfig.n3 index 0bafcf23..c7ea9e42 100644 --- a/productMods/WEB-INF/ontologies/app/loadedAtStartup/PropertyConfig.n3 +++ b/productMods/WEB-INF/ontologies/app/loadedAtStartup/PropertyConfig.n3 @@ -196,7 +196,7 @@ local:hasResearcherRoleConfig a :ObjectPropertyDisplayConfig ; vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ; vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddResearcherRoleToPersonGenerator"^^ ; :propertyGroup . -m + local:hasInvestigatorRoleContext a :ConfigContext ; :hasConfiguration local:hasInvestigatorRoleConfig ; :configContextFor ; @@ -226,7 +226,7 @@ local:hasPrincipalInvestigatorRoleConfig a :ObjectPropertyDisplayConfig ; local:hasCo-PrincipalInvestigatorRoleContext a :ConfigContext ; :hasConfiguration local:hasCo-PrincipalInvestigatorRoleConfig ; :configContextFor ; - :qualifiedBy . + :qualifiedBy . local:hasCo-PrincipalInvestigatorRoleConfig a :ObjectPropertyDisplayConfig ; :listViewConfigFile "listViewConfig-hasInvestigatorRole.xml"^^xsd:string ; @@ -278,7 +278,7 @@ local:educationalTrainingConfig a :ObjectPropertyDisplayConfig ; local:informationResourceInAuthorshipContext a :ConfigContext ; :hasConfiguration local:informationResourceInAuthorshipConfig ; :configContextFor ; - :qualifiedByDomain . + :qualifiedByDomain ; :qualifiedBy . local:informationResourceInAuthorshipConfig a :ObjectPropertyDisplayConfig ; diff --git a/productMods/config/listViewConfig-hasInvestigatorRole.xml b/productMods/config/listViewConfig-hasInvestigatorRole.xml index 3b9b1490..54131a60 100644 --- a/productMods/config/listViewConfig-hasInvestigatorRole.xml +++ b/productMods/config/listViewConfig-hasInvestigatorRole.xml @@ -1,222 +1,243 @@ - - - - - - - - PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - SELECT DISTINCT - ?role - ?activity ?activityName - ?activityLabel - ?awardedBy - ?adminedBy - ?awardedByLabel - ?adminedByLabel - ?dateTimeStartRole ?dateTimeEndRole - ?dateTimeStartGrant ?dateTimeEndGrant - ?hideThis - WHERE { - - ?subject ?property ?role - - OPTIONAL { ?role core:roleRealizedIn ?activity - LET (?activityName := afn:localname(?activity)) - OPTIONAL { ?activity rdfs:label ?activityLabel } - } - OPTIONAL { ?role core:roleContributesTo ?activity - LET (?activityName := afn:localname(?activity)) - OPTIONAL { ?activity rdfs:label ?activityLabel } - } - OPTIONAL { ?activity core:grantAwardedBy ?awardedBy . - ?awardedBy rdfs:label ?awardedByLabel - } - OPTIONAL { ?activity core:administeredBy ?adminedBy . - ?adminedBy rdfs:label ?adminedByLabel - } - OPTIONAL { ?role core:dateTimeInterval ?dateTimeIntervalRole - OPTIONAL { ?dateTimeIntervalRole core:start ?dateTimeStartValueRole . - ?dateTimeStartValueRole core:dateTime ?dateTimeStartRole - } - OPTIONAL { ?dateTimeIntervalRole core:end ?dateTimeEndValueRole . - ?dateTimeEndValueRole core:dateTime ?dateTimeEndRole - } - } - OPTIONAL { ?role core:roleContributesTo ?grant . - ?grant core:dateTimeInterval ?dateTimeIntervalGrant - OPTIONAL { ?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant . - ?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant - } - OPTIONAL { ?dateTimeIntervalGrant core:end ?dateTimeEndValueGrant . - ?dateTimeEndValueGrant core:dateTime ?dateTimeEndGrant - } - } - OPTIONAL { ?role core:hideFromDisplay ?hideThis } - # NOT EXISTS { ?role core:hideFromDisplay ?hideThis } - - FILTER ( bound(?activity) ) - - } ORDER BY DESC(?dateTimeEndRole) DESC(?dateTimeStartRole) DESC(?dateTimeEndGrant) DESC(?dateTimeStartGrant) ?activityLabel ?activityName - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - CONSTRUCT { - ?subject ?property ?role . - ?role core:roleRealizedIn ?activity . - ?activity rdfs:label ?activityLabel - } WHERE { - { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity - } UNION - { - ?subject ?property ?role . - ?role core:roleRealizedIn ?activity . - ?activity rdfs:label ?activityLabel - } - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - CONSTRUCT { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity rdfs:label ?activityLabel - } WHERE { - { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity - } UNION - { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity rdfs:label ?activityLabel - } - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - CONSTRUCT { - ?subject ?property ?role . - ?role ?roleProperty ?roleValue . - ?activity rdfs:label ?activityName . - ?activity core:grantAwardedBy ?awardedBy . - ?awardedBy rdfs:label ?awardedByLabel . - ?activity core:administeredBy ?adminedBy . - ?adminedBy rdfs:label ?adminedByLabel - } WHERE { - { - ?subject ?property ?role - } UNION { - ?subject ?property ?role . - ?role ?roleProperty ?roleValue - } UNION { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity rdfs:label ?activityName - } UNION { - ?subject ?property ?role . - ?role core:roleRealizedIn ?activity . - ?activity rdfs:label ?activityName - } UNION { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity core:grantAwardedBy ?awardedBy - } UNION { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity core:grantAwardedBy ?awardedBy . - ?awardedBy rdfs:label ?awardedByLabel - } UNION { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity core:administeredBy ?adminedBy - } UNION { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity core:administeredBy ?adminedBy . - ?adminedBy rdfs:label ?adminedByLabel - } - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?role . - ?role core:dateTimeInterval ?dateTimeIntervalRole . - ?dateTimeIntervalRole core:start ?dateTimeStartValueRole . - ?dateTimeStartValueRole core:dateTime ?dateTimeStartRole - } WHERE { - ?subject ?property ?role . - ?role core:dateTimeInterval ?dateTimeIntervalRole . - ?dateTimeIntervalRole core:start ?dateTimeStartValueRole . - ?dateTimeStartValueRole core:dateTime ?dateTimeStartRole - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?role . - ?role core:dateTimeInterval ?dateTimeIntervalRole . - ?dateTimeIntervalRole core:end ?dateTimeEndValueRole . - ?dateTimeEndValueRole core:dateTime ?dateTimeEndRole - } WHERE { - ?subject ?property ?role . - ?role core:dateTimeInterval ?dateTimeIntervalRole . - ?dateTimeIntervalRole core:end ?dateTimeEndValueRole . - ?dateTimeEndValueRole core:dateTime ?dateTimeEndRole - } - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?role . - ?role core:roleContributesTo ?grant . - ?grant core:dateTimeInterval ?dateTimeIntervalGrant . - ?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant . - ?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant - } WHERE { - ?subject ?property ?role . - ?role core:roleContributesTo ?grant . - ?grant core:dateTimeInterval ?dateTimeIntervalGrant . - ?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant . - ?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?role . - ?role core:roleContributesTo ?grant . - ?grant core:dateTimeInterval ?dateTimeIntervalGrant . - ?dateTimeIntervalGrant core:end ?dateTimeEndValueGrant . - ?dateTimeEndValueGrant core:dateTime ?dateTimeEndGrant - } WHERE { - ?subject ?property ?role . - ?role core:roleContributesTo ?grant . - ?grant core:dateTimeInterval ?dateTimeIntervalGrant . - ?dateTimeIntervalGrant core:end ?dateTimeEndValueGrant . - ?dateTimeEndValueGrant core:dateTime ?dateTimeEndGrant - } - - - - + + + + + + + + PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + SELECT DISTINCT + ?role + ?activity ?activityName + ?activityLabel + ?awardedBy + ?adminedBy + ?awardedByLabel + ?adminedByLabel + ?dateTimeStartRole ?dateTimeEndRole + ?dateTimeStartGrant ?dateTimeEndGrant + ?hideThis + WHERE { + + ?subject ?property ?role . + ?role a ?objectType . + ?role vitro:mostSpecificType ?subclass + + OPTIONAL { ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity + LET (?activityName := afn:localname(?activity)) + OPTIONAL { ?activity rdfs:label ?activityLabel } + } + OPTIONAL { ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity + LET (?activityName := afn:localname(?activity)) + OPTIONAL { ?activity rdfs:label ?activityLabel } + } + OPTIONAL { ?activity core:grantAwardedBy ?awardedBy . + ?awardedBy rdfs:label ?awardedByLabel + } + OPTIONAL { ?activity core:administeredBy ?adminedBy . + ?adminedBy rdfs:label ?adminedByLabel + } + OPTIONAL { ?role core:dateTimeInterval ?dateTimeIntervalRole + OPTIONAL { ?dateTimeIntervalRole core:start ?dateTimeStartValueRole . + ?dateTimeStartValueRole core:dateTime ?dateTimeStartRole + } + OPTIONAL { ?dateTimeIntervalRole core:end ?dateTimeEndValueRole . + ?dateTimeEndValueRole core:dateTime ?dateTimeEndRole + } + } + OPTIONAL { ?role <http://vivoweb.org/ontology/core#relatedBy> ?grant . + ?grant core:dateTimeInterval ?dateTimeIntervalGrant + OPTIONAL { ?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant . + ?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant + } + OPTIONAL { ?dateTimeIntervalGrant core:end ?dateTimeEndValueGrant . + ?dateTimeEndValueGrant core:dateTime ?dateTimeEndGrant + } + } + OPTIONAL { ?role core:hideFromDisplay ?hideThis } + FILTER ( bound(?activity) && ?subclass = ?objectType) + } ORDER BY DESC(?dateTimeEndRole) DESC(?dateTimeStartRole) DESC(?dateTimeEndGrant) DESC(?dateTimeStartGrant) ?activityLabel ?activityName + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + CONSTRUCT { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity . + ?activity rdfs:label ?activityLabel + } WHERE { + { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity + } UNION + { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://purl.obolibrary.org/obo/BFO_0000054>n ?activity . + ?activity rdfs:label ?activityLabel + } + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + CONSTRUCT { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity . + ?activity rdfs:label ?activityLabel + } WHERE { + { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity + } UNION + { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity . + ?activity rdfs:label ?activityLabel + } + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + CONSTRUCT { + ?subject ?property ?role . + ?role a ?objectType . + ?role ?roleProperty ?roleValue . + ?activity rdfs:label ?activityName . + ?activity core:grantAwardedBy ?awardedBy . + ?awardedBy rdfs:label ?awardedByLabel . + ?activity core:administeredBy ?adminedBy . + ?adminedBy rdfs:label ?adminedByLabel + } WHERE { + { + ?subject ?property ?role + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role ?roleProperty ?roleValue + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity . + ?activity rdfs:label ?activityName + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity . + ?activity rdfs:label ?activityName + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity . + ?activity core:grantAwardedBy ?awardedBy + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity . + ?activity core:grantAwardedBy ?awardedBy . + ?awardedBy rdfs:label ?awardedByLabel + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity . + ?activity core:administeredBy ?adminedBy + } UNION { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?activity . + ?activity core:administeredBy ?adminedBy . + ?adminedBy rdfs:label ?adminedByLabel + } + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?role . + ?role a ?objectType . + ?role core:dateTimeInterval ?dateTimeIntervalRole . + ?dateTimeIntervalRole core:start ?dateTimeStartValueRole . + ?dateTimeStartValueRole core:dateTime ?dateTimeStartRole + } WHERE { + ?subject ?property ?role . + ?role a ?objectType . + ?role core:dateTimeInterval ?dateTimeIntervalRole . + ?dateTimeIntervalRole core:start ?dateTimeStartValueRole . + ?dateTimeStartValueRole core:dateTime ?dateTimeStartRole + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?role . + ?role a ?objectType . + ?role core:dateTimeInterval ?dateTimeIntervalRole . + ?dateTimeIntervalRole core:end ?dateTimeEndValueRole . + ?dateTimeEndValueRole core:dateTime ?dateTimeEndRole + } WHERE { + ?subject ?property ?role . + ?role a ?objectType . + ?role core:dateTimeInterval ?dateTimeIntervalRole . + ?dateTimeIntervalRole core:end ?dateTimeEndValueRole . + ?dateTimeEndValueRole core:dateTime ?dateTimeEndRole + } + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?grant . + ?grant core:dateTimeInterval ?dateTimeIntervalGrant . + ?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant . + ?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant + } WHERE { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?grant . + ?grant core:dateTimeInterval ?dateTimeIntervalGrant . + ?dateTimeIntervalGrant core:start ?dateTimeStartValueGrant . + ?dateTimeStartValueGrant core:dateTime ?dateTimeStartGrant + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?grant . + ?grant core:dateTimeInterval ?dateTimeIntervalGrant . + ?dateTimeIntervalGrant core:end ?dateTimeEndValueGrant . + ?dateTimeEndValueGrant core:dateTime ?dateTimeEndGrant + } WHERE { + ?subject ?property ?role . + ?role a ?objectType . + ?role <http://vivoweb.org/ontology/core#relatedBy> ?grant . + ?grant core:dateTimeInterval ?dateTimeIntervalGrant . + ?dateTimeIntervalGrant core:end ?dateTimeEndValueGrant . + ?dateTimeEndValueGrant core:dateTime ?dateTimeEndGrant + } + + + + diff --git a/productMods/config/listViewConfig-hasPresenterRole.xml b/productMods/config/listViewConfig-hasPresenterRole.xml index facd5c18..a6c58288 100644 --- a/productMods/config/listViewConfig-hasPresenterRole.xml +++ b/productMods/config/listViewConfig-hasPresenterRole.xml @@ -1,333 +1,363 @@ - - - - - - - - - - - PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> - PREFIX bibo: <http://purl.org/ontology/bibo/> - PREFIX vivo: <http://vivoweb.org/ontology/core#> - PREFIX owl: <http://www.w3.org/2002/07/owl#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - SELECT DISTINCT ?subclass - ?role ?roleLabel - ?presentation ?presentationName ?presentationLabel - ?conference ?conferenceLabel - ?series ?seriesLabel - ?workshop - ?dateTime - - WHERE { - - ?subject ?property ?role - - OPTIONAL { ?role rdfs:label ?roleLabel } - - OPTIONAL { ?role vivo:roleRealizedIn ?presentation - LET (?presentationName := afn:localname(?presentation)) - - OPTIONAL { ?presentation rdfs:label ?presentationLabel } - - OPTIONAL { ?conference a bibo:Conference . - OPTIONAL { ?conference rdfs:label ?conferenceLabel } - - { - ?presentation vivo:eventWithin ?conference - } UNION { - ?conference vivo:includesEvent ?presentation - } - } - OPTIONAL { - { - ?presentation vivo:eventWithin ?workshop . - ?workshop vivo:eventWithin ?conference - } UNION { - ?workshop vivo:includesEvent ?presentation . - ?conference vivo:includesEvent ?workshop - } - OPTIONAL { ?conference rdfs:label ?conferenceLabel } - } - - - OPTIONAL { ?series a vivo:EventSeries . - OPTIONAL { ?series rdfs:label ?seriesLabel } - - { - ?presentation vivo:inEventWithin ?series - } UNION { - ?series vivo:seriesForEvent ?presentation - } - } - OPTIONAL { - { - ?presentation vivo:eventWithin ?workshop . - ?workshop vivo:inEventSeries ?series - } UNION { - ?workshop vivo:includesEvent ?presentation . - ?series vivo:seriesForEvent ?workshop - } - OPTIONAL { ?series rdfs:label ?seriesLabel } - } - - - ?presentation vitro:mostSpecificType ?subclass . - - { - ?subclass rdfs:subClassOf vivo:Presentation - } UNION { - ?subclass owl:equivalentClass vivo:Presentation - } - - - } - - OPTIONAL { ?role vivo:dateTimeInterval ?dateTimeInterval - OPTIONAL { ?dateTimeInterval vivo:start ?dateTimeStartValue . - ?dateTimeStartValue vivo:dateTime ?dateTime - } - } - - - FILTER ( bound(?presentation) ) - - - } ORDER BY ?subclass DESC(?dateTime) ?presentationLabel ?presentationName - - - - PREFIX vivo: <http://vivoweb.org/ontology/core#> - PREFIX owl: <http://www.w3.org/2002/07/owl#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - CONSTRUCT { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?presentation vitro:mostSpecificType ?subclass . - ?subclass rdfs:subClassOf vivo:Presentation . - ?subclass owl:equivalentClass vivo:Presentation . - } WHERE { - { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?presentation vitro:mostSpecificType ?subclass . - ?subclass rdfs:subClassOf vivo:Presentation - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?presentation vitro:mostSpecificType ?subclass . - ?subclass owl:equivalentClass vivo:Presentation - } - } - - - - PREFIX vivo: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - CONSTRUCT { - ?subject ?property ?role . - ?role ?roleProperty ?roleValue . - ?presentation rdfs:label ?presentationLabel - } WHERE { - { - ?subject ?property ?role - } UNION { - ?subject ?property ?role . - ?role ?roleProperty ?roleValue - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?presentation rdfs:label ?presentationLabel - } - } - - - - PREFIX bibo: <http://purl.org/ontology/bibo/> - PREFIX vivo: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - - CONSTRUCT { - ?subject ?property ?role . - ?conference a bibo:Conference . - ?presentation vivo:eventWithin ?conference . - ?conference vivo:includesEvent ?presentation . - ?conference rdfs:label ?conferenceLabel - } WHERE { - - { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?conference a bibo:Conference . - ?presentation vivo:eventWithin ?conference - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?conference a bibo:Conference . - ?presentation vivo:eventWithin ?conference . - ?conference rdfs:label ?conferenceLabel - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?conference a bibo:Conference . - ?conference vivo:includesEvent ?presentation - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?conference a bibo:Conference . - ?conference vivo:includesEvent ?presentation . - ?conference rdfs:label ?conferenceLabel - } - } - - - - PREFIX bibo: <http://purl.org/ontology/bibo/> - PREFIX vivo: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - - CONSTRUCT { - ?subject ?property ?role . - ?workshop vivo:eventWithin ?conference . - ?conference vivo:includesEvent ?workshop . - ?conference a bibo:Conference . - ?presentation vivo:eventWithin ?workshop . - ?workshop vivo:includesEvent ?presentation . - ?conference rdfs:label ?conferenceLabel - } WHERE { - { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?conference a bibo:Conference . - ?presentation vivo:eventWithin ?workshop . - ?workshop vivo:eventWithin ?conference - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?conference a bibo:Conference . - ?presentation vivo:eventWithin ?workshop . - ?workshop vivo:eventWithin ?conference . - ?conference rdfs:label ?conferenceLabel - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?conference a bibo:Conference . - ?conference vivo:includesEvent ?workshop . - ?workshop vivo:includesEvent ?presentation - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?conference a bibo:Conference . - ?conference vivo:includesEvent ?workshop . - ?workshop vivo:includesEvent ?presentation . - ?conference rdfs:label ?conferenceLabel - } - } - - - - PREFIX bibo: <http://purl.org/ontology/bibo/> - PREFIX vivo: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - - CONSTRUCT { - ?subject ?property ?role . - ?series a vivo:EventSeries . - ?presentation vivo:inEventSeries ?series . - ?series vivo:seriesForEvent ?presentation . - ?series rdfs:label ?seriesLabel - } WHERE { - - { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?series a vivo:EventSeries . - ?presentation vivo:inEventSeries ?series - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?series a vivo:EventSeries . - ?presentation vivo:inEventSeries ?series . - ?series rdfs:label ?seriesLabel - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?series a vivo:EventSeries . - ?series vivo:seriesForEvent ?presentation - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?series a vivo:EventSeries . - ?series vivo:seriesForEvent ?presentation . - ?series rdfs:label ?seriesLabel - } - } - - - - PREFIX bibo: <http://purl.org/ontology/bibo/> - PREFIX vivo: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - - CONSTRUCT { - ?subject ?property ?role . - ?workshop vivo:inEventSeries ?series . - ?series vivo:seriesForEvent ?workshop . - ?series a vivo:EventSeries . - ?presentation vivo:eventWithin ?workshop . - ?workshop vivo:includesEvent ?presentation . - ?series rdfs:label ?seriesLabel - } WHERE { - { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?series a vivo:EventSeries . - ?presentation vivo:eventWithin ?workshop . - ?workshop vivo:inEventSeries ?series - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?series a vivo:EventSeries . - ?presentation vivo:eventWithin ?workshop . - ?workshop vivo:inEventSeries ?series . - ?series rdfs:label ?seriesLabel - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?series a vivo:EventSeries . - ?series vivo:seriesForEvent ?workshop . - ?workshop vivo:includesEvent ?presentation - } UNION { - ?subject ?property ?role . - ?role vivo:roleRealizedIn ?presentation . - ?series a vivo:EventSeries . - ?series vivo:seriesForEvent ?workshop . - ?workshop vivo:includesEvent ?presentation . - ?series rdfs:label ?seriesLabel - } - } - - - - PREFIX vivo: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?role . - ?role vivo:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval vivo:start ?dateTimeStartValue . - ?dateTimeStartValue vivo:dateTime ?dateTimeStart - } WHERE { - ?subject ?property ?role . - ?role vivo:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval vivo:start ?dateTimeStartValue . - ?dateTimeStartValue vivo:dateTime ?dateTimeStart - } - - - - + + + + + + + + + + + PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> + PREFIX bibo: <http://purl.org/ontology/bibo/> + PREFIX vivo: <http://vivoweb.org/ontology/core#> + PREFIX owl: <http://www.w3.org/2002/07/owl#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + SELECT DISTINCT ?subclass + ?role ?roleLabel + ?presentation ?presentationName ?presentationLabel + ?conference ?conferenceLabel + ?series ?seriesLabel + ?workshop + ?dateTime + + WHERE { + + ?subject ?property ?role . + ?role a vivo:PresenterRole + + OPTIONAL { ?role rdfs:label ?roleLabel } + + OPTIONAL { ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation + LET (?presentationName := afn:localname(?presentation)) + + OPTIONAL { ?presentation rdfs:label ?presentationLabel } + + OPTIONAL { ?conference a bibo:Conference . + OPTIONAL { ?conference rdfs:label ?conferenceLabel } + + { + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?conference + } UNION { + ?conference <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation + } + } + OPTIONAL { + { + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000050> ?conference + } UNION { + ?workshop <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation . + ?conference <http://purl.obolibrary.org/obo/BFO_0000051> ?workshop + } + OPTIONAL { ?conference rdfs:label ?conferenceLabel } + } + + + OPTIONAL { ?series a vivo:EventSeries . + OPTIONAL { ?series rdfs:label ?seriesLabel } + + { + ?presentation vivo:inEventWithin ?series + } UNION { + ?series vivo:seriesForEvent ?presentation + } + } + OPTIONAL { + { + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?workshop . + ?workshop vivo:inEventSeries ?series + } UNION { + ?workshop <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation . + ?series vivo:seriesForEvent ?workshop + } + OPTIONAL { ?series rdfs:label ?seriesLabel } + } + + + ?presentation vitro:mostSpecificType ?subclass . + + { + ?subclass rdfs:subClassOf vivo:Presentation + } UNION { + ?subclass owl:equivalentClass vivo:Presentation + } + + + } + + OPTIONAL { ?role vivo:dateTimeInterval ?dateTimeInterval + OPTIONAL { ?dateTimeInterval vivo:start ?dateTimeStartValue . + ?dateTimeStartValue vivo:dateTime ?dateTime + } + } + + + FILTER ( bound(?presentation) ) + + + } ORDER BY ?subclass DESC(?dateTime) ?presentationLabel ?presentationName + + + + PREFIX vivo: <http://vivoweb.org/ontology/core#> + PREFIX owl: <http://www.w3.org/2002/07/owl#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + CONSTRUCT { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?presentation vitro:mostSpecificType ?subclass . + ?subclass rdfs:subClassOf vivo:Presentation . + ?subclass owl:equivalentClass vivo:Presentation . + } WHERE { + { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?presentation vitro:mostSpecificType ?subclass . + ?subclass rdfs:subClassOf vivo:Presentation + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?presentation vitro:mostSpecificType ?subclass . + ?subclass owl:equivalentClass vivo:Presentation + } + } + + + + PREFIX vivo: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + CONSTRUCT { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role ?roleProperty ?roleValue . + ?presentation rdfs:label ?presentationLabel + } WHERE { + { + ?subject ?property ?role . + ?role a vivo:PresenterRole + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role ?roleProperty ?roleValue + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?presentation rdfs:label ?presentationLabel + } + } + + + + PREFIX bibo: <http://purl.org/ontology/bibo/> + PREFIX vivo: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + + CONSTRUCT { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?conference a bibo:Conference . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?conference . + ?conference <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation . + ?conference rdfs:label ?conferenceLabel + } WHERE { + + { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?conference a bibo:Conference . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?conference + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?conference a bibo:Conference . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?conference . + ?conference rdfs:label ?conferenceLabel + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?conference a bibo:Conference . + ?conference <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?conference a bibo:Conference . + ?conference <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation . + ?conference rdfs:label ?conferenceLabel + } + } + + + + PREFIX bibo: <http://purl.org/ontology/bibo/> + PREFIX vivo: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + + CONSTRUCT { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000050> ?conference . + ?conference <http://purl.obolibrary.org/obo/BFO_0000051> ?workshop . + ?conference a bibo:Conference . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation . + ?conference rdfs:label ?conferenceLabel + } WHERE { + { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?conference a bibo:Conference . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000050> ?conference + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?conference a bibo:Conference . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000050> ?conference . + ?conference rdfs:label ?conferenceLabel + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?conference a bibo:Conference . + ?conference <http://purl.obolibrary.org/obo/BFO_0000051> ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?conference a bibo:Conference . + ?conference <http://purl.obolibrary.org/obo/BFO_0000051> ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation . + ?conference rdfs:label ?conferenceLabel + } + } + + + + PREFIX bibo: <http://purl.org/ontology/bibo/> + PREFIX vivo: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + + CONSTRUCT { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?series a vivo:EventSeries . + ?presentation vivo:inEventSeries ?series . + ?series vivo:seriesForEvent ?presentation . + ?series rdfs:label ?seriesLabel + } WHERE { + + { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?series a vivo:EventSeries . + ?presentation vivo:inEventSeries ?series + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?series a vivo:EventSeries . + ?presentation vivo:inEventSeries ?series . + ?series rdfs:label ?seriesLabel + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?series a vivo:EventSeries . + ?series vivo:seriesForEvent ?presentation + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?series a vivo:EventSeries . + ?series vivo:seriesForEvent ?presentation . + ?series rdfs:label ?seriesLabel + } + } + + + + PREFIX bibo: <http://purl.org/ontology/bibo/> + PREFIX vivo: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + + CONSTRUCT { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?workshop vivo:inEventSeries ?series . + ?series vivo:seriesForEvent ?workshop . + ?series a vivo:EventSeries . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation . + ?series rdfs:label ?seriesLabel + } WHERE { + { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?series a vivo:EventSeries . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?workshop . + ?workshop vivo:inEventSeries ?series + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?series a vivo:EventSeries . + ?presentation <http://purl.obolibrary.org/obo/BFO_0000050> ?workshop . + ?workshop vivo:inEventSeries ?series . + ?series rdfs:label ?seriesLabel + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?series a vivo:EventSeries . + ?series vivo:seriesForEvent ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation + } UNION { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?presentation . + ?series a vivo:EventSeries . + ?series vivo:seriesForEvent ?workshop . + ?workshop <http://purl.obolibrary.org/obo/BFO_0000051> ?presentation . + ?series rdfs:label ?seriesLabel + } + } + + + + PREFIX vivo: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role vivo:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval vivo:start ?dateTimeStartValue . + ?dateTimeStartValue vivo:dateTime ?dateTimeStart + } WHERE { + ?subject ?property ?role . + ?role a vivo:PresenterRole . + ?role vivo:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval vivo:start ?dateTimeStartValue . + ?dateTimeStartValue vivo:dateTime ?dateTimeStart + } + + + + diff --git a/productMods/config/listViewConfig-hasRole.xml b/productMods/config/listViewConfig-hasRole.xml index a54c13b2..0d66740f 100644 --- a/productMods/config/listViewConfig-hasRole.xml +++ b/productMods/config/listViewConfig-hasRole.xml @@ -1,149 +1,150 @@ - - - - - - - - PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - SELECT DISTINCT ?subclass - # send the property to the template, since this view supports multiple role properties - ?property - ?role - ?roleLabel - ?activity ?activityName - ?activityLabel - ?dateTimeStart ?dateTimeEnd - ?hideThis - WHERE { - ?subject ?property ?role . - ?role a ?objectType - - OPTIONAL { ?role core:roleRealizedIn ?activity - LET (?activityName := afn:localname(?activity)) - OPTIONAL { ?activity rdfs:label ?activityLabel } - - - ?activity vitro:mostSpecificType ?subclass - - } - - OPTIONAL { ?role core:roleContributesTo ?activity - LET (?activityName := afn:localname(?activity)) - OPTIONAL { ?activity rdfs:label ?activityLabel } - - - ?activity vitro:mostSpecificType ?subclass - - } - - OPTIONAL { ?role rdfs:label ?roleLabel } - OPTIONAL { ?role core:hideFromDisplay ?hideThis } - OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval - OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart - } - OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue . - ?dateTimeEndValue core:dateTime ?dateTimeEnd - } - } - # NOT EXISTS { ?role core:hideFromDisplay ?hideThis } - - FILTER ( bound(?activity) ) - - } ORDER BY ?subclass DESC(?dateTimeEnd) DESC(?dateTimeStart) ?activityLabel ?activityName - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - CONSTRUCT { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity vitro:mostSpecificType ?subclass . - } WHERE { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity vitro:mostSpecificType ?subclass - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - CONSTRUCT { - ?subject ?property ?role . - ?role core:roleRealizedIn ?activity . - ?activity vitro:mostSpecificType ?subclass . - } WHERE { - ?subject ?property ?role . - ?role core:roleRealizedIn ?activity . - ?activity vitro:mostSpecificType ?subclass - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - CONSTRUCT { - ?subject ?property ?role . - ?role ?roleProperty ?roleValue . - ?activity rdfs:label ?activityName - } WHERE { - { - ?subject ?property ?role - } UNION { - ?subject ?property ?role . - ?role ?roleProperty ?roleValue - } UNION { - ?subject ?property ?role . - ?role core:roleContributesTo ?activity . - ?activity rdfs:label ?activityName - } UNION { - ?subject ?property ?role . - ?role core:roleRealizedIn ?activity . - ?activity rdfs:label ?activityName - } - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?role . - ?role core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart - } WHERE { - ?subject ?property ?role . - ?role core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:start ?dateTimeStartValue . - ?dateTimeStartValue core:dateTime ?dateTimeStart - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - CONSTRUCT { - ?subject ?property ?role . - ?role core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:end ?dateTimeEndValue . - ?dateTimeEndValue core:dateTime ?dateTimeEnd - } WHERE { - ?subject ?property ?role . - ?role core:dateTimeInterval ?dateTimeInterval . - ?dateTimeInterval core:end ?dateTimeEndValue . - ?dateTimeEndValue core:dateTime ?dateTimeEnd - } - - - - + + + + + + + + PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + SELECT DISTINCT ?subclass + # send the property to the template, since this view supports multiple role properties + ?property + ?role + ?roleLabel + ?activity ?activityName + ?activityLabel + ?dateTimeStart ?dateTimeEnd + ?hideThis + ?objectType + WHERE { + ?subject ?property ?role . + ?role a ?objectType + + OPTIONAL { ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity + LET (?activityName := afn:localname(?activity)) + OPTIONAL { ?activity rdfs:label ?activityLabel } + + + ?activity vitro:mostSpecificType ?subclass + + } + + OPTIONAL { ?role core:relatedBy ?activity + LET (?activityName := afn:localname(?activity)) + OPTIONAL { ?activity rdfs:label ?activityLabel } + + + ?activity vitro:mostSpecificType ?subclass + + } + + OPTIONAL { ?role rdfs:label ?roleLabel } + OPTIONAL { ?role core:hideFromDisplay ?hideThis } + OPTIONAL { ?role core:dateTimeInterval ?dateTimeInterval + OPTIONAL { ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart + } + OPTIONAL { ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd + } + } + # NOT EXISTS { ?role core:hideFromDisplay ?hideThis } + + FILTER ( bound(?activity) ) + + } ORDER BY ?subclass DESC(?dateTimeEnd) DESC(?dateTimeStart) ?activityLabel ?activityName + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + CONSTRUCT { + ?subject ?property ?role . + ?role core:relatedBy ?activity . + ?activity vitro:mostSpecificType ?subclass . + } WHERE { + ?subject ?property ?role . + ?role core:relatedBy ?activity . + ?activity vitro:mostSpecificType ?subclass + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + CONSTRUCT { + ?subject ?property ?role . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity . + ?activity vitro:mostSpecificType ?subclass . + } WHERE { + ?subject ?property ?role . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity . + ?activity vitro:mostSpecificType ?subclass + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + CONSTRUCT { + ?subject ?property ?role . + ?role ?roleProperty ?roleValue . + ?activity rdfs:label ?activityName + } WHERE { + { + ?subject ?property ?role + } UNION { + ?subject ?property ?role . + ?role ?roleProperty ?roleValue + } UNION { + ?subject ?property ?role . + ?role core:relatedBy ?activity . + ?activity rdfs:label ?activityName + } UNION { + ?subject ?property ?role . + ?role <http://purl.obolibrary.org/obo/BFO_0000054> ?activity . + ?activity rdfs:label ?activityName + } + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?role . + ?role core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart + } WHERE { + ?subject ?property ?role . + ?role core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:start ?dateTimeStartValue . + ?dateTimeStartValue core:dateTime ?dateTimeStart + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + CONSTRUCT { + ?subject ?property ?role . + ?role core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd + } WHERE { + ?subject ?property ?role . + ?role core:dateTimeInterval ?dateTimeInterval . + ?dateTimeInterval core:end ?dateTimeEndValue . + ?dateTimeEndValue core:dateTime ?dateTimeEnd + } + + + + diff --git a/productMods/config/listViewConfig-informationResourceInAuthorship.xml b/productMods/config/listViewConfig-informationResourceInAuthorship.xml index 63c3f474..ff635393 100644 --- a/productMods/config/listViewConfig-informationResourceInAuthorship.xml +++ b/productMods/config/listViewConfig-informationResourceInAuthorship.xml @@ -1,72 +1,73 @@ - - - - - - - - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> - PREFIX foaf: <http://xmlns.com/foaf/0.1/> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - - SELECT DISTINCT ?subclass - ?authorship - ?person ?personName WHERE { - ?subject ?property ?authorship - OPTIONAL { ?authorship core:authorRank ?rank } - OPTIONAL { ?authorship core:linkedAuthor ?person . - ?person rdfs:label ?personName - - OPTIONAL { ?person vitro:mostSpecificType ?subclass . - ?subclass rdfs:subClassOf foaf:Person - } - - } - - FILTER ( bound(?person) ) - - } ORDER BY ?subclass ?rank ?personName - - - - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX foaf: <http://xmlns.com/foaf/0.1/> - CONSTRUCT { - ?subclass rdfs:subClassOf foaf:Person - } WHERE { - ?subclass rdfs:subClassOf foaf:Person - } - - - - PREFIX core: <http://vivoweb.org/ontology/core#> - PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> - PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> - CONSTRUCT { - ?subject ?property ?authorship . - ?authorship ?authorshipProperty ?authorshipValue . - ?person rdfs:label ?personName . - ?person vitro:mostSpecificType ?subclass - } WHERE { - { - ?subject ?property ?authorship - } UNION { - ?subject ?property ?authorship . - ?authorship ?authorshipProperty ?authorshipValue - } UNION { - ?subject ?property ?authorship . - ?authorship core:linkedAuthor ?person . - ?person rdfs:label ?personName - } UNION { - ?subject ?property ?authorship . - ?authorship core:linkedAuthor ?person . - ?person rdfs:label ?personName . - ?person vitro:mostSpecificType ?subclass - } - } - - - - + + + + + + + + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + + SELECT DISTINCT ?subclass + ?authorship + ?person ?personName WHERE { + ?subject ?property ?authorship . + ?subject a core:Authorship + OPTIONAL { ?authorship core:authorRank ?rank } + OPTIONAL { ?authorship core:relates ?person . + ?person rdfs:label ?personName + + OPTIONAL { ?person vitro:mostSpecificType ?subclass . + ?subclass rdfs:subClassOf foaf:Person + } + + } + + FILTER ( bound(?person) ) + + } ORDER BY ?subclass ?rank ?personName + + + + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX foaf: <http://xmlns.com/foaf/0.1/> + CONSTRUCT { + ?subclass rdfs:subClassOf foaf:Person + } WHERE { + ?subclass rdfs:subClassOf foaf:Person + } + + + + PREFIX core: <http://vivoweb.org/ontology/core#> + PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> + PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> + CONSTRUCT { + ?subject ?property ?authorship . + ?authorship ?authorshipProperty ?authorshipValue . + ?person rdfs:label ?personName . + ?person vitro:mostSpecificType ?subclass + } WHERE { + { + ?subject ?property ?authorship + } UNION { + ?subject ?property ?authorship . + ?authorship ?authorshipProperty ?authorshipValue + } UNION { + ?subject ?property ?authorship . + ?authorship core:relates ?person . + ?person rdfs:label ?personName + } UNION { + ?subject ?property ?authorship . + ?authorship core:relates ?person . + ?person rdfs:label ?personName . + ?person vitro:mostSpecificType ?subclass + } + } + + + + diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-awardOrHonor.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-awardOrHonor.ftl index 2818d208..49ce2f9e 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-awardOrHonor.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-awardOrHonor.ftl @@ -15,9 +15,9 @@ <#local linkedIndividual> <#if statement.award??> - ${statement.awardLabel!statement.localName} + ${statement.awardLabel!statement.localName!} <#else> - ${statement.receiptLabel!statement.localName} + ${statement.receiptLabel!statement.localName!} diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-hasInvestigatorRole.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-hasInvestigatorRole.ftl index 8898a608..2f4ca74c 100644 --- a/productMods/templates/freemarker/body/partials/individual/propStatement-hasInvestigatorRole.ftl +++ b/productMods/templates/freemarker/body/partials/individual/propStatement-hasInvestigatorRole.ftl @@ -47,6 +47,6 @@ - ${linkedIndividual} ${awardOrAdminBy} ${dateTime!} ${statement.subclass!} + ${linkedIndividual} ${awardOrAdminBy} ${dateTime!} \ No newline at end of file diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java index 5d5d8a68..0d0b191f 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java @@ -101,8 +101,8 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator private String getN3NewAuthorship() { return getN3PrefixString() + "?authorshipUri a core:Authorship ;\n" + - " core:linkedInformationResource ?infoResource .\n" + - "?infoResource core:informationResourceInAuthorship ?authorshipUri ."; + " core:relates ?infoResource .\n" + + "?infoResource core:relatedBy ?authorshipUri ."; } private String getN3AuthorshipRank() { diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddGrantRoleToPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddGrantRoleToPersonGenerator.java index 4c0c0412..157c4ff5 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddGrantRoleToPersonGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddGrantRoleToPersonGenerator.java @@ -1,753 +1,753 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpSession; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.vivoweb.webapp.util.ModelUtils; - -import com.hp.hpl.jena.ontology.OntModel; -import com.hp.hpl.jena.rdf.model.Literal; -import com.hp.hpl.jena.rdf.model.Model; -import com.hp.hpl.jena.vocabulary.RDF; -import com.hp.hpl.jena.vocabulary.RDFS; -import com.hp.hpl.jena.vocabulary.XSD; - -import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess; -import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.AutocompleteRequiredInputValidator; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeIntervalValidationVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation; -import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode; -import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils; - -/** - * Custom form for adding a grant to an person for the predicates hasCo-PrincipalInvestigatorRole - and hasPrincipalInvestigatorRole. - -This is intended to create a set of statements like: - -?person core:hasPrincipalInvestigatorRole ?newRole. -?newRole rdf:type core:PrincipalInvestigatorRole ; - core:relatedRole ?someGrant . - - * - */ -public class AddGrantRoleToPersonGenerator implements EditConfigurationGenerator { - - private Log log = LogFactory.getLog(AddGrantRoleToPersonGenerator.class); - private String subjectUri = null; - private String predicateUri = null; - private String objectUri = null; - private String template = "addGrantRoleToPerson.ftl"; - - //Types of options to populate drop-down for types for the "right side" of the role - public static enum RoleActivityOptionTypes { - VCLASSGROUP, - CHILD_VCLASSES, - HARDCODED_LITERALS - }; - - @Override - public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) { - EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo(); - - //process subject, predicate, object parameters - this.initProcessParameters(vreq, session, editConfiguration); - - //Assumes this is a simple case of subject predicate var - editConfiguration.setN3Required(this.generateN3Required(vreq)); - - //n3 optional - editConfiguration.setN3Optional(this.generateN3Optional(vreq)); - - //Todo: what do new resources depend on here? - //In original form, these variables start off empty - editConfiguration.setNewResources(generateNewResources(vreq)); - //In scope - this.setUrisAndLiteralsInScope(editConfiguration, vreq); - - //on Form - this.setUrisAndLiteralsOnForm(editConfiguration, vreq); - - editConfiguration.setFilesOnForm(new ArrayList()); - - //Sparql queries - this.setSparqlQueries(editConfiguration, vreq); - - //set fields - setFields(editConfiguration, vreq, EditConfigurationUtils.getPredicateUri(vreq)); - - // No need to put in session here b/c put in session within edit request dispatch controller instead - //placing in session depends on having edit key which is handled in edit request dispatch controller - // editConfiguration.putConfigInSession(editConfiguration, session); - - prepareForUpdate(vreq, session, editConfiguration); - - //Form title and submit label now moved to edit configuration template - //TODO: check if edit configuration template correct place to set those or whether - //additional methods here should be used and reference instead, e.g. edit configuration template could call - //default obj property form.populateTemplate or some such method - //Select from existing also set within template itself - setTemplate(editConfiguration, vreq); - //Set edit key - setEditKey(editConfiguration, vreq); - - //Add validators - editConfiguration.addValidator(new DateTimeIntervalValidationVTwo("startField","endField") ); - editConfiguration.addValidator(new AntiXssValidation()); - editConfiguration.addValidator(new AutocompleteRequiredInputValidator("existingGrant","grantLabel")); - //no preprocessors required here - //Adding additional data, specifically edit mode - addFormSpecificData(editConfiguration, vreq); - return editConfiguration; - } - - - - private void setEditKey(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - String editKey = EditConfigurationUtils.getEditKey(vreq); - editConfiguration.setEditKey(editKey); - } - - protected void setTemplate(EditConfigurationVTwo editConfiguration, - VitroRequest vreq) { - editConfiguration.setTemplate(template); - - } - - //Initialize setup: process parameters - //There will be specialized parameters as well, we may include them here or in a - //separate method - private void initProcessParameters(VitroRequest vreq, HttpSession session, EditConfigurationVTwo editConfiguration) { - String formUrl = EditConfigurationUtils.getFormUrlWithoutContext(vreq); - - subjectUri = EditConfigurationUtils.getSubjectUri(vreq); - predicateUri = EditConfigurationUtils.getPredicateUri(vreq); - - editConfiguration.setFormUrl(formUrl); - - editConfiguration.setUrlPatternToReturnTo("/individual"); - - editConfiguration.setVarNameForSubject("person"); - editConfiguration.setSubjectUri(subjectUri); - editConfiguration.setEntityToReturnTo(subjectUri); - editConfiguration.setVarNameForPredicate("rolePredicate"); - editConfiguration.setPredicateUri(predicateUri); - //by definition, this is an object property - objectUri = EditConfigurationUtils.getObjectUri(vreq); - - this.processObjectPropForm(vreq, editConfiguration); - } - - private void processObjectPropForm(VitroRequest vreq, EditConfigurationVTwo editConfiguration) { - editConfiguration.setVarNameForObject("role"); - editConfiguration.setObject(objectUri); - //this needs to be set for the editing to be triggered properly, otherwise the 'prepare' method - //pretends this is a data property editing statement and throws an error - //TODO: Check if null in case no object uri exists but this is still an object property - } - - - /* - * N3 Required and Optional Generators as well as supporting methods - */ - - private String getPrefixesString() { - //TODO: Include dynamic way of including this - return "@prefix core: ."; - } - - //TODO: Check if single string or multiple strings - check rdfslabel form etc. for prefix - //processing - private List generateN3Required(VitroRequest vreq) { - List n3ForEdit = new ArrayList(); - String editString = getN3ForGrantRole(vreq); - n3ForEdit.add(editString); - return n3ForEdit; - } - - - private List generateN3Optional(VitroRequest vreq) { - List n3Optional = new ArrayList(); - //n3 for new grant - n3Optional.add(getN3ForNewGrant(vreq)); - //n3 for existing grant - n3Optional.add(getN3ForExistingGrant(vreq)); - //n3 for inverse - n3Optional.add("?role ?inverseRolePredicate ?person ."); - //N3ForStart - n3Optional.addAll(getN3ForStart()); - //N3 For End - n3Optional.addAll(getN3ForEnd()); - return n3Optional; - } - - public String getN3ForGrantRole(VitroRequest vreq) { - String editString = getPrefixesString(); - editString += "?person ?rolePredicate ?role ."; - editString += "?role a <" + getRoleType(vreq) + "> ."; - return editString; - } - - public String getN3ForNewGrant(VitroRequest vreq) { - String editString = getPrefixesString(); - editString += "?role <" + getRoleToGrantPredicate(vreq) + "> ?grant ."; - editString += "?grant a core:Grant . "; - editString += "?grant <" + getGrantToRolePredicate(vreq) + "> ?role ."; - editString += "?grant <" + RDFS.label.getURI() + "> ?grantLabel ."; - return editString; - } - - public String getN3ForExistingGrant(VitroRequest vreq) { - String editString = getPrefixesString(); - editString += "?role <" + getRoleToGrantPredicate(vreq) + "> ?existingGrant . "; - editString += "?existingGrant <" + getGrantToRolePredicate(vreq) + "> ?role ."; - return editString; - } - - //Method b/c used in two locations, n3 optional and n3 assertions - private List getN3ForStart() { - List n3ForStart = new ArrayList(); - n3ForStart.add("?role <" + getRoleToIntervalURI() + "> ?intervalNode ." + - "?intervalNode <" + RDF.type.getURI() + "> <" + getIntervalTypeURI() + "> ." + - "?intervalNode <" + getIntervalToStartURI() + "> ?startNode ." + - "?startNode <" + RDF.type.getURI() + "> <" + getDateTimeValueTypeURI() + "> ." + - "?startNode <" + getDateTimeValueURI() + "> ?startField-value ." + - "?startNode <" + getDateTimePrecisionURI() + "> ?startField-precision ."); - return n3ForStart; - } - - private List getN3ForEnd() { - List n3ForEnd = new ArrayList(); - n3ForEnd.add("?role <" + getRoleToIntervalURI() + "> ?intervalNode . " + - "?intervalNode <" + RDF.type.getURI() + "> <" + getIntervalTypeURI() + "> ." + - "?intervalNode <" + getIntervalToEndURI() + "> ?endNode ." + - "?endNode <" + RDF.type.getURI() + "> <" + getDateTimeValueTypeURI() + "> ." + - "?endNode <" + getDateTimeValueURI() + "> ?endField-value ." + - "?endNode <" + getDateTimePrecisionURI() + "> ?endField-precision ."); - return n3ForEnd; - - } - - - /* - * Get new resources - */ - private Map generateNewResources(VitroRequest vreq) { - HashMap newResources = new HashMap(); - //TODO: Get default namespace - String defaultNamespace = vreq.getWebappDaoFactory().getDefaultNamespace(); - newResources.put("role", defaultNamespace + "individual"); - newResources.put("grant", defaultNamespace + "individual"); - newResources.put("intervalNode", defaultNamespace + "individual"); - newResources.put("startNode", defaultNamespace + "individual"); - newResources.put("endNode", defaultNamespace + "individual"); - return newResources; - } - - /* - * Set URIS and Literals In Scope and on form and supporting methods - */ - - private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - HashMap> urisInScope = new HashMap>(); - //note that at this point the subject, predicate, and object var parameters have already been processed - //these two were always set when instantiating an edit configuration object from json, - //although the json itself did not specify subject/predicate as part of uris in scope - urisInScope.put(editConfiguration.getVarNameForSubject(), - Arrays.asList(new String[]{editConfiguration.getSubjectUri()})); - urisInScope.put(editConfiguration.getVarNameForPredicate(), - Arrays.asList(new String[]{editConfiguration.getPredicateUri()})); - //Setting role type - urisInScope.put("roleType", - Arrays.asList(new String[]{getRoleType(vreq)})); - //Setting inverse role predicate - urisInScope.put("inverseRolePredicate", getInversePredicate(vreq)); - - editConfiguration.setUrisInScope(urisInScope); - //Uris in scope include subject, predicate, and object var - //literals in scope empty initially, usually populated by code in prepare for update - //with existing values for variables - editConfiguration.setLiteralsInScope(new HashMap>()); - } - - private List getInversePredicate(VitroRequest vreq) { - List inversePredicateArray = new ArrayList(); - ObjectProperty op = EditConfigurationUtils.getObjectProperty(vreq); - if(op != null && op.getURIInverse() != null) { - inversePredicateArray.add(op.getURIInverse()); - } - return inversePredicateArray; - } - - //n3 should look as follows - //?subject ?predicate ?objectVar - - private void setUrisAndLiteralsOnForm(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - List urisOnForm = new ArrayList(); - List literalsOnForm = new ArrayList(); - //add role activity and roleActivityType to uris on form - urisOnForm.add("grant"); - urisOnForm.add("existingGrant"); - editConfiguration.setUrisOnform(urisOnForm); - //activity label and role label are literals on form - literalsOnForm.add("grantLabel"); - literalsOnForm.add("grantLabelDisplay"); - editConfiguration.setLiteralsOnForm(literalsOnForm); - } - - - /** - * Set SPARQL Queries and supporting methods - */ - - - private void setSparqlQueries(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - //Sparql queries defining retrieval of literals etc. - editConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap()); - - Map urisInScope = new HashMap(); - editConfiguration.setSparqlForAdditionalUrisInScope(urisInScope); - - editConfiguration.setSparqlForExistingLiterals(generateSparqlForExistingLiterals(vreq)); - editConfiguration.setSparqlForExistingUris(generateSparqlForExistingUris(vreq)); - } - - - //Get page uri for object - private HashMap generateSparqlForExistingUris(VitroRequest vreq) { - HashMap map = new HashMap(); - //Queries for role activity, activity type query, interval node, start node, end node, start field precision, endfield precision - map.put("existingGrant", getExistingGrantQuery(vreq)); - map.put("intervalNode", getIntervalNodeQuery(vreq)); - map.put("startNode", getStartNodeQuery(vreq)); - map.put("endNode", getEndNodeQuery(vreq)); - map.put("startField-precision", getStartPrecisionQuery(vreq)); - map.put("endField-precision", getEndPrecisionQuery(vreq)); - return map; - } - - - - private String getEndPrecisionQuery(VitroRequest vreq) { - String query = "SELECT ?existingEndPrecision WHERE {" + - "?role <" + getRoleToIntervalURI() + "> ?intervalNode ." + - "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> ." + - "?intervalNode <" + getIntervalToEndURI() + "> ?endNode ." + - "?endNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> . " + - "?endNode <" + getDateTimePrecisionURI() + "> ?existingEndPrecision . }"; - return query; - } - - private String getStartPrecisionQuery(VitroRequest vreq) { - String query = "SELECT ?existingStartPrecision WHERE {" + - "?role <" + getRoleToIntervalURI() + "> ?intervalNode ." + - "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> ." + - "?intervalNode <" + getIntervalToStartURI() + "> ?startNode ." + - "?startNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> . " + - "?startNode <" + getDateTimePrecisionURI() + "> ?existingStartPrecision . }"; - return query; - } - - private String getEndNodeQuery(VitroRequest vreq) { - String query = "SELECT ?existingEndNode WHERE {"+ - "?role <" + getRoleToIntervalURI() + "> ?intervalNode ."+ - "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> ."+ - " ?intervalNode <" + getIntervalToEndURI() + "> ?existingEndNode . "+ - "?existingEndNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> .}"; - return query; - } - - private String getStartNodeQuery(VitroRequest vreq) { - String query = "SELECT ?existingStartNode WHERE {"+ - "?role <" + getRoleToIntervalURI() + "> ?intervalNode ."+ - "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> ."+ - "?intervalNode <" + getIntervalToStartURI() + "> ?existingStartNode . "+ - "?existingStartNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> .}"; - return query; - } - - private String getIntervalNodeQuery(VitroRequest vreq) { - String query = "SELECT ?existingIntervalNode WHERE { " + - "?role <" + getRoleToIntervalURI() + "> ?existingIntervalNode . " + - " ?existingIntervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> . }"; - return query; - } - - - - private HashMap generateSparqlForExistingLiterals(VitroRequest vreq) { - HashMap map = new HashMap(); - //Queries for activity label, role label, start Field value, end Field value - map.put("grantLabel", getGrantLabelQuery(vreq)); - map.put("startField-value", getExistingStartDateQuery(vreq)); - map.put("endField-value", getExistingEndDateQuery(vreq)); - return map; - } - - private String getGrantLabelQuery(VitroRequest vreq) { - String query = "PREFIX core: <" + getVivoCoreNamespace() + ">" + - "PREFIX rdfs: <" + RDFS.getURI() + "> \n"; - - String roleToGrantPredicate = getRoleToGrantPredicate(vreq); - query += "SELECT ?existingGrantLabel WHERE { \n" + - "?role <" + roleToGrantPredicate + "> ?existingGrant . \n" + - "?existingGrant rdfs:label ?existingGrantLabel . }"; - - return query; - } - - private String getExistingGrantQuery(VitroRequest vreq) { - String query = "PREFIX core: <" + getVivoCoreNamespace() + ">" + - "PREFIX rdfs: <" + RDFS.getURI() + "> \n"; - - String roleToGrantPredicate = getRoleToGrantPredicate(vreq); - query += "SELECT ?existingGrant WHERE { \n" + - "?role <" + roleToGrantPredicate + "> ?existingGrant . }"; - return query; - } - - private String getExistingEndDateQuery(VitroRequest vreq) { - String query = " SELECT ?existingEndDate WHERE {\n" + - "?role <" + getRoleToIntervalURI() + "> ?intervalNode .\n" + - "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> .\n" + - "?intervalNode <" + getIntervalToEndURI() + "> ?endNode .\n" + - "?endNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> .\n" + - "?endNode <" + getDateTimeValueURI() + "> ?existingEndDate . }"; - return query; - } - - private String getExistingStartDateQuery(VitroRequest vreq) { - String query = "SELECT ?existingDateStart WHERE {\n" + - "?role <" + getRoleToIntervalURI() + "> ?intervalNode .\n" + - "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> .\n" + - "?intervalNode <" + getIntervalToStartURI() + "> ?startNode .\n" + - "?startNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> .\n" + - "?startNode <" + getDateTimeValueURI() + "> ?existingDateStart . }"; - - return query; - } - - /** - * - * Set Fields and supporting methods - */ - - private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) { - Map fields = new HashMap(); - //Multiple fields - getGrantField(editConfiguration, vreq, fields); - getGrantLabelField(editConfiguration, vreq, fields); - getGrantLabelDisplayField(editConfiguration, vreq, fields); - getExistingGrantField(editConfiguration, vreq, fields); - getStartField(editConfiguration, vreq, fields); - getEndField(editConfiguration, vreq, fields); - editConfiguration.setFields(fields); - } - - private void getGrantField(EditConfigurationVTwo editConfiguration, - VitroRequest vreq, Map fields) { - String fieldName = "grant"; - - FieldVTwo field = new FieldVTwo(); - field.setName(fieldName); - //queryForExisting is not being used anywhere in Field - - List validators = new ArrayList(); - field.setValidators(validators); - - fields.put(field.getName(), field); - - } - - private void getGrantLabelField(EditConfigurationVTwo editConfiguration, - VitroRequest vreq, Map fields) { - String fieldName = "grantLabel"; - //get range data type uri and range language - String stringDatatypeUri = XSD.xstring.toString(); - - FieldVTwo field = new FieldVTwo(); - field.setName(fieldName); - //queryForExisting is not being used anywhere in Field - - //Not really interested in validators here - List validators = new ArrayList(); - validators.add("datatype:" + stringDatatypeUri); - field.setValidators(validators); - - fields.put(field.getName(), field); - - } - - private void getGrantLabelDisplayField(EditConfigurationVTwo editConfiguration, - VitroRequest vreq, Map fields) { - - FieldVTwo field = new FieldVTwo(); - - String fieldName = "grantLabelDisplay"; - field.setName(fieldName); - - String stringDatatypeUri = XSD.xstring.toString(); - field.setRangeDatatypeUri(null); - - fields.put(field.getName(), field); - - } - //Need if returning from an invalid submission - private void getExistingGrantField( - EditConfigurationVTwo editConfiguration, VitroRequest vreq, - Map fields) { - String fieldName = "existingGrant"; - - FieldVTwo field = new FieldVTwo(); - field.setName(fieldName); - //queryForExisting is not being used anywhere in Field - - fields.put(field.getName(), field); - } - - private void getStartField(EditConfigurationVTwo editConfiguration, - VitroRequest vreq, Map fields) { - String fieldName = "startField"; - - FieldVTwo field = new FieldVTwo(); - field.setName(fieldName); - - //This logic was originally after edit configuration object created from json in original jsp - field.setEditElement( - new DateTimeWithPrecisionVTwo(field, - VitroVocabulary.Precision.YEAR.uri(), - VitroVocabulary.Precision.NONE.uri())); - - fields.put(field.getName(), field); - - } - - private void getEndField(EditConfigurationVTwo editConfiguration, - VitroRequest vreq, Map fields) { - String fieldName = "endField"; - - FieldVTwo field = new FieldVTwo(); - field.setName(fieldName); - - List validators = new ArrayList(); - field.setValidators(validators); - - //Set edit element - field.setEditElement( - new DateTimeWithPrecisionVTwo(field, - VitroVocabulary.Precision.YEAR.uri(), - VitroVocabulary.Precision.NONE.uri())); - - fields.put(field.getName(), field); - - } - - /** - * Prepare edit configuration for update - * @param vreq - * @param session - * @param editConfiguration - */ - - private void prepareForUpdate(VitroRequest vreq, HttpSession session, EditConfigurationVTwo editConfiguration) { - //Here, retrieve model from - OntModel model = ModelAccess.on(session.getServletContext()).getJenaOntModel(); - //Object property by definition - String objectUri = EditConfigurationUtils.getObjectUri(vreq); - if(objectUri != null) { - //update existing object - editConfiguration.prepareForObjPropUpdate(model); - } else { - //new object to be created - editConfiguration.prepareForNonUpdate( model ); - } - } - - /**Methods for checking edit mode ** - * - */ - public EditMode getEditMode(VitroRequest vreq) { - List roleToGrantPredicates = getPossibleRoleToGrantPredicates(); - return EditModeUtils.getEditMode(vreq, roleToGrantPredicates); - } - - private boolean isAddMode(VitroRequest vreq) { - return EditModeUtils.isAddMode(getEditMode(vreq)); - } - - private boolean isEditMode(VitroRequest vreq) { - return EditModeUtils.isEditMode(getEditMode(vreq)); - } - - private boolean isRepairMode(VitroRequest vreq) { - return EditModeUtils.isRepairMode(getEditMode(vreq)); - } - - /** - * Methods that are REQUIRED to be implemented in subclasses - **/ - //role type will always be set based on particular form - public String getRoleType(VitroRequest vreq) { - String predicateUri = EditConfigurationUtils.getPredicateUri(vreq); - if(predicateUri.equals(getHasPrincipalInvestigatorURI())) { - return getVivoOntologyCoreNamespace() + "PrincipalInvestigatorRole"; - } - else if(predicateUri.equals(getHasCoPrincipalInvestigatorURI())) { - return getVivoOntologyCoreNamespace() + "CoPrincipalInvestigatorRole"; - } else { - return getVivoOntologyCoreNamespace() + "InvestigatorRole"; - } - } - - private Object getHasCoPrincipalInvestigatorURI() { - return getVivoOntologyCoreNamespace() + "hasCo-PrincipalInvestigatorRole"; - } - - - //TODO: More dynamic way of getting this or standard mechanism - private String getVivoOntologyCoreNamespace() { - return "http://vivoweb.org/ontology/core#"; - } - - private Object getHasPrincipalInvestigatorURI() { - return getVivoOntologyCoreNamespace() + "hasPrincipalInvestigatorRole"; - - } - - /** - * Methods with default values that may be overwritten when required by a subclass - * Both Default value and method that can be overwritten are included below - **/ - - public boolean isShowRoleLabelField(VitroRequest vreq) { - return true; - } - - - //This has a default value, but note that even that will not be used - //in the update with realized in or contributes to - //Overridden when need be in subclassed generator - //Also note that for now we're going to actually going to return a - //placeholder value by default - public String getRoleToGrantPredicate(VitroRequest vreq) { - ObjectProperty predicate = ModelUtils.getPropertyForRoleInClass(getGrantType(), vreq.getWebappDaoFactory()); - return predicate.getURI(); - } - - public String getGrantToRolePredicate(VitroRequest vreq) { - ObjectProperty predicate = ModelUtils.getPropertyForRoleInClass(getGrantType(), vreq.getWebappDaoFactory()); - return predicate.getURIInverse(); - } - - public String getGrantType() { - return "http://vivoweb.org/ontology/core#Grant"; - } - //Ensure when overwritten that this includes the <> b/c otherwise the query won't work - - //Some values will have a default value - //grantToRolePredicate - public String getDefaultgrantToRolePredicate() { - return "http://vivoweb.org/ontology/core#relatedRole"; - } - - //roleToGrantPredicate - public String getDefaultroleToGrantPredicate() { - return "http://vivoweb.org/ontology/core#roleIn"; - - } - - public List getPossibleRoleToGrantPredicates() { - return ModelUtils.getPossiblePropertiesForRole(); - } - - public List getPossibleGrantToRolePredicates() { - return ModelUtils.getPossibleInversePropertiesForRole(); - } - - - /** - * Methods to return URIS for various predicates - **/ - public String getVivoCoreNamespace() { - return "http://vivoweb.org/ontology/core#"; - } - - public String getRoleToIntervalURI() { - return getVivoCoreNamespace() + "dateTimeInterval"; - } - - public String getIntervalTypeURI() { - return getVivoCoreNamespace() + "DateTimeInterval"; - } - - public String getIntervalToStartURI() { - return getVivoCoreNamespace() + "start"; - } - - public String getIntervalToEndURI() { - return getVivoCoreNamespace() + "end"; - } - - public String getStartYearPredURI() { - return getVivoCoreNamespace() + "startYear"; - } - - public String getEndYearPredURI() { - return getVivoCoreNamespace() + "endYear"; - } - - public String getDateTimeValueTypeURI() { - return getVivoCoreNamespace() + "DateTimeValue"; - } - - public String getDateTimePrecisionURI() { - return getVivoCoreNamespace() + "dateTimePrecision"; - } - - public String getDateTimeValueURI() { - return getVivoCoreNamespace() + "dateTime"; - } - - //Form specific data - public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - HashMap formSpecificData = new HashMap(); - formSpecificData.put("editMode", getEditMode(vreq).name().toLowerCase()); - //In this case, passing back a sparql query - formSpecificData.put("sparqlForAcFilter", getSparqlForAcFilter(vreq)); - //Put in the fact that we require field - editConfiguration.setFormSpecificData(formSpecificData); - } - - public String getSparqlForAcFilter(VitroRequest vreq) { - String subject = EditConfigurationUtils.getSubjectUri(vreq); - String predicate = EditConfigurationUtils.getPredicateUri(vreq); - - - String query = "PREFIX core:<" + getVivoCoreNamespace() + "> " + - "SELECT ?grantUri WHERE { " + - "<" + subject + "> <" + predicate + "> ?grantRole ." + - "?grantRole <" + getRoleToGrantPredicate(vreq) + "> ?grantUri . }"; - return query; - } - - - - - -} +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpSession; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.vivoweb.webapp.util.ModelUtils; + +import com.hp.hpl.jena.ontology.OntModel; +import com.hp.hpl.jena.rdf.model.Literal; +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.vocabulary.RDF; +import com.hp.hpl.jena.vocabulary.RDFS; +import com.hp.hpl.jena.vocabulary.XSD; + +import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.dao.ModelAccess; +import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.AutocompleteRequiredInputValidator; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeIntervalValidationVTwo; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation; +import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode; +import edu.cornell.mannlib.vitro.webapp.utils.generators.EditModeUtils; + +/** + * Custom form for adding a grant to an person for the predicates hasCo-PrincipalInvestigatorRole + and hasPrincipalInvestigatorRole. + +This is intended to create a set of statements like: + +?person core:hasPrincipalInvestigatorRole ?newRole. +?newRole rdf:type core:PrincipalInvestigatorRole ; + core:relatedRole ?someGrant . + + * + */ +public class AddGrantRoleToPersonGenerator implements EditConfigurationGenerator { + + private Log log = LogFactory.getLog(AddGrantRoleToPersonGenerator.class); + private String subjectUri = null; + private String predicateUri = null; + private String objectUri = null; + private String template = "addGrantRoleToPerson.ftl"; + + //Types of options to populate drop-down for types for the "right side" of the role + public static enum RoleActivityOptionTypes { + VCLASSGROUP, + CHILD_VCLASSES, + HARDCODED_LITERALS + }; + + @Override + public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) { + EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo(); + + //process subject, predicate, object parameters + this.initProcessParameters(vreq, session, editConfiguration); + + //Assumes this is a simple case of subject predicate var + editConfiguration.setN3Required(this.generateN3Required(vreq)); + + //n3 optional + editConfiguration.setN3Optional(this.generateN3Optional(vreq)); + + //Todo: what do new resources depend on here? + //In original form, these variables start off empty + editConfiguration.setNewResources(generateNewResources(vreq)); + //In scope + this.setUrisAndLiteralsInScope(editConfiguration, vreq); + + //on Form + this.setUrisAndLiteralsOnForm(editConfiguration, vreq); + + editConfiguration.setFilesOnForm(new ArrayList()); + + //Sparql queries + this.setSparqlQueries(editConfiguration, vreq); + + //set fields + setFields(editConfiguration, vreq, EditConfigurationUtils.getPredicateUri(vreq)); + + // No need to put in session here b/c put in session within edit request dispatch controller instead + //placing in session depends on having edit key which is handled in edit request dispatch controller + // editConfiguration.putConfigInSession(editConfiguration, session); + + prepareForUpdate(vreq, session, editConfiguration); + + //Form title and submit label now moved to edit configuration template + //TODO: check if edit configuration template correct place to set those or whether + //additional methods here should be used and reference instead, e.g. edit configuration template could call + //default obj property form.populateTemplate or some such method + //Select from existing also set within template itself + setTemplate(editConfiguration, vreq); + //Set edit key + setEditKey(editConfiguration, vreq); + + //Add validators + editConfiguration.addValidator(new DateTimeIntervalValidationVTwo("startField","endField") ); + editConfiguration.addValidator(new AntiXssValidation()); + editConfiguration.addValidator(new AutocompleteRequiredInputValidator("existingGrant","grantLabel")); + //no preprocessors required here + //Adding additional data, specifically edit mode + addFormSpecificData(editConfiguration, vreq); + return editConfiguration; + } + + + + private void setEditKey(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { + String editKey = EditConfigurationUtils.getEditKey(vreq); + editConfiguration.setEditKey(editKey); + } + + protected void setTemplate(EditConfigurationVTwo editConfiguration, + VitroRequest vreq) { + editConfiguration.setTemplate(template); + + } + + //Initialize setup: process parameters + //There will be specialized parameters as well, we may include them here or in a + //separate method + private void initProcessParameters(VitroRequest vreq, HttpSession session, EditConfigurationVTwo editConfiguration) { + String formUrl = EditConfigurationUtils.getFormUrlWithoutContext(vreq); + + subjectUri = EditConfigurationUtils.getSubjectUri(vreq); + predicateUri = EditConfigurationUtils.getPredicateUri(vreq); + + editConfiguration.setFormUrl(formUrl); + + editConfiguration.setUrlPatternToReturnTo("/individual"); + + editConfiguration.setVarNameForSubject("person"); + editConfiguration.setSubjectUri(subjectUri); + editConfiguration.setEntityToReturnTo(subjectUri); + editConfiguration.setVarNameForPredicate("rolePredicate"); + editConfiguration.setPredicateUri(predicateUri); + //by definition, this is an object property + objectUri = EditConfigurationUtils.getObjectUri(vreq); + + this.processObjectPropForm(vreq, editConfiguration); + } + + private void processObjectPropForm(VitroRequest vreq, EditConfigurationVTwo editConfiguration) { + editConfiguration.setVarNameForObject("role"); + editConfiguration.setObject(objectUri); + //this needs to be set for the editing to be triggered properly, otherwise the 'prepare' method + //pretends this is a data property editing statement and throws an error + //TODO: Check if null in case no object uri exists but this is still an object property + } + + + /* + * N3 Required and Optional Generators as well as supporting methods + */ + + private String getPrefixesString() { + //TODO: Include dynamic way of including this + return "@prefix core: ."; + } + + //TODO: Check if single string or multiple strings - check rdfslabel form etc. for prefix + //processing + private List generateN3Required(VitroRequest vreq) { + List n3ForEdit = new ArrayList(); + String editString = getN3ForGrantRole(vreq); + n3ForEdit.add(editString); + return n3ForEdit; + } + + + private List generateN3Optional(VitroRequest vreq) { + List n3Optional = new ArrayList(); + //n3 for new grant + n3Optional.add(getN3ForNewGrant(vreq)); + //n3 for existing grant + n3Optional.add(getN3ForExistingGrant(vreq)); + //n3 for inverse + n3Optional.add("?role ?inverseRolePredicate ?person ."); + //N3ForStart + n3Optional.addAll(getN3ForStart()); + //N3 For End + n3Optional.addAll(getN3ForEnd()); + return n3Optional; + } + + public String getN3ForGrantRole(VitroRequest vreq) { + String editString = getPrefixesString(); + editString += "?person ?rolePredicate ?role ."; + editString += "?role a <" + getRoleType(vreq) + "> ."; + return editString; + } + + public String getN3ForNewGrant(VitroRequest vreq) { + String editString = getPrefixesString(); + editString += "?role <" + getRoleToGrantPredicate(vreq) + "> ?grant ."; + editString += "?grant a core:Grant . "; + editString += "?grant <" + getGrantToRolePredicate(vreq) + "> ?role ."; + editString += "?grant <" + RDFS.label.getURI() + "> ?grantLabel ."; + return editString; + } + + public String getN3ForExistingGrant(VitroRequest vreq) { + String editString = getPrefixesString(); + editString += "?role <" + getRoleToGrantPredicate(vreq) + "> ?existingGrant . "; + editString += "?existingGrant <" + getGrantToRolePredicate(vreq) + "> ?role ."; + return editString; + } + + //Method b/c used in two locations, n3 optional and n3 assertions + private List getN3ForStart() { + List n3ForStart = new ArrayList(); + n3ForStart.add("?role <" + getRoleToIntervalURI() + "> ?intervalNode ." + + "?intervalNode <" + RDF.type.getURI() + "> <" + getIntervalTypeURI() + "> ." + + "?intervalNode <" + getIntervalToStartURI() + "> ?startNode ." + + "?startNode <" + RDF.type.getURI() + "> <" + getDateTimeValueTypeURI() + "> ." + + "?startNode <" + getDateTimeValueURI() + "> ?startField-value ." + + "?startNode <" + getDateTimePrecisionURI() + "> ?startField-precision ."); + return n3ForStart; + } + + private List getN3ForEnd() { + List n3ForEnd = new ArrayList(); + n3ForEnd.add("?role <" + getRoleToIntervalURI() + "> ?intervalNode . " + + "?intervalNode <" + RDF.type.getURI() + "> <" + getIntervalTypeURI() + "> ." + + "?intervalNode <" + getIntervalToEndURI() + "> ?endNode ." + + "?endNode <" + RDF.type.getURI() + "> <" + getDateTimeValueTypeURI() + "> ." + + "?endNode <" + getDateTimeValueURI() + "> ?endField-value ." + + "?endNode <" + getDateTimePrecisionURI() + "> ?endField-precision ."); + return n3ForEnd; + + } + + + /* + * Get new resources + */ + private Map generateNewResources(VitroRequest vreq) { + HashMap newResources = new HashMap(); + //TODO: Get default namespace + String defaultNamespace = vreq.getWebappDaoFactory().getDefaultNamespace(); + newResources.put("role", defaultNamespace + "individual"); + newResources.put("grant", defaultNamespace + "individual"); + newResources.put("intervalNode", defaultNamespace + "individual"); + newResources.put("startNode", defaultNamespace + "individual"); + newResources.put("endNode", defaultNamespace + "individual"); + return newResources; + } + + /* + * Set URIS and Literals In Scope and on form and supporting methods + */ + + private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { + HashMap> urisInScope = new HashMap>(); + //note that at this point the subject, predicate, and object var parameters have already been processed + //these two were always set when instantiating an edit configuration object from json, + //although the json itself did not specify subject/predicate as part of uris in scope + urisInScope.put(editConfiguration.getVarNameForSubject(), + Arrays.asList(new String[]{editConfiguration.getSubjectUri()})); + urisInScope.put(editConfiguration.getVarNameForPredicate(), + Arrays.asList(new String[]{editConfiguration.getPredicateUri()})); + //Setting role type + urisInScope.put("roleType", + Arrays.asList(new String[]{getRoleType(vreq)})); + //Setting inverse role predicate + urisInScope.put("inverseRolePredicate", getInversePredicate(vreq)); + + editConfiguration.setUrisInScope(urisInScope); + //Uris in scope include subject, predicate, and object var + //literals in scope empty initially, usually populated by code in prepare for update + //with existing values for variables + editConfiguration.setLiteralsInScope(new HashMap>()); + } + + private List getInversePredicate(VitroRequest vreq) { + List inversePredicateArray = new ArrayList(); + ObjectProperty op = EditConfigurationUtils.getObjectProperty(vreq); + if(op != null && op.getURIInverse() != null) { + inversePredicateArray.add(op.getURIInverse()); + } + return inversePredicateArray; + } + + //n3 should look as follows + //?subject ?predicate ?objectVar + + private void setUrisAndLiteralsOnForm(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { + List urisOnForm = new ArrayList(); + List literalsOnForm = new ArrayList(); + //add role activity and roleActivityType to uris on form + urisOnForm.add("grant"); + urisOnForm.add("existingGrant"); + editConfiguration.setUrisOnform(urisOnForm); + //activity label and role label are literals on form + literalsOnForm.add("grantLabel"); + literalsOnForm.add("grantLabelDisplay"); + editConfiguration.setLiteralsOnForm(literalsOnForm); + } + + + /** + * Set SPARQL Queries and supporting methods + */ + + + private void setSparqlQueries(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { + //Sparql queries defining retrieval of literals etc. + editConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap()); + + Map urisInScope = new HashMap(); + editConfiguration.setSparqlForAdditionalUrisInScope(urisInScope); + + editConfiguration.setSparqlForExistingLiterals(generateSparqlForExistingLiterals(vreq)); + editConfiguration.setSparqlForExistingUris(generateSparqlForExistingUris(vreq)); + } + + + //Get page uri for object + private HashMap generateSparqlForExistingUris(VitroRequest vreq) { + HashMap map = new HashMap(); + //Queries for role activity, activity type query, interval node, start node, end node, start field precision, endfield precision + map.put("existingGrant", getExistingGrantQuery(vreq)); + map.put("intervalNode", getIntervalNodeQuery(vreq)); + map.put("startNode", getStartNodeQuery(vreq)); + map.put("endNode", getEndNodeQuery(vreq)); + map.put("startField-precision", getStartPrecisionQuery(vreq)); + map.put("endField-precision", getEndPrecisionQuery(vreq)); + return map; + } + + + + private String getEndPrecisionQuery(VitroRequest vreq) { + String query = "SELECT ?existingEndPrecision WHERE {" + + "?role <" + getRoleToIntervalURI() + "> ?intervalNode ." + + "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> ." + + "?intervalNode <" + getIntervalToEndURI() + "> ?endNode ." + + "?endNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> . " + + "?endNode <" + getDateTimePrecisionURI() + "> ?existingEndPrecision . }"; + return query; + } + + private String getStartPrecisionQuery(VitroRequest vreq) { + String query = "SELECT ?existingStartPrecision WHERE {" + + "?role <" + getRoleToIntervalURI() + "> ?intervalNode ." + + "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> ." + + "?intervalNode <" + getIntervalToStartURI() + "> ?startNode ." + + "?startNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> . " + + "?startNode <" + getDateTimePrecisionURI() + "> ?existingStartPrecision . }"; + return query; + } + + private String getEndNodeQuery(VitroRequest vreq) { + String query = "SELECT ?existingEndNode WHERE {"+ + "?role <" + getRoleToIntervalURI() + "> ?intervalNode ."+ + "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> ."+ + " ?intervalNode <" + getIntervalToEndURI() + "> ?existingEndNode . "+ + "?existingEndNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> .}"; + return query; + } + + private String getStartNodeQuery(VitroRequest vreq) { + String query = "SELECT ?existingStartNode WHERE {"+ + "?role <" + getRoleToIntervalURI() + "> ?intervalNode ."+ + "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> ."+ + "?intervalNode <" + getIntervalToStartURI() + "> ?existingStartNode . "+ + "?existingStartNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> .}"; + return query; + } + + private String getIntervalNodeQuery(VitroRequest vreq) { + String query = "SELECT ?existingIntervalNode WHERE { " + + "?role <" + getRoleToIntervalURI() + "> ?existingIntervalNode . " + + " ?existingIntervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> . }"; + return query; + } + + + + private HashMap generateSparqlForExistingLiterals(VitroRequest vreq) { + HashMap map = new HashMap(); + //Queries for activity label, role label, start Field value, end Field value + map.put("grantLabel", getGrantLabelQuery(vreq)); + map.put("startField-value", getExistingStartDateQuery(vreq)); + map.put("endField-value", getExistingEndDateQuery(vreq)); + return map; + } + + private String getGrantLabelQuery(VitroRequest vreq) { + String query = "PREFIX core: <" + getVivoCoreNamespace() + ">" + + "PREFIX rdfs: <" + RDFS.getURI() + "> \n"; + + String roleToGrantPredicate = getRoleToGrantPredicate(vreq); + query += "SELECT ?existingGrantLabel WHERE { \n" + + "?role <" + roleToGrantPredicate + "> ?existingGrant . \n" + + "?existingGrant rdfs:label ?existingGrantLabel . }"; + + return query; + } + + private String getExistingGrantQuery(VitroRequest vreq) { + String query = "PREFIX core: <" + getVivoCoreNamespace() + ">" + + "PREFIX rdfs: <" + RDFS.getURI() + "> \n"; + + String roleToGrantPredicate = getRoleToGrantPredicate(vreq); + query += "SELECT ?existingGrant WHERE { \n" + + "?role <" + roleToGrantPredicate + "> ?existingGrant . }"; + return query; + } + + private String getExistingEndDateQuery(VitroRequest vreq) { + String query = " SELECT ?existingEndDate WHERE {\n" + + "?role <" + getRoleToIntervalURI() + "> ?intervalNode .\n" + + "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> .\n" + + "?intervalNode <" + getIntervalToEndURI() + "> ?endNode .\n" + + "?endNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> .\n" + + "?endNode <" + getDateTimeValueURI() + "> ?existingEndDate . }"; + return query; + } + + private String getExistingStartDateQuery(VitroRequest vreq) { + String query = "SELECT ?existingDateStart WHERE {\n" + + "?role <" + getRoleToIntervalURI() + "> ?intervalNode .\n" + + "?intervalNode <" + VitroVocabulary.RDF_TYPE + "> <" + getIntervalTypeURI() + "> .\n" + + "?intervalNode <" + getIntervalToStartURI() + "> ?startNode .\n" + + "?startNode <" + VitroVocabulary.RDF_TYPE + "> <" + getDateTimeValueTypeURI() + "> .\n" + + "?startNode <" + getDateTimeValueURI() + "> ?existingDateStart . }"; + + return query; + } + + /** + * + * Set Fields and supporting methods + */ + + private void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) { + Map fields = new HashMap(); + //Multiple fields + getGrantField(editConfiguration, vreq, fields); + getGrantLabelField(editConfiguration, vreq, fields); + getGrantLabelDisplayField(editConfiguration, vreq, fields); + getExistingGrantField(editConfiguration, vreq, fields); + getStartField(editConfiguration, vreq, fields); + getEndField(editConfiguration, vreq, fields); + editConfiguration.setFields(fields); + } + + private void getGrantField(EditConfigurationVTwo editConfiguration, + VitroRequest vreq, Map fields) { + String fieldName = "grant"; + + FieldVTwo field = new FieldVTwo(); + field.setName(fieldName); + //queryForExisting is not being used anywhere in Field + + List validators = new ArrayList(); + field.setValidators(validators); + + fields.put(field.getName(), field); + + } + + private void getGrantLabelField(EditConfigurationVTwo editConfiguration, + VitroRequest vreq, Map fields) { + String fieldName = "grantLabel"; + //get range data type uri and range language + String stringDatatypeUri = XSD.xstring.toString(); + + FieldVTwo field = new FieldVTwo(); + field.setName(fieldName); + //queryForExisting is not being used anywhere in Field + + //Not really interested in validators here + List validators = new ArrayList(); + validators.add("datatype:" + stringDatatypeUri); + field.setValidators(validators); + + fields.put(field.getName(), field); + + } + + private void getGrantLabelDisplayField(EditConfigurationVTwo editConfiguration, + VitroRequest vreq, Map fields) { + + FieldVTwo field = new FieldVTwo(); + + String fieldName = "grantLabelDisplay"; + field.setName(fieldName); + + String stringDatatypeUri = XSD.xstring.toString(); + field.setRangeDatatypeUri(null); + + fields.put(field.getName(), field); + + } + //Need if returning from an invalid submission + private void getExistingGrantField( + EditConfigurationVTwo editConfiguration, VitroRequest vreq, + Map fields) { + String fieldName = "existingGrant"; + + FieldVTwo field = new FieldVTwo(); + field.setName(fieldName); + //queryForExisting is not being used anywhere in Field + + fields.put(field.getName(), field); + } + + private void getStartField(EditConfigurationVTwo editConfiguration, + VitroRequest vreq, Map fields) { + String fieldName = "startField"; + + FieldVTwo field = new FieldVTwo(); + field.setName(fieldName); + + //This logic was originally after edit configuration object created from json in original jsp + field.setEditElement( + new DateTimeWithPrecisionVTwo(field, + VitroVocabulary.Precision.YEAR.uri(), + VitroVocabulary.Precision.NONE.uri())); + + fields.put(field.getName(), field); + + } + + private void getEndField(EditConfigurationVTwo editConfiguration, + VitroRequest vreq, Map fields) { + String fieldName = "endField"; + + FieldVTwo field = new FieldVTwo(); + field.setName(fieldName); + + List validators = new ArrayList(); + field.setValidators(validators); + + //Set edit element + field.setEditElement( + new DateTimeWithPrecisionVTwo(field, + VitroVocabulary.Precision.YEAR.uri(), + VitroVocabulary.Precision.NONE.uri())); + + fields.put(field.getName(), field); + + } + + /** + * Prepare edit configuration for update + * @param vreq + * @param session + * @param editConfiguration + */ + + private void prepareForUpdate(VitroRequest vreq, HttpSession session, EditConfigurationVTwo editConfiguration) { + //Here, retrieve model from + OntModel model = ModelAccess.on(session.getServletContext()).getJenaOntModel(); + //Object property by definition + String objectUri = EditConfigurationUtils.getObjectUri(vreq); + if(objectUri != null) { + //update existing object + editConfiguration.prepareForObjPropUpdate(model); + } else { + //new object to be created + editConfiguration.prepareForNonUpdate( model ); + } + } + + /**Methods for checking edit mode ** + * + */ + public EditMode getEditMode(VitroRequest vreq) { + List roleToGrantPredicates = getPossibleRoleToGrantPredicates(); + return EditModeUtils.getEditMode(vreq, roleToGrantPredicates); + } + + private boolean isAddMode(VitroRequest vreq) { + return EditModeUtils.isAddMode(getEditMode(vreq)); + } + + private boolean isEditMode(VitroRequest vreq) { + return EditModeUtils.isEditMode(getEditMode(vreq)); + } + + private boolean isRepairMode(VitroRequest vreq) { + return EditModeUtils.isRepairMode(getEditMode(vreq)); + } + + /** + * Methods that are REQUIRED to be implemented in subclasses + **/ + //role type will always be set based on particular form + public String getRoleType(VitroRequest vreq) { + String rangeUri = EditConfigurationUtils.getRangeUri(vreq); + if(rangeUri.equals(getPrincipalInvestigatorURI())) { + return getVivoOntologyCoreNamespace() + "PrincipalInvestigatorRole"; + } + else if(predicateUri.equals(getCoPrincipalInvestigatorURI())) { + return getVivoOntologyCoreNamespace() + "CoPrincipalInvestigatorRole"; + } else { + return getVivoOntologyCoreNamespace() + "InvestigatorRole"; + } + } + + private Object getCoPrincipalInvestigatorURI() { + return getVivoOntologyCoreNamespace() + "CoPrincipalInvestigatorRole"; + } + + + //TODO: More dynamic way of getting this or standard mechanism + private String getVivoOntologyCoreNamespace() { + return "http://vivoweb.org/ontology/core#"; + } + + private Object getPrincipalInvestigatorURI() { + return getVivoOntologyCoreNamespace() + "PrincipalInvestigatorRole"; + + } + + /** + * Methods with default values that may be overwritten when required by a subclass + * Both Default value and method that can be overwritten are included below + **/ + + public boolean isShowRoleLabelField(VitroRequest vreq) { + return true; + } + + + //This has a default value, but note that even that will not be used + //in the update with realized in or contributes to + //Overridden when need be in subclassed generator + //Also note that for now we're going to actually going to return a + //placeholder value by default + public String getRoleToGrantPredicate(VitroRequest vreq) { + ObjectProperty predicate = ModelUtils.getPropertyForRoleInClass(getGrantType(), vreq.getWebappDaoFactory()); + return predicate.getURI(); + } + + public String getGrantToRolePredicate(VitroRequest vreq) { + ObjectProperty predicate = ModelUtils.getPropertyForRoleInClass(getGrantType(), vreq.getWebappDaoFactory()); + return predicate.getURIInverse(); + } + + public String getGrantType() { + return "http://vivoweb.org/ontology/core#Grant"; + } + //Ensure when overwritten that this includes the <> b/c otherwise the query won't work + + //Some values will have a default value + //grantToRolePredicate + public String getDefaultgrantToRolePredicate() { + return "http://vivoweb.org/ontology/core#relatedRole"; + } + + //roleToGrantPredicate + public String getDefaultroleToGrantPredicate() { + return "http://vivoweb.org/ontology/core#roleIn"; + + } + + public List getPossibleRoleToGrantPredicates() { + return ModelUtils.getPossiblePropertiesForRole(); + } + + public List getPossibleGrantToRolePredicates() { + return ModelUtils.getPossibleInversePropertiesForRole(); + } + + + /** + * Methods to return URIS for various predicates + **/ + public String getVivoCoreNamespace() { + return "http://vivoweb.org/ontology/core#"; + } + + public String getRoleToIntervalURI() { + return getVivoCoreNamespace() + "dateTimeInterval"; + } + + public String getIntervalTypeURI() { + return getVivoCoreNamespace() + "DateTimeInterval"; + } + + public String getIntervalToStartURI() { + return getVivoCoreNamespace() + "start"; + } + + public String getIntervalToEndURI() { + return getVivoCoreNamespace() + "end"; + } + + public String getStartYearPredURI() { + return getVivoCoreNamespace() + "startYear"; + } + + public String getEndYearPredURI() { + return getVivoCoreNamespace() + "endYear"; + } + + public String getDateTimeValueTypeURI() { + return getVivoCoreNamespace() + "DateTimeValue"; + } + + public String getDateTimePrecisionURI() { + return getVivoCoreNamespace() + "dateTimePrecision"; + } + + public String getDateTimeValueURI() { + return getVivoCoreNamespace() + "dateTime"; + } + + //Form specific data + public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { + HashMap formSpecificData = new HashMap(); + formSpecificData.put("editMode", getEditMode(vreq).name().toLowerCase()); + //In this case, passing back a sparql query + formSpecificData.put("sparqlForAcFilter", getSparqlForAcFilter(vreq)); + //Put in the fact that we require field + editConfiguration.setFormSpecificData(formSpecificData); + } + + public String getSparqlForAcFilter(VitroRequest vreq) { + String subject = EditConfigurationUtils.getSubjectUri(vreq); + String predicate = EditConfigurationUtils.getPredicateUri(vreq); + + + String query = "PREFIX core:<" + getVivoCoreNamespace() + "> " + + "SELECT ?grantUri WHERE { " + + "<" + subject + "> <" + predicate + "> ?grantRole ." + + "?grantRole <" + getRoleToGrantPredicate(vreq) + "> ?grantUri . }"; + return query; + } + + + + + +} diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddPresenterRoleToPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddPresenterRoleToPersonGenerator.java index 1cab984d..78a1f6ce 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddPresenterRoleToPersonGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddPresenterRoleToPersonGenerator.java @@ -1,311 +1,311 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; - -import java.util.Arrays; - -import javax.servlet.http.HttpSession; - -import com.hp.hpl.jena.vocabulary.XSD; - -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.AutocompleteRequiredInputValidator; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeIntervalValidationVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesWithParent; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation; - -public class AddPresenterRoleToPersonGenerator extends VivoBaseGenerator implements - EditConfigurationGenerator { - - final static String presentationClass = vivoCore + "Presentation"; - final static String roleClass = vivoCore + "PresenterRole"; - final static String conferenceClass = bibo + "Conference"; - final static String hasRolePred = vivoCore + "hasPresenterRole"; - final static String roleOfPred = vivoCore + "presenterRoleOf"; - final static String roleRealizedInPred = vivoCore + "roleRealizedIn"; - final static String realizedRolePred = vivoCore + "realizedRole"; - final static String includesEventPred = vivoCore + "includesEvent"; - final static String eventWithinPred = vivoCore + "eventWithin"; - final static String roleToInterval = vivoCore + "dateTimeInterval"; - final static String intervalType = vivoCore + "DateTimeInterval"; - final static String intervalToStart = vivoCore + "start"; - final static String intervalToEnd = vivoCore + "end"; - final static String dateTimeValueType = vivoCore + "DateTimeValue"; - final static String dateTimeValue = vivoCore + "dateTime"; - final static String dateTimePrecision = vivoCore + "dateTimePrecision"; - - public AddPresenterRoleToPersonGenerator() {} - - @Override - public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, - HttpSession session) throws Exception { - - EditConfigurationVTwo conf = new EditConfigurationVTwo(); - - initBasics(conf, vreq); - initPropertyParameters(vreq, session, conf); - initObjectPropForm(conf, vreq); - - conf.setTemplate("addPresenterRoleToPerson.ftl"); - - conf.setVarNameForSubject("person"); - conf.setVarNameForPredicate("predicate"); - conf.setVarNameForObject("role"); - - conf.setN3Required( Arrays.asList( n3ForNewRole, - roleLabelAssertion) ); - conf.setN3Optional( Arrays.asList( n3ForNewPresentation, - n3ForExistingPresentation, - n3ForNewConferenceNewPres, - n3ForNewConferenceExistingPres, - n3ForExistingConferenceNewPres, - n3ForExistingConferenceExistingPres, - n3ForStart, - n3ForEnd ) ); - - conf.addNewResource("presentation", DEFAULT_NS_FOR_NEW_RESOURCE); - conf.addNewResource("newConference", DEFAULT_NS_FOR_NEW_RESOURCE); - conf.addNewResource("role", DEFAULT_NS_FOR_NEW_RESOURCE); - conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE); - conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE); - conf.addNewResource("endNode", DEFAULT_NS_FOR_NEW_RESOURCE); - - //uris in scope: none - //literals in scope: none - - conf.setUrisOnform(Arrays.asList("existingPresentation", "existingConference", "presentationType")); - conf.setLiteralsOnForm(Arrays.asList("presentationLabel", "presentationLabelDisplay", "conferenceLabel", "conferenceLabelDisplay", "roleLabel")); - - conf.addSparqlForExistingLiteral("presentationLabel", presentationLabelQuery); - conf.addSparqlForExistingLiteral("conferenceLabel", conferenceLabelQuery); - conf.addSparqlForExistingLiteral("roleLabel", roleLabelQuery); - conf.addSparqlForExistingUris("existingPresentation", presentationQuery); - conf.addSparqlForExistingUris("existingConference", existingConferenceQuery); - conf.addSparqlForExistingUris("presentationType", presentationTypeQuery); - conf.addSparqlForExistingLiteral( - "startField-value", existingStartDateQuery); - conf.addSparqlForExistingLiteral( - "endField-value", existingEndDateQuery); - conf.addSparqlForExistingUris( - "intervalNode", existingIntervalNodeQuery); - conf.addSparqlForExistingUris("startNode", existingStartNodeQuery); - conf.addSparqlForExistingUris("endNode", existingEndNodeQuery); - conf.addSparqlForExistingUris("startField-precision", - existingStartPrecisionQuery); - conf.addSparqlForExistingUris("endField-precision", - existingEndPrecisionQuery); - - conf.addField( new FieldVTwo(). // an autocomplete field - setName("existingPresentation") - ); - - conf.addField( new FieldVTwo(). - setName("presentationLabelDisplay") - .setRangeDatatypeUri( XSD.xstring.toString() ). - setValidators( list("datatype:" + XSD.xstring.toString()) ) - ); - - conf.addField( new FieldVTwo(). - setName("presentationLabel") - .setRangeDatatypeUri( XSD.xstring.toString() ). - setValidators( list("datatype:" + XSD.xstring.toString()) ) - ); - - conf.addField( new FieldVTwo(). - setName("presentationType"). - setValidators( list("nonempty") ). - setOptions( new ChildVClassesWithParent( - presentationClass)) - ); - - conf.addField( new FieldVTwo(). - setName("roleLabel") - .setRangeDatatypeUri( XSD.xstring.toString() ). - setValidators( list("nonempty") ) - ); - - conf.addField( new FieldVTwo(). // an autocomplete field - setName("existingConference") - ); - - conf.addField( new FieldVTwo(). - setName("conferenceLabel"). - setRangeDatatypeUri(XSD.xstring.toString() ) - ); - - conf.addField( new FieldVTwo(). - setName("conferenceLabelDisplay"). - setRangeDatatypeUri(XSD.xstring.toString() ) - ); - - conf.addField( new FieldVTwo().setName("startField"). - setEditElement( - new DateTimeWithPrecisionVTwo(null, - VitroVocabulary.Precision.YEAR.uri(), - VitroVocabulary.Precision.NONE.uri()) - ) - ); - - conf.addField( new FieldVTwo().setName("endField"). - setEditElement( - new DateTimeWithPrecisionVTwo(null, - VitroVocabulary.Precision.YEAR.uri(), - VitroVocabulary.Precision.NONE.uri()) - ) - ); - - conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField")); - conf.addValidator(new AntiXssValidation()); - conf.addValidator(new AutocompleteRequiredInputValidator("existingPresentation", "presentationLabel")); - prepare(vreq, conf); - return conf; - } - - /* N3 assertions */ - final static String n3ForNewRole = - "@prefix core: <" + vivoCore + "> . \n\n" + - "?person <" + hasRolePred + "> ?role . \n" + - "?role a <" + roleClass + "> . \n" + - "?role <" + roleOfPred + "> ?person . "; - - final static String roleLabelAssertion = - "?role <" + label + "> ?roleLabel ."; - - final static String n3ForNewPresentation = - "?role <" + roleRealizedInPred + "> ?presentation . \n" + - "?presentation <" + realizedRolePred + "> ?role . \n" + - "?presentation <" + label + "> ?presentationLabel . \n" + - "?presentation a ?presentationType ."; - - final static String n3ForExistingPresentation = - "?role <" + roleRealizedInPred + "> ?existingPresentation . \n" + - "?existingPresentation <" + realizedRolePred + "> ?role . \n" + - "?existingPresentation a ?presentationType ."; - - final static String n3ForNewConferenceNewPres = - "?presentation <" + eventWithinPred + "> ?newConference . \n" + - "?newConference <" + includesEventPred + "> ?presentation . \n" + - "?newConference a <" + conferenceClass + "> . \n" + - "?newConference <" + label + "> ?conferenceLabel ."; - - final static String n3ForNewConferenceExistingPres = - "?existingPresentation <" + eventWithinPred + "> ?newConference . \n" + - "?newConference <" + includesEventPred + "> ?existingPresentation . \n" + - "?newConference a <" + conferenceClass + "> . \n" + - "?newConference <" + label + "> ?conferenceLabel ."; - - final static String n3ForExistingConferenceNewPres = - "?existingConference <" + includesEventPred + "> ?presentation . \n" + - "?presentation <" + eventWithinPred + "> ?existingConference . \n" + - "?presentation <" + label + "> ?presentationLabel . "; - - final static String n3ForExistingConferenceExistingPres = - "?existingConference <" + includesEventPred + "> ?existingPresentation . \n" + - "?existingPresentation <" + eventWithinPred + "> ?existingConference . "; - - final static String n3ForStart = - "?role <" + roleToInterval + "> ?intervalNode . \n" + - "?intervalNode a <" + intervalType + "> . \n" + - "?intervalNode <" + intervalToStart + "> ?startNode . \n" + - "?startNode a <" + dateTimeValueType + "> . \n" + - "?startNode <" + dateTimeValue + "> ?startField-value . \n" + - "?startNode <" + dateTimePrecision + "> ?startField-precision . \n"; - - final static String n3ForEnd = - "?role <" + roleToInterval + "> ?intervalNode . \n" + - "?intervalNode a <" + intervalType + "> . \n" + - "?intervalNode <" + intervalToEnd + "> ?endNode . \n" + - "?endNode a <" + dateTimeValueType + "> . \n" + - "?endNode <" + dateTimeValue + "> ?endField-value . \n" + - "?endNode <" + dateTimePrecision + "> ?endField-precision . \n"; - - /* Queries for editing an existing entry */ - final static String roleLabelQuery = - "SELECT ?existingRoleLabel WHERE { \n" + - "?role <" + label + "> ?existingRoleLabel . }"; - - final static String presentationQuery = - "SELECT ?existingPresentation WHERE { \n" + - "?role <" + roleRealizedInPred + "> ?existingPresentation . }"; - - final static String presentationLabelQuery = - "SELECT ?existingPresentationLabel WHERE { \n" + - "?role <" + roleRealizedInPred + "> ?existingPresentation . " + - "?existingPresentation <" + label + "> ?existingPresentationLabel . }"; - - final static String presentationTypeQuery = - "PREFIX vitro: <" + VitroVocabulary.vitroURI + "> \n" + - "SELECT ?existingPresentationType WHERE { \n" + - "?role <" + roleRealizedInPred + "> ?existingPresentation . " + - "?existingPresentation vitro:mostSpecificType ?existingPresentationType . }"; - - final static String existingConferenceQuery = - "SELECT ?existingConference WHERE { \n" + - "?role <" + roleRealizedInPred + "> ?existingPresentation . " + - "?existingPresentation <" + eventWithinPred + "> ?existingConference . }"; - - final static String conferenceLabelQuery = - "SELECT ?existingConferenceLabel WHERE { \n" + - "?role <" + roleRealizedInPred + "> ?existingPresentation . " + - "?existingPresentation <" + eventWithinPred + "> ?existingConference . \n" + - "?existingConference <" + label + "> ?existingConferenceLabel . }"; - - final static String existingStartDateQuery = - "SELECT ?existingDateStart WHERE { \n" + - " ?role <" + roleToInterval + "> ?intervalNode . \n" + - " ?intervalNode a <" + intervalType + "> . \n" + - " ?intervalNode <" + intervalToStart + "> ?startNode . \n" + - " ?startNode a <" + dateTimeValueType +"> . \n" + - " ?startNode <" + dateTimeValue + "> ?existingDateStart . }"; - - final static String existingEndDateQuery = - "SELECT ?existingEndDate WHERE { \n" + - " ?role <" + roleToInterval + "> ?intervalNode . \n" + - " ?intervalNode a <" + intervalType + "> . \n " + - " ?intervalNode <" + intervalToEnd + "> ?endNode . \n" + - " ?endNode a <" + dateTimeValueType + "> . \n" + - " ?endNode <" + dateTimeValue + "> ?existingEndDate . }"; - - final static String existingIntervalNodeQuery = - "SELECT ?existingIntervalNode WHERE { \n" + - " ?role <" + roleToInterval + "> ?existingIntervalNode . \n" + - " ?existingIntervalNode a <" + intervalType + "> . }"; - - final static String existingStartNodeQuery = - "SELECT ?existingStartNode WHERE { \n" + - " ?role <" + roleToInterval + "> ?intervalNode . \n" + - " ?intervalNode a <" + intervalType + "> . \n" + - " ?intervalNode <" + intervalToStart + "> ?existingStartNode . \n" + - " ?existingStartNode a <" + dateTimeValueType + "> . } "; - - final static String existingEndNodeQuery = - "SELECT ?existingEndNode WHERE { \n" + - " ?role <" + roleToInterval + "> ?intervalNode . \n" + - " ?intervalNode a <" + intervalType + "> . \n" + - " ?intervalNode <" + intervalToEnd + "> ?existingEndNode . \n" + - " ?existingEndNode a <" + dateTimeValueType + "> .} "; - - final static String existingStartPrecisionQuery = - "SELECT ?existingStartPrecision WHERE { \n" + - " ?role <" + roleToInterval + "> ?intervalNode . \n" + - " ?intervalNode a <" + intervalType + "> . \n" + - " ?intervalNode <" + intervalToStart + "> ?startNode . \n" + - " ?startNode a <" + dateTimeValueType + "> . \n" + - " ?startNode <" + dateTimePrecision + "> ?existingStartPrecision . }"; - - final static String existingEndPrecisionQuery = - "SELECT ?existingEndPrecision WHERE { \n" + - " ?role <" + roleToInterval + "> ?intervalNode . \n" + - " ?intervalNode a <" + intervalType + "> . \n" + - " ?intervalNode <" + intervalToEnd + "> ?endNode . \n" + - " ?endNode a <" + dateTimeValueType + "> . \n" + - " ?endNode <" + dateTimePrecision + "> ?existingEndPrecision . }"; - -} - +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; + +import java.util.Arrays; + +import javax.servlet.http.HttpSession; + +import com.hp.hpl.jena.vocabulary.XSD; + +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.AutocompleteRequiredInputValidator; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeIntervalValidationVTwo; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.DateTimeWithPrecisionVTwo; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesWithParent; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation; + +public class AddPresenterRoleToPersonGenerator extends VivoBaseGenerator implements + EditConfigurationGenerator { + + final static String presentationClass = vivoCore + "Presentation"; + final static String roleClass = vivoCore + "PresenterRole"; + final static String conferenceClass = bibo + "Conference"; + final static String hasRolePred = "http://purl.obolibrary.org/obo/RO_0000053"; + final static String roleOfPred = "http://purl.obolibrary.org/obo/RO_0000052"; + final static String roleRealizedInPred = "http://purl.obolibrary.org/obo/BFO_0000054"; + final static String realizedRolePred = "http://purl.obolibrary.org/obo/BFO_0000055"; + final static String includesEventPred = "http://purl.obolibrary.org/obo/BFO_0000051"; + final static String eventWithinPred = "http://purl.obolibrary.org/obo/BFO_0000050"; + final static String roleToInterval = vivoCore + "dateTimeInterval"; + final static String intervalType = vivoCore + "DateTimeInterval"; + final static String intervalToStart = vivoCore + "start"; + final static String intervalToEnd = vivoCore + "end"; + final static String dateTimeValueType = vivoCore + "DateTimeValue"; + final static String dateTimeValue = vivoCore + "dateTime"; + final static String dateTimePrecision = vivoCore + "dateTimePrecision"; + + public AddPresenterRoleToPersonGenerator() {} + + @Override + public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, + HttpSession session) throws Exception { + + EditConfigurationVTwo conf = new EditConfigurationVTwo(); + + initBasics(conf, vreq); + initPropertyParameters(vreq, session, conf); + initObjectPropForm(conf, vreq); + + conf.setTemplate("addPresenterRoleToPerson.ftl"); + + conf.setVarNameForSubject("person"); + conf.setVarNameForPredicate("predicate"); + conf.setVarNameForObject("role"); + + conf.setN3Required( Arrays.asList( n3ForNewRole, + roleLabelAssertion) ); + conf.setN3Optional( Arrays.asList( n3ForNewPresentation, + n3ForExistingPresentation, + n3ForNewConferenceNewPres, + n3ForNewConferenceExistingPres, + n3ForExistingConferenceNewPres, + n3ForExistingConferenceExistingPres, + n3ForStart, + n3ForEnd ) ); + + conf.addNewResource("presentation", DEFAULT_NS_FOR_NEW_RESOURCE); + conf.addNewResource("newConference", DEFAULT_NS_FOR_NEW_RESOURCE); + conf.addNewResource("role", DEFAULT_NS_FOR_NEW_RESOURCE); + conf.addNewResource("intervalNode", DEFAULT_NS_FOR_NEW_RESOURCE); + conf.addNewResource("startNode", DEFAULT_NS_FOR_NEW_RESOURCE); + conf.addNewResource("endNode", DEFAULT_NS_FOR_NEW_RESOURCE); + + //uris in scope: none + //literals in scope: none + + conf.setUrisOnform(Arrays.asList("existingPresentation", "existingConference", "presentationType")); + conf.setLiteralsOnForm(Arrays.asList("presentationLabel", "presentationLabelDisplay", "conferenceLabel", "conferenceLabelDisplay", "roleLabel")); + + conf.addSparqlForExistingLiteral("presentationLabel", presentationLabelQuery); + conf.addSparqlForExistingLiteral("conferenceLabel", conferenceLabelQuery); + conf.addSparqlForExistingLiteral("roleLabel", roleLabelQuery); + conf.addSparqlForExistingUris("existingPresentation", presentationQuery); + conf.addSparqlForExistingUris("existingConference", existingConferenceQuery); + conf.addSparqlForExistingUris("presentationType", presentationTypeQuery); + conf.addSparqlForExistingLiteral( + "startField-value", existingStartDateQuery); + conf.addSparqlForExistingLiteral( + "endField-value", existingEndDateQuery); + conf.addSparqlForExistingUris( + "intervalNode", existingIntervalNodeQuery); + conf.addSparqlForExistingUris("startNode", existingStartNodeQuery); + conf.addSparqlForExistingUris("endNode", existingEndNodeQuery); + conf.addSparqlForExistingUris("startField-precision", + existingStartPrecisionQuery); + conf.addSparqlForExistingUris("endField-precision", + existingEndPrecisionQuery); + + conf.addField( new FieldVTwo(). // an autocomplete field + setName("existingPresentation") + ); + + conf.addField( new FieldVTwo(). + setName("presentationLabelDisplay") + .setRangeDatatypeUri( XSD.xstring.toString() ). + setValidators( list("datatype:" + XSD.xstring.toString()) ) + ); + + conf.addField( new FieldVTwo(). + setName("presentationLabel") + .setRangeDatatypeUri( XSD.xstring.toString() ). + setValidators( list("datatype:" + XSD.xstring.toString()) ) + ); + + conf.addField( new FieldVTwo(). + setName("presentationType"). + setValidators( list("nonempty") ). + setOptions( new ChildVClassesWithParent( + presentationClass)) + ); + + conf.addField( new FieldVTwo(). + setName("roleLabel") + .setRangeDatatypeUri( XSD.xstring.toString() ). + setValidators( list("nonempty") ) + ); + + conf.addField( new FieldVTwo(). // an autocomplete field + setName("existingConference") + ); + + conf.addField( new FieldVTwo(). + setName("conferenceLabel"). + setRangeDatatypeUri(XSD.xstring.toString() ) + ); + + conf.addField( new FieldVTwo(). + setName("conferenceLabelDisplay"). + setRangeDatatypeUri(XSD.xstring.toString() ) + ); + + conf.addField( new FieldVTwo().setName("startField"). + setEditElement( + new DateTimeWithPrecisionVTwo(null, + VitroVocabulary.Precision.YEAR.uri(), + VitroVocabulary.Precision.NONE.uri()) + ) + ); + + conf.addField( new FieldVTwo().setName("endField"). + setEditElement( + new DateTimeWithPrecisionVTwo(null, + VitroVocabulary.Precision.YEAR.uri(), + VitroVocabulary.Precision.NONE.uri()) + ) + ); + + conf.addValidator(new DateTimeIntervalValidationVTwo("startField","endField")); + conf.addValidator(new AntiXssValidation()); + conf.addValidator(new AutocompleteRequiredInputValidator("existingPresentation", "presentationLabel")); + prepare(vreq, conf); + return conf; + } + + /* N3 assertions */ + final static String n3ForNewRole = + "@prefix core: <" + vivoCore + "> . \n\n" + + "?person <" + hasRolePred + "> ?role . \n" + + "?role a <" + roleClass + "> . \n" + + "?role <" + roleOfPred + "> ?person . "; + + final static String roleLabelAssertion = + "?role <" + label + "> ?roleLabel ."; + + final static String n3ForNewPresentation = + "?role <" + roleRealizedInPred + "> ?presentation . \n" + + "?presentation <" + realizedRolePred + "> ?role . \n" + + "?presentation <" + label + "> ?presentationLabel . \n" + + "?presentation a ?presentationType ."; + + final static String n3ForExistingPresentation = + "?role <" + roleRealizedInPred + "> ?existingPresentation . \n" + + "?existingPresentation <" + realizedRolePred + "> ?role . \n" + + "?existingPresentation a ?presentationType ."; + + final static String n3ForNewConferenceNewPres = + "?presentation <" + eventWithinPred + "> ?newConference . \n" + + "?newConference <" + includesEventPred + "> ?presentation . \n" + + "?newConference a <" + conferenceClass + "> . \n" + + "?newConference <" + label + "> ?conferenceLabel ."; + + final static String n3ForNewConferenceExistingPres = + "?existingPresentation <" + eventWithinPred + "> ?newConference . \n" + + "?newConference <" + includesEventPred + "> ?existingPresentation . \n" + + "?newConference a <" + conferenceClass + "> . \n" + + "?newConference <" + label + "> ?conferenceLabel ."; + + final static String n3ForExistingConferenceNewPres = + "?existingConference <" + includesEventPred + "> ?presentation . \n" + + "?presentation <" + eventWithinPred + "> ?existingConference . \n" + + "?presentation <" + label + "> ?presentationLabel . "; + + final static String n3ForExistingConferenceExistingPres = + "?existingConference <" + includesEventPred + "> ?existingPresentation . \n" + + "?existingPresentation <" + eventWithinPred + "> ?existingConference . "; + + final static String n3ForStart = + "?role <" + roleToInterval + "> ?intervalNode . \n" + + "?intervalNode a <" + intervalType + "> . \n" + + "?intervalNode <" + intervalToStart + "> ?startNode . \n" + + "?startNode a <" + dateTimeValueType + "> . \n" + + "?startNode <" + dateTimeValue + "> ?startField-value . \n" + + "?startNode <" + dateTimePrecision + "> ?startField-precision . \n"; + + final static String n3ForEnd = + "?role <" + roleToInterval + "> ?intervalNode . \n" + + "?intervalNode a <" + intervalType + "> . \n" + + "?intervalNode <" + intervalToEnd + "> ?endNode . \n" + + "?endNode a <" + dateTimeValueType + "> . \n" + + "?endNode <" + dateTimeValue + "> ?endField-value . \n" + + "?endNode <" + dateTimePrecision + "> ?endField-precision . \n"; + + /* Queries for editing an existing entry */ + final static String roleLabelQuery = + "SELECT ?existingRoleLabel WHERE { \n" + + "?role <" + label + "> ?existingRoleLabel . }"; + + final static String presentationQuery = + "SELECT ?existingPresentation WHERE { \n" + + "?role <" + roleRealizedInPred + "> ?existingPresentation . }"; + + final static String presentationLabelQuery = + "SELECT ?existingPresentationLabel WHERE { \n" + + "?role <" + roleRealizedInPred + "> ?existingPresentation . " + + "?existingPresentation <" + label + "> ?existingPresentationLabel . }"; + + final static String presentationTypeQuery = + "PREFIX vitro: <" + VitroVocabulary.vitroURI + "> \n" + + "SELECT ?existingPresentationType WHERE { \n" + + "?role <" + roleRealizedInPred + "> ?existingPresentation . " + + "?existingPresentation vitro:mostSpecificType ?existingPresentationType . }"; + + final static String existingConferenceQuery = + "SELECT ?existingConference WHERE { \n" + + "?role <" + roleRealizedInPred + "> ?existingPresentation . " + + "?existingPresentation <" + eventWithinPred + "> ?existingConference . }"; + + final static String conferenceLabelQuery = + "SELECT ?existingConferenceLabel WHERE { \n" + + "?role <" + roleRealizedInPred + "> ?existingPresentation . " + + "?existingPresentation <" + eventWithinPred + "> ?existingConference . \n" + + "?existingConference <" + label + "> ?existingConferenceLabel . }"; + + final static String existingStartDateQuery = + "SELECT ?existingDateStart WHERE { \n" + + " ?role <" + roleToInterval + "> ?intervalNode . \n" + + " ?intervalNode a <" + intervalType + "> . \n" + + " ?intervalNode <" + intervalToStart + "> ?startNode . \n" + + " ?startNode a <" + dateTimeValueType +"> . \n" + + " ?startNode <" + dateTimeValue + "> ?existingDateStart . }"; + + final static String existingEndDateQuery = + "SELECT ?existingEndDate WHERE { \n" + + " ?role <" + roleToInterval + "> ?intervalNode . \n" + + " ?intervalNode a <" + intervalType + "> . \n " + + " ?intervalNode <" + intervalToEnd + "> ?endNode . \n" + + " ?endNode a <" + dateTimeValueType + "> . \n" + + " ?endNode <" + dateTimeValue + "> ?existingEndDate . }"; + + final static String existingIntervalNodeQuery = + "SELECT ?existingIntervalNode WHERE { \n" + + " ?role <" + roleToInterval + "> ?existingIntervalNode . \n" + + " ?existingIntervalNode a <" + intervalType + "> . }"; + + final static String existingStartNodeQuery = + "SELECT ?existingStartNode WHERE { \n" + + " ?role <" + roleToInterval + "> ?intervalNode . \n" + + " ?intervalNode a <" + intervalType + "> . \n" + + " ?intervalNode <" + intervalToStart + "> ?existingStartNode . \n" + + " ?existingStartNode a <" + dateTimeValueType + "> . } "; + + final static String existingEndNodeQuery = + "SELECT ?existingEndNode WHERE { \n" + + " ?role <" + roleToInterval + "> ?intervalNode . \n" + + " ?intervalNode a <" + intervalType + "> . \n" + + " ?intervalNode <" + intervalToEnd + "> ?existingEndNode . \n" + + " ?existingEndNode a <" + dateTimeValueType + "> .} "; + + final static String existingStartPrecisionQuery = + "SELECT ?existingStartPrecision WHERE { \n" + + " ?role <" + roleToInterval + "> ?intervalNode . \n" + + " ?intervalNode a <" + intervalType + "> . \n" + + " ?intervalNode <" + intervalToStart + "> ?startNode . \n" + + " ?startNode a <" + dateTimeValueType + "> . \n" + + " ?startNode <" + dateTimePrecision + "> ?existingStartPrecision . }"; + + final static String existingEndPrecisionQuery = + "SELECT ?existingEndPrecision WHERE { \n" + + " ?role <" + roleToInterval + "> ?intervalNode . \n" + + " ?intervalNode a <" + intervalType + "> . \n" + + " ?intervalNode <" + intervalToEnd + "> ?endNode . \n" + + " ?endNode a <" + dateTimeValueType + "> . \n" + + " ?endNode <" + dateTimePrecision + "> ?existingEndPrecision . }"; + +} +