-
Notifications
You must be signed in to change notification settings - Fork 22
Add Files (attachment feature) #516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop-v2
Are you sure you want to change the base?
Conversation
We should think about how files are linked to premises, systems, measures, etc. Perhaps, An example use case is photographs of buildings, pieces of equipment, deficiencies that are addressed by measures. |
It would be rather helpful to me if the proposal contained a little snippet of what this would look like in a real buildingsync file. Is it like this? <auc:Building ID="Building-1">
<!-- ... -->
<auc:Files>
<auc:File ID="File-1">
<auc:FileName>north.png</auc:FileName>
<auc:FileDescription>View of north face of building</auc:FileDescription>
<auc:FileContentType>image/png</auc:FileContentType>
<auc:FileSize>1024</auc:FileSize>
<auc:FileSHA1Checksum>2fd4e1c67a2d28fced849ee1bb76e7391b93eb12</auc:FileSHA1Checksum>
<auc:FileURL>https://www.example.com/buildings/1/north.png</auc:FileURL>
</auc:File>
</auc:Files>
<!-- ... -->
</auc:Building> |
Pretty close, but tweaking a bit to use the linking element like this: <auc:Facility ID="Facility-1">
<auc:Sites>
<auc:Site ID="Site-1">
<auc:Buildings>
<auc:Building>
<!-- ... -->
<auc:LinkedFiles>
<auc:LinkedFileID IDref="File-1"/>
</auc:LinkedFiles>
</auc:Building>
</auc:Buildings>
</auc:Site>
</auc:Sites>
<!-- ... -->
<auc:Files>
<auc:File ID="File-1">
<auc:FileName>north.png</auc:FileName>
<auc:FileDescription>View of north face of building</auc:FileDescription>
<auc:FileContentType>image/png</auc:FileContentType>
<auc:FileSize>1024</auc:FileSize>
<auc:FileSHA1Checksum>2fd4e1c67a2d28fced849ee1bb76e7391b93eb12</auc:FileSHA1Checksum>
<auc:FileURL>https://www.example.com/buildings/1/north.png</auc:FileURL>
</auc:File>
</auc:Files>
<!-- ... -->
</auc:Facility> I have not got to update the linking element implementation part, but yes I will create an example xml in the end after I finish all the updates in the schema. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good Jie!
It's a question I have - should we link file within a premise, or link a premise under a file (like you suggested)? |
@markborkum I added the linking elements for the Files to the locations where I think applicable. Would you please review the changes again and let me know your opinions? Thanks. |
BuildingSync.xsd
Outdated
</xs:element> | ||
<xs:element name="FileSize" type="xs:integer" minOccurs="0"> | ||
<xs:annotation> | ||
<xs:documentation>Size of file in Megabyte (MB)</xs:documentation> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the file size is relatively small, then the rounded size in megabytes would be 0
. Consider replacing this with the size in bytes.
Also, since file sizes cannot be negative, should this be xs:nonNegativeInteger
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense! Updated.
BuildingSync.xsd
Outdated
</xs:annotation> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:string"> | ||
<xs:pattern value="\w+/[-+.\w]+"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using \w+/[-.\w]+(?:\+[-.\w]+)?
to validate that there is only 1 component after the +
symbol.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried your suggestion but it seems that XSD does not support such advanced expression. I substitute with \w+/([-.\w]+|\w+[-.\w]*\+[-.\w]+)
to flatten the pattern. Let me know if this looks right to you - I'm totally new to regex thingy.
flatten pattern to meet xsd requirement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks for addressing my comments, @JieXiong9119.
Any background context you want to provide?
This PR was motivated by both the feature request in this ticket, and one of the proposed (possible) solutions of addressing complex mapping with Std 229P.
What does this PR do?
See proposal
How should this be manually tested?
TO DO
What are the relevant tickets?
#391 #514
Screenshots (if appropriate)