We have an Externally Managed Taxonomy (EMT) and have been using a node's name to map records to the hierarchy. We are now hitting a problem because some of the node names in the hierarchy are duplicated. Ids are used to make the nodes in the EMT unique, but I haven't found documentation on how to use something other than name to map a record. For example, how do I map a records to child_2 below, rather than child_1 if both are named "A child"?
Root [id=root]
|-One parent #id=parent_1 #parent=root
| '- A child #id=child_1 #parent=parent_1
'-Other parent #id=parent_2 #parent=root
'- A child #id=child 2 #parent=parent_2
If you read through the DTD File (for instance C:\Endeca\PlatformServices\11.1.0\conf\dtd\external_dimensions.dtd ), you can try the following.
<node name="One" id="1" classify="false">
<synonym name="1"/>
</node>
... where you could specify alternative values as the synonyms. "One" would be displayed. If your source data has "One", it would not map (because classify=false). Your source data would have to have "1" in order to be mapped.
I'm not 100% sure since I don't have an EMT to play with, FYI.
Related
I'm working with sensenet and I have something confusing when I create a node in code behind on server side, I need to add a reference field to my node but I don't know how to do that.
I tried some thing like node["user"] = node1
but it doesn't work.
All Content (data) in Sensenet is structured as a binary tree where a Node refers to a particular Content object as specified in it's Content Type Definition (CTD). When a Node references another Node -- that is, it points to another location in the tree -- it can be one of two types.
It can either point to any node, or
It can be constrained to be a
particular type, as specified in the CTD.
If you correctly assign a Reference but get an error, it is likely that you are violating the type constraint in the CTD. See examples below.
CTD for reference Node of a particular type (partial)
<ContentType name="Agent" parentType="GenericContent" handler="Code.ContentHandlers.Agent" xmlns="http://schemas.sensenet.com/SenseNet/ContentRepository/ContentTypeDefinition">
<DisplayName>Agent</DisplayName>
<Icon>Content</Icon>
<Fields>
<Field name="Category" type="Reference">
<DisplayName>Agent Category</DisplayName>
<Description></Description>
<Configuration>
<AllowedTypes>
<Type>AgentCategory</Type>
</AllowedTypes>
<VisibleBrowse>Show</VisibleBrowse>
</Configuration>
</Field>
</Fields>
</ContentType>
Example C# code of assigning a Node to the Category Reference defined above.
var path = "/Root/PathToAgentCategory";
var agentCat = Node.LoadNode(path) as AgentCategory;
myAgentNode.Category = agentCat; // Syntax if you have a ContentHandler
myAgentNode["Category"] = agentCat; // Syntax for the GenericContent ContentHandler
you should read it's document
I find to add a reference field, you should use some thing like this
node.Addreferences("User", user1);
user1 is one node represent for a user that you need to reference n your field
My current xml node is :
<Item xsi:type="itm:Resource">
<ID>10</ID>
</Item>
I want to read the whole tag and search whether Resource is there or not in that tag :
SelectSingleNode.OuterXml.Contains("Resource")
But Outer xml is considering all the tags inside Item , I just want for the current node
Have tried other properties like name,value which indeeds return only "Item"
I have done it in a slightly different way
SelectSingleNode("xPath").Attributes(0).Value.Contains("Resource")
Hope this helps
Example I have an input xml,
<root>
<first>
<a>2</a>
</first>
<first>
<a>3</a>
</first>
<first>
<a>4</a>
</first>
</root>
That should be mapped to,
<root>
<a>2</a>
<a>3</>
<a>4</a>
</root>
I already have output xsd defined that is derived from second xml above but I don't see the mapping in my target because it is one level.
First xml has 3 level and second one is 2 level. So I could not map the child element mapping.
Look at the Branch tangs in the attached image.
You just need to set a mapping where for each input.first -> for each input.a create a output.a.
This is doine using the element mapping controls at the top center (over the lines).
I have to create a mapping between two xsd schemas, where the input document contains a list (sequence) of elements, each of which maps to a single output document. Moreover, each output document should include top level input data that is not a part of the list. To illustrate the problem, the input document contains data about a customer (contact info, etc) and list of invoices for them, and the output should be multiple documents, each containing one invoice and the customer data.
Can I somehow do this using DataMapper or some other approach? If I create a mapping between the input list elements and the output document, DataMapper will output an aggregation of all the created output documents. It also seems that I can not refer to the input top level elements from inside the "list element to output document" mapping.
Supposing root element in your source XSD contained a list of "Item" elements, you could first split the document into Items:
<splitter expression="#[xpath('//Item')]" doc:name="Splitter" enableCorrelation="IF_NOT_SET"/>
And then after the splitter use a DataMapper to map the Item elements to a target element in your other XSD. DataMapper requires that "Item" also be a root element in your source XSD in order to do the mapping from XSD to XSD. If it's not possible/desirable to make "Item" a root element in the source XSD, then you could create a sample XML and use DataMapper to generate an XSD from that. Otherwise you could roll your own transformer or use the XSLT transformer.
In my SQL 2008 database table, I have one column name AUTHOR that contains XML data. The XML is not well formed and has data like below
<Author>
<ID>172-32-1176</ID>
<LastName>White</LastName>
<FirstName>Johnson</FirstName>
<Address>
<Street>10932 Bigge Rd.</Street>
<City>Menlo Park</City>
<State>CA</State>
</Address>
</Author>
Some XML have all of above data and some have just one tag.
<ID>172-32-1176</ID>
I want to write query that returns me a column as identiry.
I tried using AUTHOR.query('data(/Author/ID)') as identity but it fails when XML does not have Author node.
Thanks,
Vijay
Have you tried something like /Author/ID|/ID ? i.e. try for the first scenario, and with no match, the second ?
(note that the | operator is a set union operator, as described here)
In case that nothing "certain" can be maintained about the XML, except that a unique ID element contains the required identity value, then the following XPath expression selects the ID element:
//ID