|
#########################################################################################
|
## This sample is inspired by Ontopoia's OSL, Opera OSL schema and ... Pyhton syntax.
#########################################################################################
##
## This is a partial description of association type 'born-in'
##
#########################################################################################
association type born-in:
transitive=false
role person:
cardMin=1
cardMax=1
allValuesFrom=person
role place:
cardMin=1
cardMax=1
allValuesFrom=place
## Projections can be used in TMQL
## I think also to use projections during topic map authoring
projections:
bornIn:
transitive=false
orderedValues=false
defQuery=$$self/roleOf::person@$$scope[born-in]/role::place
defAssert:
born-in@$$scope:
person=$$source
place=$$target
placeOfBirthFor:
transitive=false
orderedValues=false
defQuery=$$self/roleOf::place@$$scope[born-in]/role::person
defAssert:
born-in@$$scope:
person=$$target
place=$$source
## TODO: Projection description should be more declarative, kind of "arc" def. in XLink spec.
## Something like this:
## bornIn:
## sourceRole=person
## targetRole=place
## transitive=false
## orderedValues=false
## cardMin=1
## cardMax=1
## allValuesFrom=place
## Note 1: ## projection definition can have in fact to parts: ## - query (is used in queries) ## - assertion (set of TM assertions if I use projection for authoring) ## ## So If I say that (using new PTM format) ## ## topic JohnSmith: ## displayName="John Smith" ## bornIn=LondonUK ## ## engine will transform this statement into "normal" association ## ## Note 2: ## Projections also can have additional parameters. ## It can be important for associations with arity >2 ## ## Note 3: ## For binary associations order can be important. Example: authors list for paper. ## I think to have attribute 'orderedValues' for projections. ## And standard variable $$position which can be used in "assert" statements. ## We also need some standard way to represent ordered associations. ## ## I like idea of Geir Ove Grønmo about 'position' ## occurrence for 'person' scoped by reified association of type 'is-author-of' ## ## In query language (TMPath) new dynamic step 'position' should be available ## for topics if topics are members of ordered value. Sequences keep order if order exists. ## ## paper2003/hasAuthor ## or ## paper2003/work[is-author-of]/author ## - returns authors in proper order ## ## If I need list in reverse order: ## ## let $t:=paper2003/work[is-author-of]/reifier ## for $author in paper2003/work[is-author-of]/author ## order by $author/position@$t desc ## return $author/fullName ## ## topic paper-2004-01-20: ## hasAuthor(1)=author1 ## hasAuthor(2)=author2: ## fullName="John Smith" ## hasAuthor(3)=author3 ## ## OR ## ## topic paper-2004-01-20: ## hasAuthor=sequence: ## author1 ## author2: ## fullName="John Smith" ## author3 ## ## This is the same as before. I just added additional "meta" info about hasAuthor values. ## ## topic paper-2004-01-20: ## hasAuthor: ## completeList=true ## value=sequence: ## author1 ## author2: ## fullName="John Smith" ## author3 ## |