Class ProcessRdfForm
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.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.
-
-
Constructor Summary
Constructors Constructor Description ProcessRdfForm(EditConfigurationVTwo config, NewURIMaker newURIMaker)Construct the ProcessRdfForm object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AdditionsAndRetractionsaddDependentDeletes(AdditionsAndRetractions changes, org.apache.jena.rdf.model.Model queryModel)static voidapplyChangesToWriteModel(AdditionsAndRetractions changes, org.apache.jena.rdf.model.Model queryModel, org.apache.jena.rdf.model.Model writeModel, String editorUri)protected AdditionsAndRetractionseditExistingStatements(EditConfigurationVTwo editConfig, MultiValueEditSubmission submission, VitroRequest vreq)Process an EditConfiguration to edit a set of existing statements.protected static AdditionsAndRetractionsgetMinimalChanges(AdditionsAndRetractions changes)protected voidlogSubstitue(String msg, List<String> requiredAsserts, List<String> optionalAsserts, List<String> requiredRetracts, List<String> optionalRetracts)protected AdditionsAndRetractionsparseN3ToChange(List<String> requiredAdds, List<String> optionalAdds, List<String> requiredDels, List<String> optionalDels, VitroRequest vreq, EditConfigurationVTwo editConfig)protected static List<org.apache.jena.rdf.model.Model>parseN3ToRDF(List<String> n3Strings, edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.ProcessRdfForm.N3ParseType parseType)Parse the n3Strings to a List of RDF Model objects.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)Parse the n3Strings to a List of RDF Model objects.AdditionsAndRetractionsprocess(EditConfigurationVTwo configuration, MultiValueEditSubmission submission, VitroRequest vreq)This detects if this is an edit of an existing statement or an edit to create a new statement or set of statements.protected voidsubInValuesToN3(EditConfigurationVTwo editConfig, MultiValueEditSubmission submission, List<String> requiredAsserts, List<String> optionalAsserts, List<String> requiredRetracts, List<String> optionalRetracts, VitroRequest vreq)protected voidsubstituteInSubPredObjURIs(EditConfigurationVTwo configuration, List<String>... n3StrLists)Map<String,String>URIsForNewRsources(EditConfigurationVTwo configuration, NewURIMaker newURIMaker)
-
-
-
Constructor Detail
-
ProcessRdfForm
public ProcessRdfForm(EditConfigurationVTwo config, NewURIMaker newURIMaker)
Construct the ProcessRdfForm object.
-
-
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.
-
substituteInSubPredObjURIs
protected void substituteInSubPredObjURIs(EditConfigurationVTwo configuration, List<String>... n3StrLists)
-
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
-
subInValuesToN3
protected void subInValuesToN3(EditConfigurationVTwo editConfig, MultiValueEditSubmission submission, List<String> requiredAsserts, List<String> optionalAsserts, List<String> requiredRetracts, List<String> optionalRetracts, VitroRequest vreq) throws InsertException
- Throws:
InsertException
-
addDependentDeletes
public static AdditionsAndRetractions addDependentDeletes(AdditionsAndRetractions changes, org.apache.jena.rdf.model.Model queryModel)
-
applyChangesToWriteModel
public static void applyChangesToWriteModel(AdditionsAndRetractions changes, org.apache.jena.rdf.model.Model queryModel, org.apache.jena.rdf.model.Model writeModel, String editorUri)
-
parseN3ToChange
protected AdditionsAndRetractions parseN3ToChange(List<String> requiredAdds, List<String> optionalAdds, List<String> requiredDels, List<String> optionalDels, VitroRequest vreq, EditConfigurationVTwo editConfig) throws Exception
- 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, String linguisticContext) throws Exception
Parse the n3Strings to a List of RDF Model objects.- Parameters:
n3Strings- N3 Strings to parseparseType- if OPTIONAL, then don't throw exceptions on errorslinguisticContext- 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 parseparseType- if OPTIONAL, then don't throw exceptions on errors If REQUIRED, then throw exceptions on errors.- Throws:
Exception
-
logSubstitue
protected void logSubstitue(String msg, List<String> requiredAsserts, List<String> optionalAsserts, List<String> requiredRetracts, List<String> optionalRetracts)
-
getMinimalChanges
protected static AdditionsAndRetractions getMinimalChanges(AdditionsAndRetractions changes)
-
URIsForNewRsources
public Map<String,String> URIsForNewRsources(EditConfigurationVTwo configuration, NewURIMaker newURIMaker) throws InsertException
- Throws:
InsertException
-
-