unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Balaji_Raj02
Posts: 6
Joined: Thu Jan 03, 2019 4:22 pm

unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by Balaji_Raj02 » Thu Jan 03, 2019 4:56 pm

Hi,

I am new to Oxygen,

From Oxygen XML Editor, when trying to open a bookmap containing maps & topics, am getting the following error on clicking topic or map reference.

"Unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map"

Following block is executed during oxygen editor initialization, to load the map file metadata in to keydefinition info object.

ro.sync.exml.workspace.api.editor.page.ditamap.keys.KeyDefinitionInfo.setProperty(KeyDefinitionInfo.DEFINITION_LOCATION, "D:/Oxygen/sample.ditamap");

ro.sync.exml.workspace.api.editor.page.ditamap.keys.KeyDefinitionInfo.setProperty(KeyDefinitionInfo.HREF, "myMapFileName.dita"); (My Map file name refers to the Map which i am clicking from oxygen xml editor. My Map file & bookmap file is located in D:/Oxygen)

Oxygen JAR Version : 19.0.0.0

Kindly share your thoughts to resolve this issue.

Regards,
Balaji

sorin_carbunaru
Site Admin
Posts: 226
Joined: Mon May 09, 2016 9:37 am

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by sorin_carbunaru » Fri Jan 04, 2019 12:52 pm

Hello Balaji,

You must also set the name of the key:

Code: Select all

keyDefInfo.setProperty(KeyDefinitionInfo.NAME, "map");
Regards,
Sorin Carbunaru
oXygen XML

Balaji_Raj02
Posts: 6
Joined: Thu Jan 03, 2019 4:22 pm

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by Balaji_Raj02 » Fri Jan 11, 2019 6:03 pm

Thanks for your response Sorin Carbunaru.

As you said name property is set. Following are the properties used,

Code: Select all



String mapName = "Map Name"

keyDefinitionInfo.setProperty(KeyDefinitionInfo.NAME, mapName );

KeyDefinitionInfo.setProperty(KeyDefinitionInfo.DEFINITION_LOCATION, "D:/Oxygen/sample.ditamap");

KeyDefinitionInfo.setProperty(KeyDefinitionInfo.HREF, "myMapFileName.dita");

keyDefinitionInfo.setProperty(KeyDefinitionInfo.IS_SUBJECT_DEF, false);

keyDefinitionInfo.setProperty(KeyDefinitionInfo.META_CONTENT_PROVIDER, new MetaContentProvider() {
@Override
public String getContent(String s) {
return mapName ;
}
});

keyDefinitionInfo.setProperty(KeyDefinitionInfo.SUBJECT_DEF_CHILDREN, null);

sorin_carbunaru
Site Admin
Posts: 226
Joined: Mon May 09, 2016 9:37 am

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by sorin_carbunaru » Fri Jan 11, 2019 6:35 pm

Hmmm... I saw you error complains about a key names "map", while the name you set is "Map Name". Do you have any other key defined, which has the "NAME" argument set to "map"? If not, you should do that.

If changing the name from "Map Name" to "map" is not the solution, I will need more information about what exactly you are trying to do and some more snippets of code, such as entire methods, especially the one that defines all the keys.

Balaji_Raj02
Posts: 6
Joined: Thu Jan 03, 2019 4:22 pm

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by Balaji_Raj02 » Thu Feb 14, 2019 4:48 pm

After inserting map in bookmap following block is generated,

Code: Select all

<mapref keyref="map_00001" id="mapref-5278318c-8431-479a-b646-d22e64e08ab6"/>
Following is the code block used to generated the above fragment.

Code: Select all

String mapName = "map_00001" // File Name

keyDefinitionInfo.setProperty(KeyDefinitionInfo.NAME, mapName );

KeyDefinitionInfo.setProperty(KeyDefinitionInfo.DEFINITION_LOCATION, "D:/Oxygen/sample.ditamap");

KeyDefinitionInfo.setProperty(KeyDefinitionInfo.HREF, "map_00001.dita");

keyDefinitionInfo.setProperty(KeyDefinitionInfo.IS_SUBJECT_DEF, false);

keyDefinitionInfo.setProperty(KeyDefinitionInfo.META_CONTENT_PROVIDER, new MetaContentProvider() {
@Override
public String getContent(String s) {
return mapName ;
}
});

keyDefinitionInfo.setProperty(KeyDefinitionInfo.SUBJECT_DEF_CHILDREN, null);
Let me know any other attributes has to included.

sorin_carbunaru
Site Admin
Posts: 226
Joined: Mon May 09, 2016 9:37 am

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by sorin_carbunaru » Thu Feb 14, 2019 5:03 pm

Can you also post the error message again? I want to see if it changed in any way.

Balaji_Raj02
Posts: 6
Joined: Thu Jan 03, 2019 4:22 pm

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by Balaji_Raj02 » Mon Feb 18, 2019 1:49 pm

Error message is the same
"Clicked on a map link in a book map and get an unresolved key reference message: Could not find definition for key "…" kays are provided b: Root Map"

sorin_carbunaru
Site Admin
Posts: 226
Joined: Mon May 09, 2016 9:37 am

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by sorin_carbunaru » Mon Feb 18, 2019 4:14 pm

Hello,

Please check the value selected for the "Root map" in the DITA Maps Manager (DMM). See: https://www.oxygenxml.com/doc/versions/ ... __root-map. It should be "External Imposed".

I tried with the following...

First, the code for setting the custom DITA key definition manager:

Code: Select all


	    // Key definition
final KeyDefinitionInfo keyDefinitionInfo = new KeyDefinitionInfo();
keyDefinitionInfo.setProperty(KeyDefinitionInfo.NAME, "map_00001");
keyDefinitionInfo.setProperty(KeyDefinitionInfo.DEFINITION_LOCATION, "D:/sample.ditamap");
keyDefinitionInfo.setProperty(KeyDefinitionInfo.HREF, "http://www.oxygenxml.com");
keyDefinitionInfo.setProperty(KeyDefinitionInfo.IS_SUBJECT_DEF, false);
keyDefinitionInfo.setProperty(KeyDefinitionInfo.META_CONTENT_PROVIDER, new MetaContentProvider() {
@Override
public String getContent(String s) {
return "META-CONTENT" ;
}
});
keyDefinitionInfo.setProperty(KeyDefinitionInfo.SUBJECT_DEF_CHILDREN, null);

// Set the custom DITA key definition manager
KeyDefinitionManager keyDefinitionManager = new KeyDefinitionManager() {
@Override
public List<KeyDefinitionInfo> getContextKeyDefinitions() {
ArrayList<KeyDefinitionInfo> list = new ArrayList<>();
list.add(keyDefinitionInfo);
return list;
}
};
pluginWorkspaceAccess.setDITAKeyDefinitionManager(keyDefinitionManager);
Then, in a random topic I added this:

Code: Select all

<ph keyref="map_00001"/>
Everything worked fine when I set the root map in the DMM to "External Imposed". When I changed it to another map, let's say "flowers.ditamap" from our samples, I got a very similar message to yours.

So, the key to solving your problems seems to be choosing the right value for the root map combo box: "External Imposed".


sorin_carbunaru
Site Admin
Posts: 226
Joined: Mon May 09, 2016 9:37 am

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by sorin_carbunaru » Thu Feb 21, 2019 2:45 pm

It is an entry that is displayed in the "Root map" combo in the "DITA Maps Manager" view when you impose a key manager. It means that the keys are gathered from your API, not from a .ditamap file from a drive.

Balaji_Raj02
Posts: 6
Joined: Thu Jan 03, 2019 4:22 pm

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by Balaji_Raj02 » Mon Feb 25, 2019 9:00 am

We tried the same way you suggested , but it didn't work
I also found that
1)if both map and topic is in different folders, it wont work. so I kept in same folder
2) keys attribute is needed
3)keyscope is defined as "local"
4)keyref is mentioned as ""local.keyref"

It works .

EG:
<topicref keyref="local.topic_sfssfsf.dita" keys="topic_sfssfsf.dita" keyscope="local" navtitle="tyu"
id="topicref-sfsfs-434354fdf-4fdsfdsf-ddf"
href="topic_sfssfsf.dita"/>

sorin_carbunaru
Site Admin
Posts: 226
Joined: Mon May 09, 2016 9:37 am

Re: unresolved key reference message: Could not find definition for key "map" keys are provided by: ABC Root Map

Post by sorin_carbunaru » Mon Feb 25, 2019 11:10 am

If it doesn't work if the map and the topic are in different folders, this means that the HREF of the key is probably not correct. It should be defined relative to DEFINITION_LOCATION.

By the way, can you tell us why you needed to implement a custom KeysDefinitionManager instead of using the default one from the DITA Maps Manager? I mean you could define the keys manually in the DITA map (i.e. write the XML "keydef" elements) and let oXygen gather the keys for you...

I recommend you to read though our userguide to get a bit more familiar with oXygen. You could try reading the following, for example:
1. About the DITA Maps Manager: https://www.oxygenxml.com/doc/versions/ ... ments.html and the sub-topics (at least some of them, the ones that seem most interesting to you).
2. About using keys: https://www.oxygenxml.com/doc/versions/ ... -keys.html. Also see the related information at the bottom.

Post Reply