Concept "DSKMF Annotations"

From SMW CindyKate - Main
Component0170103276
Jump to: navigation, search

Content


Overview

graph LR BSDSKMF[BusinessService 'DSKMF'] BS[EntityType 'BusinessService'] RS[EntityRole 'RevenueSource'] ASP[EntityAspect 'BusinessSignificance'] BSDSKMF -->|IsA| BS BSDSKMF -->|Assumes| RS BSDSKMF -->|Exhibits| ASP ANN[Annotation] BSDSKMF -->|Declares| ANN BS -->|Declares| ANN RS -->|Declares| ANN ASP -->|Declares| ANN SUB[AnnotationSubject] PRE[AnnotationPredicate] OBJ[AnnotationObject] CORE[Core] ANN --> CORE CORE --> SUB CORE --> PRE CORE --> OBJ ID[AnnotationID] TYP[AnnotationType] MRmore[...more by SysAdmin] MR[MetaReification] ANN --> MR MR --> ID MR --> TYP MR --> MRmore HC[e.g. HasComment] HCmore[...] DR[DomainReification] ANN --> DR DR --> HC DR --> HCmore[...more by User]

See Concept "DSKMF Reification"

Without domain reification With domain reification
{{Annotation
  |AnnotationPredicate=HasSubjectTitle
  |AnnotationObjects=Hello;GutenTag
}}

  is turned into

{{#set:HasSubjectTitle=Hello}}
{{#set:HasSubjectTitle=GutenTag}}

  and

{{#subobject:##0#12
  |AnnotationPredicate=HasSubjectTitle
  |AnnotationObject=Hello
  |AnnotationType=VariablePredicateNoDomainSpecificReification
}}

{{#subobject:##0#34
  |AnnotationPredicate=HasSubjectTitle
  |AnnotationObject=GutenTag
  |AnnotationType=VariablePredicateNoDomainSpecificReification
}}
{{HasContext|Component1304822464
  |HasComment=Contexting can be relative to another subject.
}}

  is turned into

{{#set:HasContext=Component1304822464}}

  and

{{#subobject:
  |AnnotationPredicate=HasContext
  |AnnotationObject=Component1304822464
  |AnnotationType=FixedPredicateNamedObject
  |HasComment=Contexting can be relative to another subject.
}}
{{HasContext
  |HasComment=Contexting can be relative to another subject.
}}

  is turned into

{{#set:HasContext=##0#56}}

  and

{{#subobject:##0#56
  |AnnotationPredicate=HasContext
  |AnnotationObject=##0#56
  |AnnotationType=FixedPredicateAnonymousObject
  |HasComment=Contexting can be relative to another subject.
}}

Example Subject: Setup "Configure your domain's dataspects Search indexing, querying and presenting"

Component1663539245 (edit)
{{DSKIMSetup
|HasTitle=Configure your domain's dataspects Search indexing, querying and presenting
}}

<!-- Non-reifiable anonymous object with variable predicate -->
{{Annotation
|AnnotationPredicate=HasMarketingPage
|AnnotationObjects=https://dataspects.com/dataspects-search
}}

<!-- Reifiable named object with fixed predicate -->
{{HasContext
|HasContext=Component1304822464
|HasComment=Contexting can be relative to another subject.
}}

<!-- Reifiable anonymous object with fixed predicate -->
{{HasContext
|HasComment=Contexting can also be general.
}}

{|class=wikitable width=100%
|width=33%|
== Your dataspects Search Workstation ==

 '''[email protected]:/home/user/dataspectsOntologyEngineering/'''
 ├── document_mappings
 │   └── documentMappings.rb
 ├── index_settings
 │   └── indexSettings.rb
 └── jobs
     ├── performIndexing.rb
     └── resetIndex.rb

|width=33%|
== Your Elasticsearch Server ==

 '''[email protected]:/home/dataspects/'''
 ├── dataspects
 ├── dataspectsMainAPI
 ├── dataspectsPlugins
 │   ├── mySearchEngine
 │   │   ├── elasticsearch_hit.rb
 │   │   ├── html_components.rb
 │   │   ├── result_for_term_in_facet.rb
 │   │   └── search_interface_component.rb
 └── dataspectsSearch_config.yml

<syntaxhighlight lang="yaml">
# dataspectsSearch_config.yml
---
dataspectsESCluster: xx.xx.xx.xx:9200
sIndexName: yourIndex1
sPluginURLs: [
  'dataspectsPlugins/mySearchEngine'
]
</syntaxhighlight>
|

== Your SMW Server ==

=== SMW-integrated Search Interface ===

 '''[email protected]:/var/www/html/w/extensions/DataspectsSearch/'''
 ├── dataspectsSearch_config.js
 └── dataspectsSearchHTMLInterface
     └── dataspectsSearchThemeStandard
         └── dataspectsSearch.css

<syntaxhighlight lang="javascript">
// dataspectsSearch_config.js
var h_dataspectsSearchConfig = {
  url_dataspectsSearchSinatraAPI: '',
  sSearchServerRootURL: 'https://YourWiki/wiki/Special:DataspectsSearch',
}
</syntaxhighlight>

<syntaxhighlight lang="javascript">
// https://YourWiki/wiki/MediaWiki:Common.js
 $(document).ready(function() {
   $('#searchform').on('submit', function(e){
     e.preventDefault();
   });
   $('#searchInput').on('keypress', function(e) {
     var code = e.keyCode || e.which;
     if(code==13) {
       window.location.href = '<nowiki>https://YourWiki/wiki/Special:DataspectsSearch/</nowiki>'+$(this).val();
     }
   });
 });
</syntaxhighlight>

|}
Template:DSKIMSetup (edit)
{{METADATA|Keywords={{{HasEntityKeyword|}}}|HasTitle={{{HasTitle}}}|HasEntityBlurb={{{HasEntityBlurb|}}}}}

{{Annotation
|AnnotationPredicate=HasSubjectType
|AnnotationObjects=DSKIMSetup
}}

{{DISPLAYTITLE:Setup "{{{HasTitle}}}"}}{{#default_form:DSKIMSetup}}
<includeonly>[[Category:Subject]]</includeonly>
<noinclude>[[Category:DSKIMMPETopLevelOntology]]</noinclude>
Template:AnnotationResultItem (edit)
<includeonly>{{#ifeq:{{{2}}}|MentionsDomainTerm||
|-
|{{PropName|{{#formredlink:target=Property:{{{2}}}|form=Property|link text={{{2}}}|existing page link text={{{2}}}|tooltip=Click to initialize this property...}}}}
|{{#ifeq:{{{4}}}|FixedPredicateAnonymousObject|{{#invoke:Annotations|AnonymousAnnotationFieldsTable|{{{3}}}}}|{{#if:{{{3|}}}|{{PropVal|{{#ifeq:{{#show:Property:{{{2}}}|?Has type|link=none}}|Page|[[{{{3}}}]]|{{{3}}}}}}}|}}}}
|-}}</includeonly><noinclude>[[Category:DSKIMMPETopLevelOntology]]</noinclude>

Non-reifiable anonymous object with variable predicate

Template:Annotation (edit)
{{#if:{{{AnnotationPredicate|}}}
  |{{#arraymap:{{{AnnotationObjects|}}}|;
    |@@@[email protected]@@|
    {{#set:{{{AnnotationPredicate}}}[email protected]@@[email protected]@@}}
    |;
  }}
  {{#arraymap:{{{AnnotationObjects|}}}|;|@@@[email protected]@@|{{ManualSubobject|AnnotationSubject=none|AnnotationPredicate={{{AnnotationPredicate}}}|AnnotationObject[email protected]@@[email protected]@@}}
    |
  }}
  |'''{{wr|Error:MissingAnnotationPredicate}}'''
}}<noinclude>[[Category:DSKMFCoreOntology]]</noinclude>
Template:ManualSubobject (edit)
{{#subobject:AnnotationSubject={{{AnnotationSubject}}}|AnnotationPredicate={{{AnnotationPredicate}}}|AnnotationObject={{{AnnotationObject}}}|AnnotationType={{{AnnotationType|SubjectAnnotation}}} }}<noinclude>[[Category:DSKMFCoreOntology]]</noinclude>
Property:AnnotationPredicate (edit)
{{#set:Has type=Text}}
<noinclude>[[Category:DSKMFCoreOntology]]</noinclude>
Property:AnnotationObject (edit)
{{#set:Has type=Text}}
<noinclude>[[Category:DSKMFCoreOntology]]</noinclude>
Property:AnnotationType (edit)
{{#set:Has type=Text}}
<noinclude>[[Category:DSKMFCoreOntology]]</noinclude>

Reifiable named/anonymous object with fixed predicate

Template:HasContext (edit)
<includeonly>{{ReifiableAnnotation|HasContext={{{HasContext}}}
  |AnnotationFields=
    @@HasComment={{{HasComment}}}
    @@HasStatus=Enabled
}}</includeonly><noinclude>[[Category:DSKMFCoreOntology]]</noinclude>
Template:ReifiableAnnotation (edit)
<includeonly>
{{#if:{{{2|}}}
  | <!-- Is named -->
    {{#set:{{{1}}}={{{2}}}}}
    {{#invoke:Annotations|NamedAnnotationSubobject
      |{{{1}}}
      |{{{2}}}
      |FixedPredicateNamedObject
      |{{{AnnotationFields}}}
    }}

  | <!-- Is anonymous -->
    {{#vardefine:uuid|{{#replace:{{UUID}}|-|}}}}
    {{#set:{{{1}}}={{FULLPAGENAME}}#_{{#var:uuid}}}}
    {{#invoke:Annotations|AnonymousAnnotationSubobject
      |_{{#var:uuid}}
      |{{{1}}}
      |{{FULLPAGENAME}}#_{{#var:uuid}}
      |FixedPredicateAnonymousObject
      |{{{AnnotationFields}}}
    }}
}}<includeonly><noinclude>[[Category:DSKMFCoreOntology]]</noinclude>
Template:PropName (edit)
<span class="PropName">{{{1}}}</span><noinclude>[[Category:DSKMFOntologyModuleL0BB0]]</noinclude>
Template:PropVal (edit)
<span class="PropVal">{{{1}}}</span><noinclude>[[Category:DSKMFOntologyModuleL0BB0]]</noinclude>

Module:Annotations

Module:Annotations (edit)
-- Global variables?

local p = {}

function split(s, delimiter)
  result = {};
  for match in (s..delimiter):gmatch("(.-)"..delimiter) do
    table.insert(result, match);
  end
  return result;
end

function p.NamedAnnotationSubobject( frame )

    if not mw.smw then
        return "mw.smw module not found"
    end

    if frame.args == 0 then
        return "no parameters found"
    end

    fields = split(frame.args[4], '@@')
    table.remove(fields,1)
    table.insert(fields, 'AnnotationPredicate=' .. frame.args[1])
    table.insert(fields, 'AnnotationObject=' .. frame.args[2])
    table.insert(fields, 'AnnotationType=' .. frame.args[3])
    table.insert(fields, frame.args[1] .. '=' .. frame.args[2])

    local result = mw.smw.subobject(fields)
    if result == true then
        return ''
    else
        return 'An error occurred during the subobject storage process. Message reads ' .. result.error
    end
end

function p.AnonymousAnnotationSubobject( frame )

    if not mw.smw then
        return "mw.smw module not found"
    end

    if frame.args == 0 then
        return "no parameters found"
    end

    fields = {}
    table.insert(fields, 'AnnotationPredicate=' .. frame.args[2])
    table.insert(fields, 'AnnotationObject=' .. frame.args[5])
    table.insert(fields, 'AnnotationType=' .. frame.args[4])

    local result = mw.smw.subobject(fields, frame.args[1])
    if result == true then
        return ''
    else
        return 'An error occurred during the subobject storage process. Message reads ' .. result.error
    end
end

function p.AnonymousAnnotationFieldsTable( frame )

    fields = split(frame.args[1], '@@')
    table.remove(fields,1)
    htmlFieldsTable = {}
    table.insert(htmlFieldsTable, '<table class="AnonymousAnnotationFieldsTable">')
    for key, field in pairs(fields) do
      fields2 = split(field, '=')
      table.insert(htmlFieldsTable, '<tr><td>' .. fields2[1] .. '</td><td>' .. fields2[2] .. '</td></tr>')
    end
    table.insert(htmlFieldsTable, '</table>')
    return table.concat(htmlFieldsTable, '')

end

return p

--[[Category:DSKIMMPETopLevelOntology]]