Difference between revisions of "GenerateProperties"

From BITPlan can4eve Wiki
Jump to navigation Jump to search
(created by WikiTask 2017-06-10T15:11:23Z)
m (transfered by WikiBackup wikiTask at 2017-06-11T13:26:17Z)
 
Line 18: Line 18:
 
* {{Link|target=Template:Wikitask}}
 
* {{Link|target=Template:Wikitask}}
 
= input =
 
= input =
=== metamodel sidif ===
+
=== sidif ===
<source lang='java' id='msidif'>
+
<source lang='java' id='sidif'>
 
MetaModel isA Context
 
MetaModel isA Context
 
"MetaModel#sidif"is sidif of it
 
"MetaModel#sidif"is sidif of it
Line 25: Line 25:
 
</source>
 
</source>
  
=== sidif ===
+
=== presentation sidif ===
<source lang='java' id='sidif'>
+
<source lang='java' id='pressidif'>
CantripletContext isA Context
+
Presentation isA Context
"CantripletContext#sidif"is sidif of it
+
"Presentation#sidif"is sidif of it
CANInfo needs Properties
+
Bigstock needs Properties
PID needs Properties
 
 
</source>
 
</source>
  
Line 128: Line 127:
  
 
= result =
 
= result =
2017-06-10T15:11:16Z
+
2016-02-10T06:54:11Z
2 Topics need Properties to be generated
+
1 Topics need Properties to be generated
  
== Topic: CANInfo ==
+
== Topic: Bigstock ==
=== properties of CANInfo ===
+
=== properties of Bigstock ===
==== [[Property:CANInfo name]] ====
+
==== [[Property:Bigstock id]] ====
 
 
<pre>
 
 
 
{{Property
 
|name=name
 
|label=name
 
|documentation=name of CANInfo
 
|type=Special:Types/Text
 
|index=1
 
|sortPos=
 
|primaryKey=true
 
|mandatory=true
 
|namespace=
 
|size=
 
|uploadable=false
 
|defaultValue=
 
|inputType=
 
|allowedValues=
 
|values_from=
 
|showInGrid=false
 
|isLink=false
 
|topic=Concept:CANInfo
 
|storemode=property
 
}}
 
[[Has type::Text]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
==== [[Property:CANInfo description]] ====
 
 
 
<pre>
 
 
 
{{Property
 
|name=description
 
|label=description
 
|documentation=description of CANInfo
 
|type=Special:Types/Text
 
|index=2
 
|sortPos=
 
|primaryKey=false
 
|mandatory=false
 
|namespace=
 
|size=
 
|uploadable=false
 
|defaultValue=
 
|inputType=
 
|allowedValues=
 
|values_from=
 
|showInGrid=false
 
|isLink=false
 
|topic=Concept:CANInfo
 
|storemode=property
 
}}
 
[[Has type::Text]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
==== [[Property:CANInfo unit]] ====
 
 
 
<pre>
 
 
 
{{Property
 
|name=unit
 
|label=unit
 
|documentation=the unit of this CANInfo
 
|type=Special:Types/Text
 
|index=3
 
|sortPos=
 
|primaryKey=false
 
|mandatory=false
 
|namespace=
 
|size=
 
|uploadable=false
 
|defaultValue=
 
|inputType=
 
|allowedValues=
 
|values_from=
 
|showInGrid=true
 
|isLink=false
 
|topic=Concept:CANInfo
 
|storemode=property
 
}}
 
[[Has type::Text]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
==== [[Property:CANInfo pid]] ====
 
 
 
<pre>
 
 
 
{{Property
 
|name=pid
 
|label=pid
 
|documentation=PID of this CANInfo
 
|type=Special:Types/Page
 
|index=
 
|sortPos=
 
|primaryKey=
 
|mandatory=
 
|namespace=
 
|size=
 
|uploadable=
 
|defaultValue=
 
|inputType=dropdown
 
|allowedValues=
 
|values_from=concept=PID
 
|showInGrid=
 
|isLink=true
 
|topic=Concept:CANInfo
 
|storemode=property
 
}}
 
[[Has type::Page]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
 
 
== Topic: PID ==
 
=== properties of PID ===
 
==== [[Property:PID id]] ====
 
  
 
<pre>
 
<pre>
Line 255: Line 139:
 
|name=id
 
|name=id
 
|label=id
 
|label=id
|documentation=Id of diagnostic parameter
+
|documentation=the id of the bigstock photo
 
|type=Special:Types/Text
 
|type=Special:Types/Text
 
|index=1
 
|index=1
Line 262: Line 146:
 
|mandatory=true
 
|mandatory=true
 
|namespace=
 
|namespace=
|size=
+
|size=8
 
|uploadable=false
 
|uploadable=false
 
|defaultValue=
 
|defaultValue=
Line 270: Line 154:
 
|showInGrid=false
 
|showInGrid=false
 
|isLink=false
 
|isLink=false
|topic=Concept:PID
+
|topic=Concept:Bigstock
 
|storemode=property
 
|storemode=property
 
}}
 
}}
Line 276: Line 160:
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
</pre>
==== [[Property:PID name]] ====
+
==== [[Property:Bigstock file]] ====
  
 
<pre>
 
<pre>
  
 
{{Property
 
{{Property
|name=name
+
|name=file
|label=name
+
|label=file
|documentation=name of parameter
+
|documentation=the downloaded bigstock file - if it is downloaded a license has been paid for
|type=Special:Types/Text
+
|type=Special:Types/Page
 
|index=2
 
|index=2
 
|sortPos=
 
|sortPos=
 
|primaryKey=false
 
|primaryKey=false
 
|mandatory=false
 
|mandatory=false
|namespace=
+
|namespace=File
|size=
+
|size=100
|uploadable=false
+
|uploadable=true
 
|defaultValue=
 
|defaultValue=
 
|inputType=
 
|inputType=
 
|allowedValues=
 
|allowedValues=
|values_from=
+
|values_from=namespace=File
 
|showInGrid=false
 
|showInGrid=false
 
|isLink=false
 
|isLink=false
|topic=Concept:PID
+
|topic=Concept:Bigstock
 
|storemode=property
 
|storemode=property
 
}}
 
}}
[[Has type::Text]]
+
[[Has type::Page]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
==== [[Property:PID description]] ====
 
 
 
<pre>
 
 
 
{{Property
 
|name=description
 
|label=description
 
|documentation=description for OBDII parameter
 
|type=Special:Types/Text
 
|index=3
 
|sortPos=
 
|primaryKey=false
 
|mandatory=false
 
|namespace=
 
|size=
 
|uploadable=false
 
|defaultValue=
 
|inputType=textarea
 
|allowedValues=
 
|values_from=
 
|showInGrid=false
 
|isLink=false
 
|topic=Concept:PID
 
|storemode=property
 
}}
 
[[Has type::Text]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
==== [[Property:PID links]] ====
 
 
 
<pre>
 
 
 
{{Property
 
|name=links
 
|label=links
 
|documentation=links for parameter
 
|type=Special:Types/Text
 
|index=4
 
|sortPos=
 
|primaryKey=false
 
|mandatory=false
 
|namespace=
 
|size=
 
|uploadable=false
 
|defaultValue=
 
|inputType=textarea
 
|allowedValues=
 
|values_from=
 
|showInGrid=false
 
|isLink=false
 
|topic=Concept:PID
 
|storemode=property
 
}}
 
[[Has type::Text]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
==== [[Property:PID examples]] ====
 
 
 
<pre>
 
 
 
{{Property
 
|name=examples
 
|label=examples
 
|documentation=example for parameter
 
|type=Special:Types/Text
 
|index=5
 
|sortPos=
 
|primaryKey=false
 
|mandatory=false
 
|namespace=
 
|size=
 
|uploadable=false
 
|defaultValue=
 
|inputType=textarea
 
|allowedValues=
 
|values_from=
 
|showInGrid=false
 
|isLink=false
 
|topic=Concept:PID
 
|storemode=property
 
}}
 
[[Has type::Text]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
==== [[Property:PID frequency]] ====
 
 
 
<pre>
 
 
 
{{Property
 
|name=frequency
 
|label=freq
 
|documentation=frequency on CANBus
 
|type=Special:Types/Text
 
|index=6
 
|sortPos=
 
|primaryKey=false
 
|mandatory=false
 
|namespace=
 
|size=
 
|uploadable=false
 
|defaultValue=
 
|inputType=textarea
 
|allowedValues=
 
|values_from=
 
|showInGrid=false
 
|isLink=false
 
|topic=Concept:PID
 
|storemode=property
 
}}
 
[[Has type::Text]]
 
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
</pre>

Latest revision as of 15:26, 11 June 2017

Action
edit
name  GenerateProperties
servicetype  WikiTask
service  
inputtype  Page
input  GenerateProperties#sidif
actionpage  GenerateProperties#template
output  GenerateProperties#result
engine  rythm
author  Wf
since  2015/11/18
comment  This saves a lot of work!

login reset runtemplate -> GenerateProperties#result


[edit]

sidif

MetaModel isA Context
"MetaModel#sidif"is sidif of it
Action needs Properties

presentation sidif

Presentation isA Context
"Presentation#sidif"is sidif of it
Bigstock needs Properties

Training sidif

Training isA Context
"Training#sidif"is sidif of it
Quizkarte needs Properties

Syllabus sidif

Syllabus isA Context
"Syllabus#sidif"is sidif of it
LearningGoal needs Properties

CRM Sidif

CRM isA Context
"CRM#sidif"is sidif of it
Organization needs Properties
Person needs Properties
Contact needs Properties
SocialLink needs Properties
[edit]
@// This is a rythm template
@import org.sidif.triple.TripleQuery
@import org.sidif.triple.Triple
@import org.sidif.wiki.SSLWiki
@import com.bitplan.topic.ContextSetting.TripleStoreMode
@import com.alibaba.fastjson.JSON
@import com.bitplan.mediawiki.japi.MediawikiApi
@import com.bitplan.mediawiki.japi.Mediawiki
@import com.bitplan.mediawiki.japi.api.Api
@include(wiki.SiDIFTemplates.propertiesdefs)
@args() {
  String title 
  String logo
  org.sidif.wiki.WikiTask wikiTask
  org.sidif.triple.TripleStore tripleStore
}
@{
  TripleQuery query=tripleStore.query();
  TripleQuery needed=query.query(null,"needs","Properties");
  Triple contextTriple=query.selectSingle(null,"isA","Context");
  String contextName=contextTriple.getSubject().toString();
  Triple sidifTriple=query.selectSingle(contextName,"sidif", null);
  String contextSidif=sidifTriple.getObject().toString();
  // now get the context
  ContextSetting contextSetting=ContextSetting.fromWikiTask(wikiTask);
  contextSetting.setContextName(contextName);
  contextSetting.setSidifInput(contextSidif);
  contextSetting.setTripleStoreMode(TripleStoreMode.SiDIF);
  Context context = ContextFactory.getInstance().getContext(contextSetting);
}
@(wikiTask.getWiki().getIsoTimeStamp())
@(needed.size()) Topics need Properties to be generated
@for (Triple neededTriple:needed.getTriples()) {
@{
  String topicName=neededTriple.getSubject().toString();
  Topic topic=context.byName(topicName);
}
== Topic: @(topicName) ==
=== properties of @(topic.name) ===
@for (Property property:topic.getProperties()) {
==== [[Property:@(topic.name) @(property.name)]] ====
@{
  Throwable error=null;
  try {
    // get the Rythm template result
    org.rythmengine.utils.RawData pageContentRaw=property(topic,property);
    String pageContent=pageContentRaw.toString();
    String pageTitle="Property:"+topic.name+" "+property.name;
    SSLWiki wiki=(SSLWiki)wikiTask.getWiki();
    String currentContent=wiki.getPageContent(pageTitle);
    // if (currentContent==null || currentContent.length()==0) {
      String summary="generated by GenerateProperties at "+wiki.getIsoTimeStamp();
      wiki.edit(pageTitle,pageContent,summary);
    // }
  } catch (Throwable th) {
    error=th;
  }
}
@if (error) {
<span style='color:red'>Error: @(error.getMessage())</span>
}
<pre>
@property(topic,property)
</pre>
}
}


[edit]

2016-02-10T06:54:11Z 1 Topics need Properties to be generated

Topic: Bigstock

properties of Bigstock

Property:Bigstock id


{{Property
|name=id
|label=id
|documentation=the id of the bigstock photo
|type=Special:Types/Text
|index=1
|sortPos=
|primaryKey=true
|mandatory=true
|namespace=
|size=8
|uploadable=false
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=false
|isLink=false
|topic=Concept:Bigstock
|storemode=property
}}
[[Has type::Text]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Property:Bigstock file


{{Property
|name=file
|label=file
|documentation=the downloaded bigstock file - if it is downloaded a license has been paid for
|type=Special:Types/Page
|index=2
|sortPos=
|primaryKey=false
|mandatory=false
|namespace=File
|size=100
|uploadable=true
|defaultValue=
|inputType=
|allowedValues=
|values_from=namespace=File
|showInGrid=false
|isLink=false
|topic=Concept:Bigstock
|storemode=property
}}
[[Has type::Page]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}