As by default sequence order is not maintained in an OWL ontology. How can i model sequence in an OWL-DL ontology ?
One way to model a sequence and order its elements is to just introduc a hasNext property to capture sequence order:
Class: SequenceItem
EquivalentTo:
hasNext only SequenceItem
ObjectProperty: hasNext
Domain:
SequenceItem
Range:
SequenceItem
InverseOf:
hasPrevious
Then, assuming the items you want to sequence in order are represented as instances, you can capture their order in the sequence like so:
SequenceItem: item_1
hasNext:
item_2
OWL allows you to state e.g.:
every item follows at most one item.
every item is followed by at most one item.
every first-item is an item that follows no item.
Item1 is an item and is followed by Item2.
...
These statements allow you to describe sequences (possibly open-ended, i.e. with an infinite model).
(The above statements were written in ACE, use the ACE parser to convert them to OWL, where item becomes a class, follows becomes an object property and Item1 and Item2 are individuals.)
Related
Is there any patters that I can use to understand if my data model has changed to original state.
Let's see at situation when I have an object Order which can include some price info, items number, order notes info and etc. So at start it's an empty order and if I will update any properties by adding something new I will need to detect that the model exactly changed.
So let's say I put 5 items number at start and save data mode of Order. Then I want to update this model by putting 2 new items then KVO or any other tool should tell me about updates in data model, but if I set 5 items number one more time (like NSInteger itemNumbers = 5) so it means I triggered setter of the property, but I have not modified original value.
I'm implementing a generic BACnet decoder and came across the following question, of which I can't seem to find the answer within the BACnet standard. The chapter "20.2.1.3.2 Constructed Data" does not answer my question, or I might not fully understand it.
Let's assume I have a List (SEQUENCE OF) with elements of type Record (SEQUENCE).
Said record has 4 fields, identified by context tag, where field 0 and 1 are optional.
I further assume that the order, in which those fields are serialized, can be arbitrary (because they're identified by their context tags).
The data could look like that (number indicates field / column):
[{ "3", "0", 2" }, {"1", "2", "3"}]
Over the wire, the only "structure information" I assume I get are the open / close tags for the list.
That means:
Open Tag List
ctxTagColumn3, valueColumn3,
ctxTagColumn0, valueColumn0,
ctxTagColumn2, valueColumn2,
ctxTagColumn1, valueColumn1,
ctxTagColumn2, valueColumn2,
ctxTagColumn3, valueColumn3
Close Tag List
How do I know, after I've read the last column data ("2") of my first list item, that I must begin decoding the second item, starting with a value for column "1"?
Which of my assumptions is wrong?
Thank you and kind regards
Pascal
The order of elements of a SEQUENCE is always known and shall not be arbitrarily by definition. Further, not all conceivable combinations are possible to encode. Regarding BACnet, all type definitions shall be decodable universally.
Assuming I understand you correctly; the "order" cannot be "arbitrary"; i.e.:
SEQUENCE = *ordered* collection of variables of **different** types
SEQUENCE OF = *ordered* collection of variables of **same** type
The tag-number for the item (SD) context-tag will be different (/possibly an incremented value/maybe +1) from the containing (PD) context-tag; so you could check for that, or better still if the tag-number value is <= 5 (/'length' value) then it's a SD context-tag for one of your items, rather than a (/the closing) PD context tag (/'type' value) delimiting the end of your items.
I'm having trouble understanding the rfc5545 concerning the the until and count. From what I understand, UNTIL and COUNT cannot be in the same recur rule according to this part of the RFC:
Value Name: RECUR
Purpose: This value type is used to identify properties that
contain a recurrence rule specification.
Formal Definition: The value type is defined by the following
notation:
recur = "FREQ"=freq *(
; either UNTIL or COUNT may appear in a 'recur',
; but UNTIL and COUNT MUST NOT occur in the same 'recur'
...
Further in the rfc, this is stated:
If multiple BYxxx rule parts are specified, then after evaluating the
specified FREQ and INTERVAL rule parts, the BYxxx rule parts are
applied to the current set of evaluated occurrences in the following
order: BYMONTH, BYWEEKNO, BYYEARDAY, BYMONTHDAY, BYDAY, BYHOUR,
BYMINUTE, BYSECOND and BYSETPOS; then COUNT and UNTIL are evaluated.
This last paragraph seems to imply that the COUNT and UNTIL can be in the same RRULE.
When I check libraries that implement rrule generator and parsing, there is no validation that make sure that the the COUNT and UNTIL are not in the same recur.
What is the general implementation that everyone usually do with this ? Should we ignore this validation and simply use the UNTIL parameter when there is both COUNT and UNTIL (or vice versa) ? What does the RFC mean exactly concerning the COUNT and UNTIL parameter ?
I don't think you can derive from the second paragraph that having both is valid.
There is only one definition of RECUR and the cardinality of its various components: the ABNF definition. This is where you should go to check the validity of your property.
The second paragraph simply describes the algorithm to use for doing RRULE expansion.
I'm using odoo 8 in my class I use a field selection but when I use it in the view XML with the widget statusbar the values are all in not order (all mess up) it is showing me the values in the statusbar first cancel, then new, then confirm all in disorder why is doing this?
this is my code in the class
'state': fields.selection ({('new','Nueva'),
('draft','Asignada'),
('cancel','Cancelada'),
('sent','Revisada'),
('confirmed','Atendiendose'),
('done','Liberada'),
('agent','Agendada')},
'Estatus Orden')
in the view xml i only worte this:
field name="state" widget="statusbar"
I don't know how to order correctly because the bar shows the list in not order does anybody know?
You can arrange the sequence of the state. You can add state to status bar in the following way
<field name="state" widget="statusbar" statusbar_visible="new,draft,confirmed,cancel" />
You need to replace {} in fields.selection by [].
Because there is huge difference between set {} and list [].
Set :
The sets module provides classes for constructing and manipulating unordered collections of unique elements. Common uses include membership testing, removing duplicates from a sequence, and computing standard math operations on sets such as intersection, union, difference, and symmetric difference.
Refer more about Set
List :
Lists are are really variable-length arrays, not Lisp-style linked lists. The list type is a container that holds a number of other objects, in a given order (Ordered Collection). The list type implements the sequence protocol, and also allows you to add and remove objects from the sequence.
Refer more about List
Field definition :
'state': fields.selection ([('new','Nueva'), ('draft','Asignada'), ('cancel','Cancelada'), ('sent','Revisada'), ('confirmed','Atendiendose'), ('done','Liberada'), ('agent','Agendada')], 'Estatus Orden')
Difference between Set and List
Sets and Lists in Python
In Python, when to use a Dictionary, List or Set?
I need apply a variable sequence of templates to an argument. The template secuence is determined in runtime in the controller layer, and these templates are applied to only one argument like:
arg:tpl1():tpl2():...:tplN()
In resume, I need apply a serie of templates to an argument, but this sequence calculated in runtime and in the controller layer.
Thank you!!
You need to iterate over the template name and the parameter lists at the same time. From the documentation, http://www.antlr.org/wiki/display/ST4/Templates, you will find this example:
<names,phones:{ n,p | <n>: <p>}>
In your case, you need something like
<names,values:{ n,v | <(n)(v)>}>
Oh, per your comment, to apply a list of templates to another list requires a nested map-apply I think.
<values:{v | <names:{n | <(n)(v)>}}>
That applies each template named in names to each value in values.