Bug 748168 - Enable Relationships in Content Specs
Summary: Enable Relationships in Content Specs
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: PressGang CCMS
Classification: Community
Component: CSProcessor
Version: 1.x
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Lee Newson
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 749735 751252
TreeView+ depends on / blocked
 
Reported: 2011-10-22 17:14 UTC by Joshua Wulf
Modified: 2014-10-19 22:59 UTC (History)
2 users (show)

Fixed In Version: 0.16.0
Clone Of:
Environment:
Last Closed: 2012-02-22 03:03:13 UTC
Embargoed:


Attachments (Terms of Use)

Description Joshua Wulf 2011-10-22 17:14:06 UTC
Content Spec Syntax:

  Existing Topic Title [32] [R345]
The existing topic with Topic ID 32 is specified, and is related to
Topic 345.

  New Topic Title [N1, Concept] [R32, 35]
A new concept topic is specified and is related to topics 32 and 35.

  New Topic Title [N, Task] [RN1]
A new task topic is specified and is related to the new topic N1.

==Processing during import==

* All [R...]
* All Nx relationships are rewritten with the new topic IDs.
* All R references are then checked to ensure that all related topics
are included in the Content Spec. For example, if a content spec
includes Topic 32 and declares a relationship to topic 345, then topic
345 has to be included in the Content Spec.
* All R references are checked to ensure that the targets of all
relationship is unambiguous. This means that a relationship target
cannot be included in a Content Spec in more than one place.

==Processing during building==

During building:

For any topic with one or more relationships declared in the Content Spec:

Locate the </section> tag in the topic.
Insert a "Related:" formalpara block before this tag, with the following
format:

 <formalpara>
   <title>Related:</title>
   <para><itemizedlist>
    [FOR EACH RELATED TOPIC]
     <listitem><para><xref linkend="XYZ"/></para></listitem>
    [END:FOR]
   </listitem></para>
 </formalpara>

The value of XYZ is the value that you assign as the id attribute for
unique topics when building the output (CSBuilder spec TOPIC PROCESSING
section, step 2).

==Example==

Here's an example:

--begin Content Spec fragment--

Chapter: Publican book translation
  Push Publican source strings using the Python client [378] [R402]
  Push a Publican project with existing translations using the Python
client [405] [R379]

Chapter: Translation Reuse and Merging
  Section: Reusing Previous translations
    Copy Trans [402]
    Copy Trans Algorithm [403]
    When Copy Trans is performed [404]
  Section: Merging translations
    Target string merging [379]
    Merge Auto algorithm [406]
    Merge Import algorithm [407]

--end Content Spec fragment--

So in the ouput, we'd have something that looks like:

--begin Plaintext mockup of Publican output--

Push Publican source strings using the Python client
 1. Do this
 2. Do that
 3. Do something else

 Result: Your strings are pushed to the server

 Related:
  * Copy Trans

--end Plaintext mockup of Publican output--

--begin example Docbook output--

<section id="topic378">
  <title>Push Publican source strings using the Python client</title>

  <procedure>
    <step><para>Do this</para></step>
    <step><para>Do that</para></step>
    <step><para>Do something else</para></step>
  </procedure>

  <formalpara><title>Result:</title>
    <para>Your strings are pushed to the server</para>
  </formalpara>

  <formalpara>
    <title>Related:</title>
    <para><itemizedlist>
        <listitem><para><xref linkend="topic402"></para></listitem>
    </itemizedlist></para>
  </formalpara>
</section>

--end example Docbook output--

Comment 1 Joshua Wulf 2011-10-22 17:25:20 UTC
Second priority.

Think about this while implementing the piece above, and try to design to make this possible / easy to implement. If there turns out to be an elegant solution that enables this at the same time, then by all means do them together.

Allow a chapter or a section to be a relationship target.

So, we need two things.

1. The ability to identify a Chapter or Section
2. The ability to specify a Chapter or Section a relationship target

In the Content Spec:

The CS Syntax needs to allow an identifier for a Chapter or Section, so that it can be specified as a target.

It can't be numerical, for the obvious reason that this would ambiguous with topics. N (New Topic identifier), X (reuse New Topic) and C (Clone existing topic) are already taken. Perhaps Z?

Chapter Z23:
 Section Z44:

In Docbook:

Currently Chapters and Sections are written out by the builder with no id attribute. In order to be a link target for an xref they'll require a unique id. Chapter and Section names are not guaranteed to be unique, so simply the name is not reliable.

Comment 2 Joshua Wulf 2011-10-27 02:45:38 UTC
Can we make Prerequisite relationships part of the tier 1 requirement...?


Syntax Option 1:
Existing Topic Title [32] [R345] [P23, 45]

Syntax Option 2:
Existing Topic Title [32] [R345, P23, P45]

renders as:

<section>
  <title>Existing Topic Title</title>
  
  <formalpara>
    <title>Prerequisites</title>
    <para>
      <itemizedlist>
        <listitem><para><xref linkend="topic23"/></para></listitem>
        <listitem><para><xref linkend="topic45"/></para></listitem>
      </itemizedlist>
    </para>

   [Topic 32 content is here]

  <formalpara>
    <title>Related:</title>
    <para><itemizedlist>
        <listitem><para><xref linkend="topic345"></para></listitem>
    </itemizedlist></para>
  </formalpara>
</section>

Comment 3 Joshua Wulf 2011-10-28 04:47:27 UTC
Target aliases.

This allows us to:

* include the same topic more than one time in the output (reuse from single source) *and*
* have each of those occurrence have its own unique ID and be a target for relationship links
* specify chapters and sections as targets for relationships

Here is the syntax by example:

1. Specify a new topic in a content spec, include it somewhere else in the book, and have both of those occurrences as a distinct relationship target.
2. Specify a section as a target

Chapter: Fun and Games
  New Topic [N1, Concept] [T1]
  I Point to the first New Topic [23] [R:T1]
  New Topic [X1] [T2] 
  I Point to the second occurrence of New Topic [34] [R:T2, 345]
  Section: I Can be a target too! [T3]
    Some Content [345]
    Some more Content [456]
    New Topic [X1]

Chapter: More Fun and Games
  Did you read that section first? [678] [R:T2] [P:T3] [next:] [prev:]
  Some more Content [456] [T5]
  Make sure you read Some more Content first! [N, Task] [P:T5]

So:

To enable as a link target a chapter or section:
* Add [Txx] after the chapter or section title, where T is the "Target" key glyph, and xxx is a unique numerical ID

To enable as a link target a topic that is included multiple times (whether existing or new):
* Add [Txx] after the [TopicID] specifier (for existing topics), [Nxxx] specifier (for new topics), or [Xyyy] specifier (for reoccurrences of a new topic)

[P: x,y,z] specifies the prerequisites of the topic. These are injected after the topic's <title> element as an itemizedlist with the title "Prerequisites".

[R: x,y,z] specifies the related topics for the topic. These are injected before the topic's </section> tag as an itemizedlist with the title "See also:"

[next: x] takes a single argument and specifies the "Next" topic in a process. It is injected before the related topics (if any exist - so it should be injected before the </section> element before related topics are injected) as:

<para role="next-link">Next: <xref linkend="target_topic_docbook_id"/></para>

[prev: x] takes a single argument and specifies the "Previous" topic in a process. It is injected before the Prerequisites (so after the <title> before Prerequisites are processed) as:

<para role="previous-link">Previous: <xref linkend="target_topic_docbook_id"/></para>

Comment 4 Lee Newson 2011-11-11 05:55:54 UTC
New Feature has been added. 

Relationships can be either a Related, Prerequisite, Next or Previous relationship.

Target's can be applied to any Topic, Chapter, Section or Appendix. Each Topic, Chapter, Section or Appendix may only have one target.

Topic ID's can be used within a relationship if and only if that Topic is used once within the Content Spec. As such all Duplicated Topics can't be directly related. To be able to relate to these topics Targets must be used.

Related Relationships are used by specifying the Related sequence and then a list of Topic or Target ID's. ie [R: 567, N3, T5]

Prerequisite Relationships are used by specifying the Prerequisite sequence and then a list of Topic or Target ID's. ie [P: 567, N3, T5]

Next Relationships are used by specifying the Next keyword and then a Topic or Target ID. ie [Next: 569]

Previous Relationships are used by specifying the Prev keyword and then a Topic or Target ID. ie [Prev: 239]

The book building process will also now incorporate the relationships. Previous relationships will always be under the title, followed by prerequisites. Related topics will be at the very end of the topic and above that will be the Next relationship. Each relationship type is only added if a relationship exists for that type.

Along with the book building, topics now have different names and are duplicated where required. Sections also have a unique ID that corresponds to the LevelID field in the database.

Comment 5 Joshua Wulf 2011-12-12 01:51:39 UTC
Please avoid using the "Next" and "Previous" relationship types. We are going to obsolete those with bug 749735, which implements a more sophisticated entity, "Process", that supports conditional branching.

Comment 6 Joshua Wulf 2012-02-22 03:03:13 UTC
Verified with:


CSProcessor client version: 0.17.0
Web Service at http://csprocessor.cloud.lab.eng.bne.redhat.com:8080/ version: 0.21.4


Note You need to log in before you can comment on or make changes to this bug.