Add dependent resources annotation to back end editing for object properties. NIHVIVO-212
This commit is contained in:
parent
2ff288b4b1
commit
e50a1bc6f5
13 changed files with 73 additions and 32 deletions
|
@ -73,7 +73,7 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
||||||
|
|
||||||
private boolean selectFromExisting = true;
|
private boolean selectFromExisting = true;
|
||||||
private boolean offerCreateNewOption = false;
|
private boolean offerCreateNewOption = false;
|
||||||
private boolean forceStubObjectDeletion = false;
|
private boolean stubObjectRelation = false;
|
||||||
|
|
||||||
private boolean collateBySubclass = false;
|
private boolean collateBySubclass = false;
|
||||||
|
|
||||||
|
@ -363,12 +363,12 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
||||||
this.offerCreateNewOption = b;
|
this.offerCreateNewOption = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getForceStubObjectDeletion() {
|
public boolean getStubObjectRelation() {
|
||||||
return forceStubObjectDeletion;
|
return stubObjectRelation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setForceStubObjectDeletion(boolean b) {
|
public void setStubObjectRelation(boolean b) {
|
||||||
this.forceStubObjectDeletion = b;
|
this.stubObjectRelation = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class PropertyEditController extends BaseEditController {
|
||||||
results.add(p.getCustomEntryForm() == null ? "unspecified" : p.getCustomEntryForm()); // column 13
|
results.add(p.getCustomEntryForm() == null ? "unspecified" : p.getCustomEntryForm()); // column 13
|
||||||
results.add(p.getSelectFromExisting() ? "true" : "false"); // column 14
|
results.add(p.getSelectFromExisting() ? "true" : "false"); // column 14
|
||||||
results.add(p.getOfferCreateNewOption() ? "true" : "false"); // column 15
|
results.add(p.getOfferCreateNewOption() ? "true" : "false"); // column 15
|
||||||
results.add(p.getForceStubObjectDeletion() ? "true" : "false"); // column 16
|
results.add(p.getStubObjectRelation() ? "true" : "false"); // column 16
|
||||||
results.add(p.getURI()); // column 17
|
results.add(p.getURI()); // column 17
|
||||||
request.setAttribute("results",results);
|
request.setAttribute("results",results);
|
||||||
request.setAttribute("columncount",NUM_COLS);
|
request.setAttribute("columncount",NUM_COLS);
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class PropertyRetryController extends BaseEditController {
|
||||||
request.setAttribute("inverseFunctional",propertyForEditing.getInverseFunctional());
|
request.setAttribute("inverseFunctional",propertyForEditing.getInverseFunctional());
|
||||||
request.setAttribute("selectFromExisting",propertyForEditing.getSelectFromExisting());
|
request.setAttribute("selectFromExisting",propertyForEditing.getSelectFromExisting());
|
||||||
request.setAttribute("offerCreateNewOption", propertyForEditing.getOfferCreateNewOption());
|
request.setAttribute("offerCreateNewOption", propertyForEditing.getOfferCreateNewOption());
|
||||||
request.setAttribute("forceStubObjectDeletion", propertyForEditing.getForceStubObjectDeletion());
|
request.setAttribute("stubObjectRelation", propertyForEditing.getStubObjectRelation());
|
||||||
request.setAttribute("collateBySubclass", propertyForEditing.getCollateBySubclass());
|
request.setAttribute("collateBySubclass", propertyForEditing.getCollateBySubclass());
|
||||||
|
|
||||||
//checkboxes are pretty annoying : we don't know if someone *unchecked* a box, so we have to default to false on updates.
|
//checkboxes are pretty annoying : we don't know if someone *unchecked* a box, so we have to default to false on updates.
|
||||||
|
@ -202,7 +202,7 @@ public class PropertyRetryController extends BaseEditController {
|
||||||
propertyForEditing.setInverseFunctional(false);
|
propertyForEditing.setInverseFunctional(false);
|
||||||
propertyForEditing.setSelectFromExisting(false);
|
propertyForEditing.setSelectFromExisting(false);
|
||||||
propertyForEditing.setOfferCreateNewOption(false);
|
propertyForEditing.setOfferCreateNewOption(false);
|
||||||
propertyForEditing.setForceStubObjectDeletion(false);
|
propertyForEditing.setStubObjectRelation(false);
|
||||||
propertyForEditing.setCollateBySubclass(false);
|
propertyForEditing.setCollateBySubclass(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,6 @@ public class VitroVocabulary {
|
||||||
public static final String PROPERTY_OBJECTINDIVIDUALSORTPROPERTY = vitroURI+"objectIndividualSortProperty";
|
public static final String PROPERTY_OBJECTINDIVIDUALSORTPROPERTY = vitroURI+"objectIndividualSortProperty";
|
||||||
public static final String PROPERTY_FULLPROPERTYNAMEANNOT = vitroURI+"fullPropertyNameAnnot";
|
public static final String PROPERTY_FULLPROPERTYNAMEANNOT = vitroURI+"fullPropertyNameAnnot";
|
||||||
public static final String PROPERTY_CUSTOMSEARCHVIEWANNOT = vitroURI+"customSearchViewAnnot";
|
public static final String PROPERTY_CUSTOMSEARCHVIEWANNOT = vitroURI+"customSearchViewAnnot";
|
||||||
public static final String PROPERTY_FORCESTUBDELETIONANNOT = vitroURI+"forceStubDeletionAnnot";
|
|
||||||
//public static final String PROPERTY_SELFEDITPROHIBITEDANNOT = vitroURI+"selfEditProhibitedAnnot";
|
//public static final String PROPERTY_SELFEDITPROHIBITEDANNOT = vitroURI+"selfEditProhibitedAnnot";
|
||||||
//public static final String PROPERTY_CURATOREDITPROHIBITEDANNOT = vitroURI+"curatorEditProhibitedAnnot";
|
//public static final String PROPERTY_CURATOREDITPROHIBITEDANNOT = vitroURI+"curatorEditProhibitedAnnot";
|
||||||
public static final String PROPERTY_CUSTOMENTRYFORMANNOT = vitroURI+"customEntryFormAnnot";
|
public static final String PROPERTY_CUSTOMENTRYFORMANNOT = vitroURI+"customEntryFormAnnot";
|
||||||
|
@ -112,7 +111,7 @@ public class VitroVocabulary {
|
||||||
public static final String PROPERTYGROUP = vitroURI + "PropertyGroup";
|
public static final String PROPERTYGROUP = vitroURI + "PropertyGroup";
|
||||||
public static final String MASKS_PROPERTY = vitroURI + "masksProperty";
|
public static final String MASKS_PROPERTY = vitroURI + "masksProperty";
|
||||||
public static final String SKIP_EDIT_FORM = vitroURI + "skipEditForm";
|
public static final String SKIP_EDIT_FORM = vitroURI + "skipEditForm";
|
||||||
public static final String PROPERTY_DEPENDENCYPROPERTYANNOT = vitroURI + "dependencyPropertyAnnot";
|
public static final String PROPERTY_STUBOBJECTPROPERTYANNOT = vitroURI + "stubObjectPropertyAnnot";
|
||||||
public static final String PROPERTY_COLLATEBYSUBCLASSANNOT = vitroURI + "collateBySubclassAnnot";
|
public static final String PROPERTY_COLLATEBYSUBCLASSANNOT = vitroURI + "collateBySubclassAnnot";
|
||||||
|
|
||||||
// ================== keyword related ==================================
|
// ================== keyword related ==================================
|
||||||
|
|
|
@ -545,13 +545,13 @@ public class ObjectPropertyFiltering extends ObjectProperty {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getForceStubObjectDeletion() {
|
public boolean getStubObjectRelation() {
|
||||||
return innerObjectProperty.getForceStubObjectDeletion();
|
return innerObjectProperty.getStubObjectRelation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setForceStubObjectDeletion(boolean b) {
|
public void setStubObjectRelation(boolean b) {
|
||||||
innerObjectProperty.setForceStubObjectDeletion(b);
|
innerObjectProperty.setStubObjectRelation(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class DependentResourceDeleteJena {
|
||||||
private static boolean isPredicateDependencyRelation( Property predicate , Model model){
|
private static boolean isPredicateDependencyRelation( Property predicate , Model model){
|
||||||
return model.containsLiteral(
|
return model.containsLiteral(
|
||||||
model.getResource(predicate.getURI()),
|
model.getResource(predicate.getURI()),
|
||||||
model.createProperty(VitroVocabulary.PROPERTY_DEPENDENCYPROPERTYANNOT),
|
model.createProperty(VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class JenaBaseDaoCon {
|
||||||
public JenaBaseDaoCon() {
|
public JenaBaseDaoCon() {
|
||||||
LINK.addProperty(PROPERTY_CUSTOMSHORTVIEWANNOT, _constModel.createTypedLiteral("linkShortView.jsp"));
|
LINK.addProperty(PROPERTY_CUSTOMSHORTVIEWANNOT, _constModel.createTypedLiteral("linkShortView.jsp"));
|
||||||
PRIMARY_LINK.setLabel("Primary Link", "en-US");
|
PRIMARY_LINK.setLabel("Primary Link", "en-US");
|
||||||
PRIMARY_LINK.addProperty(PROPERTY_FORCESTUBDELETIONANNOT,_constModel.createTypedLiteral(true));
|
PRIMARY_LINK.addProperty(PROPERTY_STUBOBJECTPROPERTYANNOT,_constModel.createTypedLiteral(true));
|
||||||
PRIMARY_LINK.addProperty(PROPERTY_CUSTOMENTRYFORMANNOT, _constModel.createTypedLiteral("defaultLinkForm.jsp"));
|
PRIMARY_LINK.addProperty(PROPERTY_CUSTOMENTRYFORMANNOT, _constModel.createTypedLiteral("defaultLinkForm.jsp"));
|
||||||
PRIMARY_LINK.setRange(LINK);
|
PRIMARY_LINK.setRange(LINK);
|
||||||
PRIMARY_LINK.addProperty(PROPERTY_OFFERCREATENEWOPTIONANNOT, _constModel.createTypedLiteral(true));
|
PRIMARY_LINK.addProperty(PROPERTY_OFFERCREATENEWOPTIONANNOT, _constModel.createTypedLiteral(true));
|
||||||
|
@ -25,7 +25,7 @@ public class JenaBaseDaoCon {
|
||||||
|
|
||||||
ADDITIONAL_LINK.setLabel("Additional Link", "en-US");
|
ADDITIONAL_LINK.setLabel("Additional Link", "en-US");
|
||||||
ADDITIONAL_LINK.setRange(LINK); //apparently does not work to have prop.getRangeVClass() return a non-null VClass
|
ADDITIONAL_LINK.setRange(LINK); //apparently does not work to have prop.getRangeVClass() return a non-null VClass
|
||||||
ADDITIONAL_LINK.addProperty(PROPERTY_FORCESTUBDELETIONANNOT,_constModel.createTypedLiteral(true));
|
ADDITIONAL_LINK.addProperty(PROPERTY_STUBOBJECTPROPERTYANNOT,_constModel.createTypedLiteral(true));
|
||||||
ADDITIONAL_LINK.addProperty(PROPERTY_CUSTOMENTRYFORMANNOT, _constModel.createTypedLiteral("defaultLinkForm.jsp"));
|
ADDITIONAL_LINK.addProperty(PROPERTY_CUSTOMENTRYFORMANNOT, _constModel.createTypedLiteral("defaultLinkForm.jsp"));
|
||||||
ADDITIONAL_LINK.addProperty(PROPERTY_OFFERCREATENEWOPTIONANNOT, _constModel.createTypedLiteral(true));
|
ADDITIONAL_LINK.addProperty(PROPERTY_OFFERCREATENEWOPTIONANNOT, _constModel.createTypedLiteral(true));
|
||||||
ADDITIONAL_LINK.addProperty(PROPERTY_SELECTFROMEXISTINGANNOT, _constModel.createTypedLiteral(false));
|
ADDITIONAL_LINK.addProperty(PROPERTY_SELECTFROMEXISTINGANNOT, _constModel.createTypedLiteral(false));
|
||||||
|
@ -76,11 +76,13 @@ public class JenaBaseDaoCon {
|
||||||
protected AnnotationProperty PROPERTY_CUSTOMDISPLAYVIEWANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_CUSTOMDISPLAYVIEWANNOT);
|
protected AnnotationProperty PROPERTY_CUSTOMDISPLAYVIEWANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_CUSTOMDISPLAYVIEWANNOT);
|
||||||
protected AnnotationProperty PROPERTY_CUSTOMSHORTVIEWANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_CUSTOMSHORTVIEWANNOT);
|
protected AnnotationProperty PROPERTY_CUSTOMSHORTVIEWANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_CUSTOMSHORTVIEWANNOT);
|
||||||
protected AnnotationProperty PROPERTY_CUSTOMSEARCHVIEWANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_CUSTOMSEARCHVIEWANNOT);
|
protected AnnotationProperty PROPERTY_CUSTOMSEARCHVIEWANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_CUSTOMSEARCHVIEWANNOT);
|
||||||
protected AnnotationProperty PROPERTY_FORCESTUBDELETIONANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_FORCESTUBDELETIONANNOT);
|
//protected AnnotationProperty PROPERTY_FORCESTUBDELETIONANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_FORCESTUBDELETIONANNOT);
|
||||||
protected AnnotationProperty PROPERTY_SELECTFROMEXISTINGANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_SELECTFROMEXISTINGANNOT);
|
protected AnnotationProperty PROPERTY_SELECTFROMEXISTINGANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_SELECTFROMEXISTINGANNOT);
|
||||||
protected AnnotationProperty PROPERTY_OFFERCREATENEWOPTIONANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_OFFERCREATENEWOPTIONANNOT);
|
protected AnnotationProperty PROPERTY_OFFERCREATENEWOPTIONANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_OFFERCREATENEWOPTIONANNOT);
|
||||||
protected AnnotationProperty PROPERTY_INPROPERTYGROUPANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_INPROPERTYGROUPANNOT);
|
protected AnnotationProperty PROPERTY_INPROPERTYGROUPANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_INPROPERTYGROUPANNOT);
|
||||||
protected AnnotationProperty PROPERTY_COLLATEBYSUBCLASSANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_COLLATEBYSUBCLASSANNOT);
|
protected AnnotationProperty PROPERTY_COLLATEBYSUBCLASSANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_COLLATEBYSUBCLASSANNOT);
|
||||||
|
protected AnnotationProperty PROPERTY_STUBOBJECTPROPERTYANNOT = _constModel.createAnnotationProperty(VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT);
|
||||||
|
|
||||||
protected OntClass PROPERTYGROUP = _constModel.createClass(VitroVocabulary.PROPERTYGROUP);
|
protected OntClass PROPERTYGROUP = _constModel.createClass(VitroVocabulary.PROPERTYGROUP);
|
||||||
|
|
||||||
protected OntClass KEYWORD = _constModel.createClass(VitroVocabulary.KEYWORD);
|
protected OntClass KEYWORD = _constModel.createClass(VitroVocabulary.KEYWORD);
|
||||||
|
|
|
@ -220,8 +220,8 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
p.setSelectFromExisting(selectFromObj==null ? true : selectFromObj);
|
p.setSelectFromExisting(selectFromObj==null ? true : selectFromObj);
|
||||||
Boolean offerCreateObj = getPropertyBooleanValue(op,PROPERTY_OFFERCREATENEWOPTIONANNOT);
|
Boolean offerCreateObj = getPropertyBooleanValue(op,PROPERTY_OFFERCREATENEWOPTIONANNOT);
|
||||||
p.setOfferCreateNewOption(offerCreateObj==null ? false : offerCreateObj);
|
p.setOfferCreateNewOption(offerCreateObj==null ? false : offerCreateObj);
|
||||||
Boolean forceStubObjectDeletionObj = getPropertyBooleanValue(op,PROPERTY_FORCESTUBDELETIONANNOT);
|
Boolean dependencyDeletionObj = getPropertyBooleanValue(op,PROPERTY_STUBOBJECTPROPERTYANNOT);
|
||||||
p.setForceStubObjectDeletion(forceStubObjectDeletionObj==null ? false : forceStubObjectDeletionObj);
|
p.setStubObjectRelation(dependencyDeletionObj==null ? false : dependencyDeletionObj);
|
||||||
|
|
||||||
Boolean collateBySubclass = getPropertyBooleanValue(op,PROPERTY_COLLATEBYSUBCLASSANNOT);
|
Boolean collateBySubclass = getPropertyBooleanValue(op,PROPERTY_COLLATEBYSUBCLASSANNOT);
|
||||||
p.setCollateBySubclass(collateBySubclass==null ? false : collateBySubclass);
|
p.setCollateBySubclass(collateBySubclass==null ? false : collateBySubclass);
|
||||||
|
@ -604,7 +604,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
updatePropertyStringValue(p,PROPERTY_CUSTOMENTRYFORMANNOT,prop.getCustomEntryForm(),ontModel);
|
updatePropertyStringValue(p,PROPERTY_CUSTOMENTRYFORMANNOT,prop.getCustomEntryForm(),ontModel);
|
||||||
updatePropertyBooleanValue(p,PROPERTY_SELECTFROMEXISTINGANNOT,prop.getSelectFromExisting(),ontModel,JenaBaseDao.KEEP_ONLY_IF_FALSE);
|
updatePropertyBooleanValue(p,PROPERTY_SELECTFROMEXISTINGANNOT,prop.getSelectFromExisting(),ontModel,JenaBaseDao.KEEP_ONLY_IF_FALSE);
|
||||||
updatePropertyBooleanValue(p,PROPERTY_OFFERCREATENEWOPTIONANNOT,prop.getOfferCreateNewOption(),ontModel,JenaBaseDao.KEEP_ONLY_IF_TRUE);
|
updatePropertyBooleanValue(p,PROPERTY_OFFERCREATENEWOPTIONANNOT,prop.getOfferCreateNewOption(),ontModel,JenaBaseDao.KEEP_ONLY_IF_TRUE);
|
||||||
updatePropertyBooleanValue(p,PROPERTY_FORCESTUBDELETIONANNOT,prop.getForceStubObjectDeletion(),ontModel,JenaBaseDao.KEEP_ONLY_IF_TRUE);
|
updatePropertyBooleanValue(p,PROPERTY_STUBOBJECTPROPERTYANNOT,prop.getStubObjectRelation(),ontModel,JenaBaseDao.KEEP_ONLY_IF_TRUE);
|
||||||
updatePropertyBooleanValue(p,PROPERTY_COLLATEBYSUBCLASSANNOT,prop.getCollateBySubclass(),ontModel,JenaBaseDao.KEEP_ONLY_IF_TRUE);
|
updatePropertyBooleanValue(p,PROPERTY_COLLATEBYSUBCLASSANNOT,prop.getCollateBySubclass(),ontModel,JenaBaseDao.KEEP_ONLY_IF_TRUE);
|
||||||
try {
|
try {
|
||||||
p.removeAll(PROPERTY_INPROPERTYGROUPANNOT);
|
p.removeAll(PROPERTY_INPROPERTYGROUPANNOT);
|
||||||
|
|
|
@ -18,10 +18,10 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
|
||||||
public class DependentResourceDeleteJenaTest {
|
public class DependentResourceDeleteJenaTest {
|
||||||
String isDependentRelation =
|
String isDependentRelation =
|
||||||
" <"+VitroVocabulary.PROPERTY_DEPENDENCYPROPERTYANNOT+"> \"true\"^^xsd:boolean .\n" ;
|
" <"+VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT+"> \"true\"^^xsd:boolean .\n" ;
|
||||||
|
|
||||||
String nosePropIsDependentRel =
|
String nosePropIsDependentRel =
|
||||||
"<"+VitroVocabulary.PROPERTY_DEPENDENCYPROPERTYANNOT+"> rdf:type owl:AnnotationProperty .\n" +
|
"<"+VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT+"> rdf:type owl:AnnotationProperty .\n" +
|
||||||
" ex:hasNose " + isDependentRelation;
|
" ex:hasNose " + isDependentRelation;
|
||||||
|
|
||||||
String prefixesN3 =
|
String prefixesN3 =
|
||||||
|
|
|
@ -33,10 +33,10 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
|
|
||||||
public class JenaBaseDaoTest {
|
public class JenaBaseDaoTest {
|
||||||
String isDependentRelation =
|
String isDependentRelation =
|
||||||
" <"+VitroVocabulary.PROPERTY_DEPENDENCYPROPERTYANNOT+"> \"true\"^^xsd:boolean .\n" ;
|
" <"+VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT+"> \"true\"^^xsd:boolean .\n" ;
|
||||||
|
|
||||||
String nosePropIsDependentRel =
|
String nosePropIsDependentRel =
|
||||||
"<"+VitroVocabulary.PROPERTY_DEPENDENCYPROPERTYANNOT+"> rdf:type owl:AnnotationProperty .\n" +
|
"<"+VitroVocabulary.PROPERTY_STUBOBJECTPROPERTYANNOT+"> rdf:type owl:AnnotationProperty .\n" +
|
||||||
" ex:hasNose " + isDependentRelation;
|
" ex:hasNose " + isDependentRelation;
|
||||||
|
|
||||||
String prefixesN3 =
|
String prefixesN3 =
|
||||||
|
@ -104,7 +104,7 @@ public class JenaBaseDaoTest {
|
||||||
"<http://example.com/prop1> " +
|
"<http://example.com/prop1> " +
|
||||||
" a owl:ObjectProperty ; " +
|
" a owl:ObjectProperty ; " +
|
||||||
" rdfs:label \"Prop 1 Dependent Relation\" ; " +
|
" rdfs:label \"Prop 1 Dependent Relation\" ; " +
|
||||||
" <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#dependencyPropertyAnnot> \"true\"^^xsd:boolean ." ;
|
isDependentRelation ;
|
||||||
|
|
||||||
Model expectedModel = (ModelFactory.createOntologyModel()).read(new StringReader(expected), "", "N3");
|
Model expectedModel = (ModelFactory.createOntologyModel()).read(new StringReader(expected), "", "N3");
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ public class JenaBaseDaoTest {
|
||||||
"<http://example.com/prop1> " +
|
"<http://example.com/prop1> " +
|
||||||
" a owl:ObjectProperty ; " +
|
" a owl:ObjectProperty ; " +
|
||||||
" rdfs:label \"Prop 1 Dependent Relation\" ; " +
|
" rdfs:label \"Prop 1 Dependent Relation\" ; " +
|
||||||
" <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#dependencyPropertyAnnot> \"true\"^^xsd:boolean ." ;
|
isDependentRelation ;
|
||||||
|
|
||||||
Model expectedModel = (ModelFactory.createOntologyModel()).read(new StringReader(expected), "", "N3");
|
Model expectedModel = (ModelFactory.createOntologyModel()).read(new StringReader(expected), "", "N3");
|
||||||
|
|
||||||
|
@ -193,6 +193,11 @@ public class JenaBaseDaoTest {
|
||||||
wipeOutModTime(expectedModel);
|
wipeOutModTime(expectedModel);
|
||||||
wipeOutModTime(model);
|
wipeOutModTime(model);
|
||||||
|
|
||||||
|
System.out.println("expected Model" );
|
||||||
|
expectedModel.write(System.out,"N3");
|
||||||
|
System.out.println("result model");
|
||||||
|
model.write(System.out,"N3");
|
||||||
|
|
||||||
Assert.assertTrue( model.isIsomorphicWith(expectedModel));
|
Assert.assertTrue( model.isIsomorphicWith(expectedModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,4 +49,39 @@ public class ObjectPropertyDaoJenaTest {
|
||||||
Assert.fail(e.getMessage());
|
Assert.fail(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStubObjectProperty(){
|
||||||
|
/* Check that we can save collateBySubclass */
|
||||||
|
OntModel model = ModelFactory.createOntologyModel();
|
||||||
|
WebappDaoFactory wdf = new WebappDaoFactoryJena(model);
|
||||||
|
|
||||||
|
ObjectProperty op1 = new ObjectProperty();
|
||||||
|
String propURI = "http://example.com/testObjectProp" ;
|
||||||
|
op1.setURI(propURI);
|
||||||
|
Assert.assertFalse(op1.getStubObjectRelation());
|
||||||
|
try {
|
||||||
|
wdf.getObjectPropertyDao().insertObjectProperty(op1);
|
||||||
|
ObjectProperty op2 = wdf.getObjectPropertyDao().getObjectPropertyByURI(propURI);
|
||||||
|
Assert.assertNotNull(op2);
|
||||||
|
Assert.assertFalse(op2.getStubObjectRelation());
|
||||||
|
|
||||||
|
op2.setStubObjectRelation(true);
|
||||||
|
wdf.getObjectPropertyDao().updateObjectProperty(op2);
|
||||||
|
|
||||||
|
ObjectProperty op3 = wdf.getObjectPropertyDao().getObjectPropertyByURI(propURI);
|
||||||
|
Assert.assertNotNull(op3);
|
||||||
|
Assert.assertTrue(op3.getStubObjectRelation());
|
||||||
|
|
||||||
|
op3.setStubObjectRelation(false);
|
||||||
|
wdf.getObjectPropertyDao().updateObjectProperty(op3);
|
||||||
|
|
||||||
|
ObjectProperty op4 = wdf.getObjectPropertyDao().getObjectPropertyByURI(propURI);
|
||||||
|
Assert.assertNotNull(op4);
|
||||||
|
Assert.assertFalse(op4.getStubObjectRelation());
|
||||||
|
|
||||||
|
} catch (InsertException e) {
|
||||||
|
Assert.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public WebappDaoFactory getUnfilteredDaoFactory() {
|
||||||
String editorUri = EditN3Utils.getEditorUri(request,session,application);
|
String editorUri = EditN3Utils.getEditorUri(request,session,application);
|
||||||
wdf = wdf.getUserAwareDaoFactory(editorUri);
|
wdf = wdf.getUserAwareDaoFactory(editorUri);
|
||||||
|
|
||||||
if (prop.getForceStubObjectDeletion()) {
|
if (prop.getStubObjectRelation()) {
|
||||||
Individual object = (Individual)request.getAttribute("object");
|
Individual object = (Individual)request.getAttribute("object");
|
||||||
if (object==null) {
|
if (object==null) {
|
||||||
object = getUnfilteredDaoFactory().getIndividualDao().getIndividualByURI(objectUri);
|
object = getUnfilteredDaoFactory().getIndividualDao().getIndividualByURI(objectUri);
|
||||||
|
|
|
@ -216,14 +216,14 @@
|
||||||
<td valign="bottom" colspan="1">
|
<td valign="bottom" colspan="1">
|
||||||
<em><strong>Caution:</strong>delete object when statement deleted?</em><br />
|
<em><strong>Caution:</strong>delete object when statement deleted?</em><br />
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${forceStubObjectDeletion}">
|
<c:when test="${stubObjectRelation}">
|
||||||
<input name="ForceStubObjectDeletion" type="checkbox" value="TRUE" checked="checked"/>force deletion
|
<input name="StubObjectRelation" type="checkbox" value="TRUE" checked="checked"/>stub object relation with force delete
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
<input name="ForceStubObjectDeletion" type="checkbox" value="TRUE"/>force deletion
|
<input name="StubObjectRelation" type="checkbox" value="TRUE"/>stub object relation with force delete
|
||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
<font size="2" color="red"><form:error name="ForceStubObjectDeletion"/></font>
|
<font size="2" color="red"><form:error name="stubObjectRelation"/></font>
|
||||||
</td>
|
</td>
|
||||||
<td valign="bottom" colspan="1">
|
<td valign="bottom" colspan="1">
|
||||||
<em>select from existing choices when adding statements?</em><br />
|
<em>select from existing choices when adding statements?</em><br />
|
||||||
|
|
Loading…
Add table
Reference in a new issue