buda-base / editor-templates

SHACL templates for the BUDA editor
MIT License
1 stars 0 forks source link

encoding the type of property in BUDA #12

Closed eroux closed 4 years ago

eroux commented 4 years ago

This is something that is specific to our architecture, as it has to do with the way we organize our graphs, files, etc. and not with the data itself. It would be important for the Java code to have a property on propertyshapes that indicates the way BUDA handles the presence or not of the object in the graph. I think we have four cases:

  1. external entities, that are not supposed to be found in the graph (ex: bdr:GenderMale, or teachers and students of a person)
  2. intermediate nodes / facets, that are in the graph (ex: names or titles)
  3. general internal entities, which are in the same graph and and that we want to edit as part of the edition of the root entity, such as image groups for image instances, or admin data
  4. specific internal entities that we don't want to generally edit at the same time as the general entity for UI reasons, such as the objects of bdo:hasPart, bdo:partOf, bdo:inRootInstance and bdo:contentLocationInstance, in other words, these are links we don't want to editor to follow in the same window

@xristy do you think we could create properties for these? That would allow the getFocusGraph() to be implemented. I think we could rename it to getEditorGraph() actually...

xristy commented 4 years ago

TopQ_ValidateFacets illustrates performing cases 2. and 3. using a ValidationEngine method for that purpose.

As committed it validates all and only the occurrences of PersonName for P707.

eroux commented 4 years ago

great thanks! Now we need a way to automate the test so that the property bdo:personName is not hardcoded in the code. I think it having a property bds:followInGraph would solve the problems, as we discussed. A caveat in the code is that it will be attached to inverse properties, such as adm:adminAbout, but we can handle that in a second iteration

eroux commented 4 years ago

@xristy what do you think of adding the property? Worse case scenario we remove it later...

xristy commented 4 years ago

I've been working in this and the essential idea is:

bds:nodeShapeType :  sh:NodeShape  =>  bds:NodeShapeType

bds:NodeShapeType a owl:Class .

bds:FacetShape    a bds:NodeShapeType .
bds:InternalShape a bds:NodeShapeType .
bds:IgnoredShape  a bds:NodeShapeType .

these defns go in the root shapes ontology, http://purl.bdrc.io/shapes/core/CoreShapes/.

Then:

Property prop = ResourceFactory.createProperty(BDS+"nodeShapeType");
Resource shapeType = ResourceFactory.createResource(BDS+"FacetShape");
ResIterator shapeItr = shapesModel.listResourcesWithProperty(prop, shapeType);

allows to iterate over the different shapes with an inner loop over the instances in the dataModel.

eroux commented 4 years ago

well, I'm not entirely conviced it can work... for instance:

so I think it's really about the property... or at least that's an argument for it. What use cases fit better with the class view?

xristy commented 4 years ago

Good example. We can perhaps just use bds:shapeType on either property or node shapes, or maybe it would be simpler to have two separate properties to distinguish between node and property shapes

eroux commented 4 years ago

why not yes

eroux commented 4 years ago

Another obvious use case for having the property on propertyshapes and not nodeshapes:

:PersonA :teacherOf :PersonB

here we want to validate :PersonA (because we're in the graph) but we don't want to validate :PersonB, although it has the exact same shape. @xristy can you change that please? That would ease Marc's work

eroux commented 4 years ago

thanks! I'm not sure IgnoreShape is a very good name though: it will be indeed ignored by the validator, but not by the editor. The property will instruct:

xristy commented 4 years ago

Yes, I realized in the middle of the night that I should add bds:ExternalType. I'll change after I get going.

xristy commented 4 years ago

added bds:ExternalType and changed most occurrences of bds:IgnoreType

eroux commented 4 years ago

excellent, thanks!