GenerateProperties

From BITPlan cr Wiki
Jump to navigation Jump to search
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

CrSchema isA Context
"CrSchema#sidif"is sidif of it
Event needs Properties
Country needs Properties
State needs Properties
City needs Properties

metamodel

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
Flipchart needs Properties
Icon needs Properties
Image needs Properties
PageOrder needs Properties
PageSequence needs Properties
Slide 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]

2020-07-22T20:05:08Z 4 Topics need Properties to be generated

Topic: Event

properties of Event

Property:Event acronym


{{Property
|name=acronym
|label=acronym
|documentation=The official acronym of the academic event, if it has one. 
|type=Special:Types/text
|index=1
|sortPos=1
|primaryKey=true
|mandatory=false
|namespace=
|size=50
|uploadable=false
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=
|isLink=false
|topic=Concept:Event
|storemode=property
}}
[[Has type::text]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Topic: Country

properties of Country

Property:Country name


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

Property:Country wikidataid


{{Property
|name=wikidataid
|label=wikidataid
|documentation=The wikidataid of the Country
|type=Special:Types/text
|index=2
|sortPos=
|primaryKey=false
|mandatory=false
|namespace=
|size=50
|uploadable=false
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=
|isLink=false
|topic=Concept:Country
|storemode=property
}}
[[Has type::text]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Property:Country event


{{Property
|name=event
|label=event
|documentation=
|type=Special:Types/Page
|index=
|sortPos=
|primaryKey=
|mandatory=
|namespace=
|size=
|uploadable=
|defaultValue=
|inputType=dropdown
|allowedValues=
|values_from=concept=Event
|showInGrid=
|isLink=true
|topic=Concept:Country
|storemode=property
}}
[[Has type::Page]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Topic: State

properties of State

Property:State name


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

Property:State wikidataid


{{Property
|name=wikidataid
|label=wikidataid
|documentation=The wikidataid of the State
|type=Special:Types/text
|index=2
|sortPos=
|primaryKey=false
|mandatory=false
|namespace=
|size=50
|uploadable=false
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=
|isLink=false
|topic=Concept:State
|storemode=property
}}
[[Has type::text]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Property:State event


{{Property
|name=event
|label=event
|documentation=
|type=Special:Types/Page
|index=
|sortPos=
|primaryKey=
|mandatory=
|namespace=
|size=
|uploadable=
|defaultValue=
|inputType=dropdown
|allowedValues=
|values_from=concept=Event
|showInGrid=
|isLink=true
|topic=Concept:State
|storemode=property
}}
[[Has type::Page]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Topic: City

properties of City

Property:City name


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

Property:City wikidataid


{{Property
|name=wikidataid
|label=wikidataid
|documentation=The wikidataid of the city
|type=Special:Types/text
|index=2
|sortPos=
|primaryKey=false
|mandatory=false
|namespace=
|size=50
|uploadable=false
|defaultValue=
|inputType=
|allowedValues=
|values_from=
|showInGrid=
|isLink=false
|topic=Concept:City
|storemode=property
}}
[[Has type::text]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}

Property:City event


{{Property
|name=event
|label=event
|documentation=
|type=Special:Types/Page
|index=
|sortPos=
|primaryKey=
|mandatory=
|namespace=
|size=
|uploadable=
|defaultValue=
|inputType=dropdown
|allowedValues=
|values_from=concept=Event
|showInGrid=
|isLink=true
|topic=Concept:City
|storemode=property
}}
[[Has type::Page]]
This is a Property with type {{#show: {{FULLPAGENAMEE}} | ?Property type#- }}