首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何查询没有包含特定主题的图书的发布?XML/Xquery

如何查询没有包含特定主题的图书的发布?XML/Xquery
EN

Stack Overflow用户
提问于 2016-11-09 03:28:01
回答 1查看 43关注 0票数 0

我如何去查询一个出版商还没有出版任何关于特定主题的书籍呢?

我已经写了25本书,当我运行这本书时(我认为这会起作用)

代码语言:javascript
复制
/books/book[not(./topic="databases")]/publisher

它返回了所有的发布者。在数据库中应该至少有4本书,其中有2个不同的出版商,但是它们也会在查询时返回。

那么我该如何查询呢?不应该查询的出版商可能会这样做,因为他们有更多不在查询主题上的书籍。

编辑xml I查询:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<?oxygen RNGSchema="compact_oblig3.rnc" type="compact"?>

<bøker>
    <bok isbn="1111">
        <tittle>Objects first with java</tittle>
        <utgave>6</utgave>
        <forfatter>David J. Barnes</forfatter>
        <utgivelsesår>2016</utgivelsesår>
        <fagfelt>Programmering</fagfelt>
        <fagfelt>Databaser</fagfelt>
        <innholdsfortegnelse> 
            <komponent>En komponent</komponent>
        </innholdsfortegnelse>
        <forlag>Pearson Education<url>http://www.pearsoned.co.uk/</url>
            <kontaktinfo>
                <telefon>08456301111</telefon>
                <epost>customersolutions@pearson.com</epost>
            </kontaktinfo>
        </forlag>
    </bok>

    <bok isbn="9780321197849">
        <tittle>An Introduction to Database Systems</tittle>
        <utgave>8</utgave>
        <forfatter>C.J.Date</forfatter>
        <utgivelsesår>2004</utgivelsesår>
        <fagfelt>Databaser</fagfelt>
        <innholdsfortegnelse>
            <komponent> Continuing in the eighth edition, An Introduction to Database Systems
                provides a comprehensive introduction to the now very large field of database
                systems by providing a solid grounding in the foundations of database technology
                while shedding some light on how the field is likely to develop in the future. This
                new edition has been rewritten and expanded to stay current with database system
                trends. </komponent>
        </innholdsfortegnelse>
        <forlag>Pearson Education<url>https://www.pearsonhighered.com/program/Date-An-Introduction-to-Database-Systems-8th-Edition/PGM274345.html</url>
        </forlag>
    </bok>

    <bok isbn="9788215015224">
        <tittle>Databasesystemer</tittle>
        <utgave>2</utgave>
        <forfatter>Bjørn Kristoffersen</forfatter>
        <utgivelsesår>2009</utgivelsesår>
        <fagfelt>Databaser</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Universitetsforlaget<url>http://www.bokkilden.no/SamboWeb/produkt.do?produktId=4136282</url>
            <kontaktinfo>
                <telefon>24147500</telefon>
                <epost>post@universitetsforlaget.no</epost>
                <adresse>
                    <gate>Sehesteds gate</gate>
                    <gatenmr>3</gatenmr>
                    <postnmr>0164</postnmr>
                </adresse>
            </kontaktinfo>
        </forlag>
    </bok>

    <bok isbn="032141506">
        <tittle>Fundamentals of Database Systems</tittle>
        <utgave>5</utgave>
        <forfatter>Elmasri</forfatter>
        <forfatter>Navathe</forfatter>
        <utgivelsesår>2007</utgivelsesår>
        <fagfelt>Databaser</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Pearson Education<url>https://www.pearsonhighered.com/product/Elmasri-Fundamentals-of-Database-Systems-5th-Edition/9780321369574.html</url>
        </forlag>
    </bok>

    <bok isbn="9780195138573">
        <tittle>Mindware</tittle>
        <forfatter>Andy Clark</forfatter>
        <utgivelsesår>2001</utgivelsesår>
        <fagfelt>Filosofi</fagfelt>
        <fagfelt>Kognitiv vitenskap</fagfelt>
        <innholdsfortegnelse>
            <komponent> Mindware: An Introduction to the Philosophy of Cognitive Science invites
                readers to join in up-to-the-minute conceptual discussions of the fundamental
                issues, problems, and opportunities in cognitive science. Written by one of the most
                renowned scholars in the field, this vivid and engaging introductory text relates
                the story of the search for a cognitive scientific understanding of mind. This
                search is presented as a no-holds-barred journey from early work in artificial
                intelligence, through connectionist (artificial neural network) counter-visions, and
                on to neuroscience, artificial life, dynamics, and robotics. The journey ends with
                some wide-ranging and provocative speculation about the complex coadaptive dance
                between mind, culture, and technology. Each chapter opens with a brief sketch of a
                major research tradition or perspective, followed by short yet substantial critical
                discussions dealing with key topics and problems. Ranging across both standard
                philosophical territory and the landscape of cutting-edge cognitive science, Clark
                highlights challenging issues in an effort to engage readers in active debate.
                Topics covered include mental causation; machine intelligence; the nature and status
                of folk psychology; the hardware/software distinction; emergence; relations between
                life and mind; the nature of perception, cognition, and action; and the continuity
                (or otherwise) of high-level human intelligence with other forms of adaptive
                response. Numerous illustrations, text boxes, and extensive suggestions for further
                reading enhance the text's utility. Helpful appendices provide background
                information on dualism, behaviorism, identity theory, consciousness, and more. An
                exceptional text for introductory and more advanced courses in cognitive science and
                the philosophy of mind, Mindware is also essential reading for anyone interested in
                these fascinating and ever-changing fields. </komponent>
        </innholdsfortegnelse>
        <forlag>Oxford University Press<url>https://global.oup.com/academic/</url>
            <kontaktinfo>
                <telefon>4401865556767</telefon>
                <epost>onlinequeries.uk@oup.com</epost>
            </kontaktinfo>
        </forlag>
    </bok>

    <bok isbn="9780631229193">
        <tittle>Philosophy of computing and information</tittle>
        <redaktør>Luciano Floridi</redaktør>
        <utgivelsesår>2004</utgivelsesår>
        <fagfelt>Filosofi</fagfelt>
        <fagfelt>Kunnskapsrepresentasjon</fagfelt>
        <fagfelt>Kunstig Intelligens</fagfelt>
        <fagfelt>Programmering</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Wiley<url>http://www.wiley.com/WileyCDA/WileyTitle/productCd-0631229191.html</url>
            <kontaktinfo>
                <telefon>4962016060</telefon>
                <epost>info@wiley-vch.de</epost>
                <adresse>
                    <gate>Boschstrasse</gate>
                    <gatenmr>12</gatenmr>
                    <postnmr>69469</postnmr>
                </adresse>
            </kontaktinfo>
        </forlag>
    </bok>          

    <bok isbn="9780631218685">
        <tittle>Philosophy of Logic</tittle>
        <forfatter>Jacquette Dale</forfatter>
        <utgivelsesår>2002</utgivelsesår>
        <fagfelt>Filosofi</fagfelt>
        <fagfelt>Logikk</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Wiley<url>http://www.wiley.com/WileyCDA/WileyTitle/productCd-0631218688.html</url>
            <kontaktinfo>
                <telefon>4962016060</telefon>
                <epost>info@wiley-vch.de</epost>
                <adresse>
                    <gate>Boschstrasse</gate>
                    <gatenmr>12</gatenmr>
                    <postnmr>69469</postnmr>
                </adresse>
            </kontaktinfo>
        </forlag>
    </bok>

    <bok isbn="9780198752530">
        <tittle>A Survey of Metaphysics</tittle>
        <forfatter>E.J.Lowe</forfatter>
        <utgivelsesår>2002</utgivelsesår>
        <fagfelt>Filosofi</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Oxford University Press<url>https://global.oup.com/academic/</url>
            <kontaktinfo>
                <telefon>4401865556767</telefon>
                <epost>onlinequeries.uk@oup.com</epost>
            </kontaktinfo>
        </forlag>
    </bok>

    <bok isbn="9780262024754">
        <tittle>Knowledge and Mind: A Philosophical Introduction</tittle>
        <utgave>1</utgave>
        <forfatter>Robert. J. Stainton</forfatter>
        <forfatter>Andrew Brook</forfatter>
        <utgivelsesår>2000</utgivelsesår>
        <fagfelt>Filosofi</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>A Bradford Book<url>https://mitpress.mit.edu/category/imprint/bradford-book</url>
        </forlag>
    </bok>


    <bok isbn="9781412925686">
        <tittle>Cognitive Science</tittle>
        <utgave>1</utgave>
        <forfatter>Jay Friedenberg</forfatter>
        <forfatter>Gordon Silverman</forfatter>
        <utgivelsesår>2006</utgivelsesår>
        <fagfelt>Kognitiv vitenskap</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Sage Publications, Inc<url>https://uk.sagepub.com/en-gb/eur</url>
            <kontaktinfo>
                <telefon>4402073248500</telefon>
                <epost>market@sagepub.co.uk</epost>
            </kontaktinfo>
        </forlag>
    </bok>


    <bok isbn="9780262122320">
        <tittle>The logic of knowledge bases </tittle>
        <utgave>1</utgave>
        <forfatter>GerhaldLakemeyer</forfatter>
        <forfatter>Hector Levesque</forfatter>
        <utgivelsesår>2000</utgivelsesår>
        <fagfelt>Kunnskapsrepresentasjon</fagfelt>
        <fagfelt>Logikk</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>The MIT Press<url>https://mitpress.mit.edu/</url>
        </forlag>
    </bok>

    <bok isbn="9781558609327">
        <tittle>Knowledge Representation and Reasoning</tittle>
        <utgave>1</utgave>
        <forfatter>Ronald Brachman</forfatter>
        <forfatter>Hector Levesque</forfatter>
        <utgivelsesår>2004</utgivelsesår>
        <fagfelt>Kunnskapsrepresentasjon</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Morgan Kaufmann<url>http://store.elsevier.com/product.jsp?isbn=9781558609327</url>
        </forlag>
    </bok>

    <bok isbn="9780521150118">
        <tittle>The description logic handbook </tittle>
        <utgave>2</utgave>
        <redaktør>Daniele Nardi</redaktør>
        <redaktør>Franz Baader</redaktør>
        <redaktør>Diego Calvanese</redaktør>
        <utgivelsesår>2007</utgivelsesår>
        <fagfelt>Kunnskapsrepresentasjon</fagfelt>
        <fagfelt>Logikk</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Cambridge University Press<url>http://www.cambridge.org/</url>
            <kontaktinfo>
                <telefon>4401223358331</telefon>
                <epost>information@cambridge.org</epost>
            </kontaktinfo>
        </forlag>
    </bok>

    <bok isbn="9780444522115">
        <tittle>Handbook of Knowledge Representation</tittle>
        <utgave>1</utgave>
        <redaktør>Frank von Harmelen</redaktør>
        <redaktør>Vladimir Lifschitz</redaktør>
        <redaktør>Bruce Porter</redaktør>
        <utgivelsesår>2008</utgivelsesår>
        <fagfelt>Kunnskapsrepresentasjon</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Elsevier Science<url>http://store.elsevier.com/product.jsp?isbn=9780444522115</url>
        </forlag>
    </bok>

    <bok isbn="9780201403756">
        <tittle>Prolog Programming for Artificial Intelligence</tittle>
        <utgave>3</utgave>
        <forfatter>Ivan Bratko</forfatter>
        <utgivelsesår>2001</utgivelsesår>
        <fagfelt>Kunstig Intelligens</fagfelt>
        <fagfelt>Programmering</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Pearson Education<url>https://www.pearsonhighered.com/</url>
        </forlag>
    </bok>


    <bok isbn="9780470035610">
        <tittle>Computational Intelligence </tittle>
        <utgave>2</utgave>
        <forfatter>Andries P. Engelbrecht</forfatter>
        <utgivelsesår>2007</utgivelsesår>
        <fagfelt>Kunstig Intelligens</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Wiley<url>http://www.wiley.com/WileyCDA/</url>
            <kontaktinfo>
                <telefon>4962016060</telefon>
                <epost>info@wiley-vch.de</epost>
                <adresse>
                    <gate>Boschstrasse</gate>
                    <gatenmr>12</gatenmr>
                    <postnmr>69469</postnmr>
                </adresse>
            </kontaktinfo>
        </forlag>
    </bok>



    <bok isbn="9780137903955">
        <tittle> Artificial Intelligence - a modern approach </tittle>
        <utgave>2</utgave>
        <forfatter>Stuart Russell</forfatter>
        <forfatter>Peter Norvig</forfatter>
        <utgivelsesår>2003</utgivelsesår>
        <fagfelt>Kunstig Intelligens</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Pearson education<url>https://www.pearsonhighered.com/product/Russell-Artificial-Intelligence-A-Modern-Approach-2nd-Edition/9780137903955.html</url>
        </forlag>
    </bok>


    <bok isbn="9780763718435">
        <tittle>Discrete structures, logic and computability </tittle>
        <utgave>2</utgave>
        <forfatter>James L. Hein</forfatter>
        <utgivelsesår>2002</utgivelsesår>
        <fagfelt>Logikk</fagfelt>
        <fagfelt>Matematikk</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Jones and Bartlett Learning<url>http://www.jblearning.com/</url>
            <kontaktinfo>
                <telefon>8008320034</telefon>
            </kontaktinfo>
        </forlag>
    </bok>


    <bok isbn="9780521708777">
        <tittle>The mathematics of logic</tittle>
        <utgave>1</utgave>
        <forfatter>Richard W. Kaye</forfatter>
        <utgivelsesår>2007</utgivelsesår>
        <fagfelt>Logikk</fagfelt>
        <fagfelt>Matematikk</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Cambridge University Press<url>http://www.cambridge.org/ </url>
            <kontaktinfo>
                <telefon>4401223358331</telefon>
                <epost>information@cambridge.org</epost>
            </kontaktinfo>
        </forlag>
    </bok>


    <bok isbn="9780521365840">
        <tittle>Lattices and order </tittle>
        <utgave>1</utgave>
        <forfatter>B. A. Davey</forfatter>
        <forfatter>H. A. Priestley</forfatter>
        <utgivelsesår>1990</utgivelsesår>
        <fagfelt>Matematikk</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Cambridge University Press<url>http://www.cambridge.org/</url>
            <kontaktinfo>
                <telefon>4401223358331</telefon>
                <epost>information@cambridge.org</epost>
            </kontaktinfo>
        </forlag>
    </bok>


    <bok isbn="9780201730470">
        <tittle>Discrete Mathematics for Computing</tittle>
        <utgave>1</utgave>
        <forfatter>Rod Haggarty</forfatter>
        <utgivelsesår>2001</utgivelsesår>
        <fagfelt>Matematikk</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Pearson education<url>https://www.pearsonhighered.com/</url>
        </forlag>
    </bok>

    <bok isbn="978-0521478175">
        <tittle>Conceptual Mathematics: A First Introduction to Categories</tittle>
        <utgave>1</utgave>
        <forfatter>F. William Lawvere </forfatter>
        <forfatter>Stephen Hoel Schanuel</forfatter>
        <utgivelsesår>1997</utgivelsesår>
        <fagfelt>Matematikk</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>ELSEVIER<url>https://www.elsevier.com/</url>
        </forlag>
    </bok>


    <bok isbn="9780321392794">
        <tittle>Data Structures in Java</tittle>
        <utgave>1</utgave>
        <forfatter>Simon Gray</forfatter>
        <utgivelsesår>2007</utgivelsesår>
        <fagfelt>Programmering</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Pearson education<url>https://www.pearsonhighered.com/</url>
        </forlag>
    </bok>

    <bok isbn="978-0131374690">
        <tittle>Java software solutions</tittle>
        <utgave>3</utgave>
        <forfatter>John Lewis</forfatter>
        <forfatter>William Loftus</forfatter>
        <forfatter>Cara Cocking</forfatter>
        <utgivelsesår>2003</utgivelsesår>
        <fagfelt>Programmering</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>Pearson education<url>https://www.pearsonhighered.com/</url>
        </forlag>
    </bok>

    <bok isbn="9780262012423">
        <tittle>A Semantic Web Primer</tittle>
        <utgave>2</utgave>
        <forfatter>Grigoris Antoniou</forfatter>
        <forfatter>Frank van Harmelen</forfatter>
        <utgivelsesår>2004</utgivelsesår>
        <fagfelt>Web</fagfelt>
        <innholdsfortegnelse>
            <komponent/>
        </innholdsfortegnelse>
        <forlag>MIT Press<url>https://mitpress.mit.edu/books/semantic-web-primer</url>
        </forlag>
    </bok>

    <bok isbn="9780321269669">
        <tittle>An introduction to XML and techologies</tittle>
        <utgave>1</utgave>
        <forfatter>Anders Moller</forfatter>
        <forfatter>Michael Schwartzbach</forfatter>
        <utgivelsesår>2005</utgivelsesår>
        <fagfelt>XML</fagfelt>
        <fagfelt>Programmering</fagfelt>
        <fagfelt>Web</fagfelt>
        <innholdsfortegnelse>
            <komponent></komponent>
        </innholdsfortegnelse>
        <forlag>Pearson Education Cananda<url>http://www.pearsoncanada.ca/</url>
            <kontaktinfo>
                <telefon>18005673800</telefon>
                <epost>cs.canada@pearson.com</epost>
                <adresse>
                    <gate>Prince Andrew Place</gate>
                    <gatenmr>26</gatenmr>
                    <postnmr>416</postnmr>
                </adresse>
            </kontaktinfo>
        </forlag>
    </bok>

    <bok isbn="2222222">
        <tittle>Jeg er en bok om Xpath</tittle>
        <utgave>2</utgave>
        <forfatter>Thomas Petersson</forfatter>
        <utgivelsesår>2016</utgivelsesår>
        <fagfelt>XML</fagfelt>
        <innholdsfortegnelse>
            <komponent></komponent>
        </innholdsfortegnelse>
        <forlag> Mitt forlag <url>www.eksempelforlag.no</url>
        </forlag>
    </bok>

</bøker>

这是我写下的两本书,一本没有想要的主题,另一本有(fagfelt)

EN

回答 1

Stack Overflow用户

发布于 2016-11-09 20:21:14

Hej Peebl

这对我来说很有效,使用上面的示例XML:

代码语言:javascript
复制
bøker/bok[not(fagfelt = 'Databaser')]/forlag

在进行比较时,对文本进行规范化可能是个好主意。我通常将字符串比较包装在normalize space和大写字母中,这意味着您的查询需要稍微重新排序:

代码语言:javascript
复制
bøker/bok[not(
    fagfelt[normalize-space(upper-case(.)) = 'DATABASER']
)]/forlag

您还可以考虑使用FLWOR子句来实现这一点,该子句读起来更令人愉快:

代码语言:javascript
复制
for $bok in $my.test/bok
where not($bok[fagfelt[normalize-space(upper-case(.)) = 'DATABASER']])
return $bok/forlag
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40494924

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档