[xquery-talk] contains function problem
Howard Katz
howardk at fatdog.com
Sat Jan 7 07:58:15 PST 2006
Note that contains() has several signatures. Your statement:
where contains( "//Mpeg7:Name/text()", "Moras" )
is asking if the literal string, "//MPeg7:Name/text()", contains the literal
text, "Moras". It doesn't. What you want is the statement:
where contains( //Mpeg7:Name/text(), "Moras" )
Howard
_____
From: talk-bounces at xquery.com [mailto:talk-bounces at xquery.com] On Behalf Of
Manolis Mylonakis
Sent: January 7, 2006 6:18 AM
To: talk at xquery.com
Subject: [xquery-talk] contains function problem
hello,
i have a problem with 'contains' function of xquery.
I have the following xml file named myPersons.xml
<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Description xsi:type="SemanticDescriptionType">
<Semantics>
<AbstractionLevel dimension="0"/>
<Label>
<Name>Soccer Agent Example</Name>
</Label>
<Property>
<Name>Something</Name>
<Definition>socceragents</Definition>
</Property>
<SemanticBase xsi:type="AgentObjectType" id="Moras">
<AbstractionLevel dimension="0"/>
<Label>
<Name>Moras</Name>
</Label>
<Definition>
<FreeTextAnnotation>Vaggelis Moras</FreeTextAnnotation>
</Definition>
<Agent xsi:type="PersonType">
<Name>
<FamilyName initial="M">Moras</FamilyName>
<GivenName>Vaggelis</GivenName>
</Name>
<ElectronicAddress>
<Email>players at aekfc.gr</Email>
</ElectronicAddress>
</Agent>
</SemanticBase>
</Semantics>
<Semantics>
<AbstractionLevel dimension="0"/>
<Label>
<Name>Soccer Agent Example</Name>
</Label>
<Property>
<Name>teacher </Name>
<Definition>university teacher</Definition>
</Property>
<SemanticBase xsi:type="AgentObjectType" id="Moras">
<AbstractionLevel dimension="0"/>
<Label>
<Name>Dolas</Name>
</Label>
<Definition>
<FreeTextAnnotation>Apostolos Dolas</FreeTextAnnotation>
</Definition>
<Agent xsi:type="PersonType">
<Name>
<FamilyName initial="M">Dolas</FamilyName>
<GivenName>Apostolos</GivenName>
</Name>
<ElectronicAddress>
<Email>dol at mymail.gr</Email>
</ElectronicAddress>
</Agent>
</SemanticBase>
</Semantics>
</Description>
</Mpeg7>
I ask for the email address for a person who has a <Name> as Moras for
example...
my xquery is the following:
xquery version "1.0";
declare namespace Mpeg7="urn:mpeg:mpeg7:schema:2001";
for $x in doc("myPersons.xml")//Mpeg7:Semantics
where contains("//Mpeg7:Name/text()","Moras")
return $x//Email
none results returned
what is my fault?
Thanks
Manolis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20060107/9108c9ab/attachment-0001.htm
More information about the talk
mailing list