Difference between revisions of "GenerateProperties"

From BITPlan Wiki
Jump to navigation Jump to search
(created by WikiTask 2018-08-21T04:00:46Z)
 
(3 intermediate revisions by the same user not shown)
Line 20: Line 20:
 
=== sidif ===
 
=== sidif ===
 
<source lang='java' id='sidif'>
 
<source lang='java' id='sidif'>
WebContext isA Context
+
Context3D isA Context
"WebContext#sidif"is sidif of it
+
"Context3D#sidif"is sidif of it
OsProject needs Properties
+
Context3D needs Properties
 
</source>
 
</source>
  
Line 139: Line 139:
  
 
= result =
 
= result =
2018-08-21T04:00:44Z
+
2019-01-21T15:34:24Z
 
1 Topics need Properties to be generated
 
1 Topics need Properties to be generated
  
== Topic: OsProject ==
+
== Topic: Bogensportverein ==
=== properties of OsProject ===
+
=== properties of Bogensportverein ===
==== [[Property:OsProject id]] ====
+
==== [[Property:Bogensportverein name]] ====
  
 
<pre>
 
<pre>
  
 
{{Property
 
{{Property
|name=id
+
|name=name
|label=id
+
|label=name
|documentation=the id of the project
+
|documentation=Der Name des Vereins
 
|type=Special:Types/Text
 
|type=Special:Types/Text
 
|index=1
 
|index=1
Line 164: Line 164:
 
|allowedValues=
 
|allowedValues=
 
|values_from=
 
|values_from=
|showInGrid=false
+
|showInGrid=true
 
|isLink=false
 
|isLink=false
|topic=Concept:OsProject
+
|topic=Concept:Bogensportverein
 
|storemode=property
 
|storemode=property
 
}}
 
}}
Line 172: Line 172:
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
</pre>
==== [[Property:OsProject owner]] ====
+
==== [[Property:Bogensportverein lat]] ====
  
 
<pre>
 
<pre>
  
 
{{Property
 
{{Property
|name=owner
+
|name=lat
|label=owner
+
|label=lat
|documentation=the owner of the project
+
|documentation=Breitengrad
 
|type=Special:Types/Text
 
|type=Special:Types/Text
 
|index=2
 
|index=2
Line 192: Line 192:
 
|allowedValues=
 
|allowedValues=
 
|values_from=
 
|values_from=
|showInGrid=false
+
|showInGrid=true
 
|isLink=false
 
|isLink=false
|topic=Concept:OsProject
+
|topic=Concept:Bogensportverein
 
|storemode=property
 
|storemode=property
 
}}
 
}}
Line 200: Line 200:
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
</pre>
==== [[Property:OsProject title]] ====
+
==== [[Property:Bogensportverein url]] ====
 
 
<pre>
 
 
 
{{Property
 
|name=title
 
|label=title
 
|documentation=the title of the project
 
|type=Special:Types/Text
 
|index=3
 
|sortPos=
 
|primaryKey=false
 
|mandatory=false
 
|namespace=
 
|size=
 
|uploadable=false
 
|defaultValue=
 
|inputType=
 
|allowedValues=
 
|values_from=
 
|showInGrid=false
 
|isLink=false
 
|topic=Concept:OsProject
 
|storemode=property
 
}}
 
[[Has type::Text]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
==== [[Property:OsProject url]] ====
 
  
 
<pre>
 
<pre>
Line 235: Line 207:
 
|name=url
 
|name=url
 
|label=url
 
|label=url
|documentation=the url of the project
+
|documentation=
|type=Special:Types/Text
+
|type=Special:Types/URL
 
|index=4
 
|index=4
 
|sortPos=
 
|sortPos=
|primaryKey=false
+
|primaryKey=
|mandatory=false
+
|mandatory=
 
|namespace=
 
|namespace=
 
|size=
 
|size=
|uploadable=false
+
|uploadable=
 
|defaultValue=
 
|defaultValue=
 
|inputType=
 
|inputType=
 
|allowedValues=
 
|allowedValues=
 
|values_from=
 
|values_from=
|showInGrid=false
+
|showInGrid=
 
|isLink=false
 
|isLink=false
|topic=Concept:OsProject
+
|topic=Concept:Bogensportverein
 
|storemode=property
 
|storemode=property
 
}}
 
}}
[[Has type::Text]]
+
[[Has type::URL]]
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}
 
</pre>
 
</pre>
==== [[Property:OsProject version]] ====
+
==== [[Property:Bogensportverein lon]] ====
  
 
<pre>
 
<pre>
  
 
{{Property
 
{{Property
|name=version
+
|name=lon
|label=version
+
|label=lon
|documentation=the current version of the project
+
|documentation=Längengrad
 
|type=Special:Types/Text
 
|type=Special:Types/Text
|index=5
+
|index=3
 
|sortPos=
 
|sortPos=
|primaryKey=false
+
|primaryKey=
|mandatory=false
+
|mandatory=
 
|namespace=
 
|namespace=
 
|size=
 
|size=
|uploadable=false
+
|uploadable=
 
|defaultValue=
 
|defaultValue=
 
|inputType=
 
|inputType=
 
|allowedValues=
 
|allowedValues=
 
|values_from=
 
|values_from=
|showInGrid=false
+
|showInGrid=
 
|isLink=false
 
|isLink=false
|topic=Concept:OsProject
+
|topic=Concept:Bogensportverein
 
|storemode=property
 
|storemode=property
 
}}
 
}}

Latest revision as of 11:10, 21 February 2019

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

Context3D isA Context
"Context3D#sidif"is sidif of it
Context3D needs Properties

MetaModelsidif

MetaModel isA Context
"MetaModel#sidif"is sidif of it
Topic needs Properties
Property needs Properties
SMW_Type needs Properties
Context needs Properties
TopicLink needs Properties
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]

2019-01-21T15:34:24Z 1 Topics need Properties to be generated

Topic: Bogensportverein

properties of Bogensportverein

Property:Bogensportverein name


{{Property
|name=name
|label=name
|documentation=Der Name des Vereins
|type=Special:Types/Text
|index=1
|sortPos=
|primaryKey=true
|mandatory=true
|namespace=
|size=
|uploadable=false
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=true
|isLink=false
|topic=Concept:Bogensportverein
|storemode=property
}}
[[Has type::Text]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Property:Bogensportverein lat


{{Property
|name=lat
|label=lat
|documentation=Breitengrad
|type=Special:Types/Text
|index=2
|sortPos=
|primaryKey=false
|mandatory=false
|namespace=
|size=
|uploadable=false
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=true
|isLink=false
|topic=Concept:Bogensportverein
|storemode=property
}}
[[Has type::Text]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Property:Bogensportverein url


{{Property
|name=url
|label=url
|documentation=
|type=Special:Types/URL
|index=4
|sortPos=
|primaryKey=
|mandatory=
|namespace=
|size=
|uploadable=
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=
|isLink=false
|topic=Concept:Bogensportverein
|storemode=property
}}
[[Has type::URL]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Property:Bogensportverein lon


{{Property
|name=lon
|label=lon
|documentation=Längengrad
|type=Special:Types/Text
|index=3
|sortPos=
|primaryKey=
|mandatory=
|namespace=
|size=
|uploadable=
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=
|isLink=false
|topic=Concept:Bogensportverein
|storemode=property
}}
[[Has type::Text]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}