Class ProcessRdfForm


  • public class ProcessRdfForm
    extends Object
    The goal of this class is to provide processing from an EditConfiguration and an EditSubmission to produce a set of additions and retractions. When working with the default object property form or the default data property from, the way to avoid having any optional N3 is to originally configure the configuration.setN3Optional() to be empty.
    • Method Detail

      • process

        public AdditionsAndRetractions process​(EditConfigurationVTwo configuration,
                                               MultiValueEditSubmission submission,
                                               VitroRequest vreq)
                                        throws Exception
        This detects if this is an edit of an existing statement or an edit to create a new statement or set of statements. Then the correct method will be called to convert the EditConfiguration and EditSubmission into a set of additions and retractions. This will handle data property editing, object property editing and general editing. The submission object will be modified to have its entityToReturnTo string substituted with the values from the processing.
        Throws:
        Exception - May throw an exception if Required N3 does not parse correctly.
      • editExistingStatements

        protected AdditionsAndRetractions editExistingStatements​(EditConfigurationVTwo editConfig,
                                                                 MultiValueEditSubmission submission,
                                                                 VitroRequest vreq)
                                                          throws Exception
        Process an EditConfiguration to edit a set of existing statements. This will handle data property editing, object property editing and general editing. No longer checking if field has changed, because assertions and retractions are mutually diff'ed before statements are added to or removed from the model. The explicit change check can cause problems in more complex setups, like the automatic form building in DataStaR.
        Parameters:
        vreq - For getting linguistic context
        Throws:
        Exception
      • applyChangesToWriteModel

        public static void applyChangesToWriteModel​(AdditionsAndRetractions changes,
                                                    org.apache.jena.rdf.model.Model queryModel,
                                                    org.apache.jena.rdf.model.Model writeModel,
                                                    String editorUri)
      • parseN3ToRDF

        protected static List<org.apache.jena.rdf.model.Model> parseN3ToRDF​(List<String> n3Strings,
                                                                            edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.ProcessRdfForm.N3ParseType parseType,
                                                                            String linguisticContext)
                                                                     throws Exception
        Parse the n3Strings to a List of RDF Model objects.
        Parameters:
        n3Strings - N3 Strings to parse
        parseType - if OPTIONAL, then don't throw exceptions on errors
        linguisticContext - For Literals, Making parse only if the literal linguisticContext are same than linguisticContext parameter //UQAM If REQUIRED, then throw exceptions on errors.
        Throws:
        Exception
      • parseN3ToRDF

        protected static List<org.apache.jena.rdf.model.Model> parseN3ToRDF​(List<String> n3Strings,
                                                                            edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.ProcessRdfForm.N3ParseType parseType)
                                                                     throws Exception
        Parse the n3Strings to a List of RDF Model objects.
        Parameters:
        n3Strings - N3 Strings to parse
        parseType - if OPTIONAL, then don't throw exceptions on errors If REQUIRED, then throw exceptions on errors.
        Throws:
        Exception