should BXCollection.listResources always throw an exception?
Friday, 15 April 2011 · 7 messages · last reply 17 Apr 2011
MG
Meredith Gregory15 Apr 2011 02:19 #
Dear BaseXers,
So far, BaseX has been a lot of fun to work with! Thanks for all your efforts on this codebase.
i've got a couple of questions, though.
- Whether i've got no documents in a freshly created BXCollection, or i've ensured that there is at least one document present, a call to listResources always throws an IndexOutOfBounds exception. Is that the intended behavior?
- The reason i'm using this API is that i need to be able to update a single document in a collection guaranteed to have exactly one document. So, i thought i would simply ask the BXCollection to list it's resources, grab the first one (since there should only be one) and then use the id from the list returned by that API in subsequent queries. Maybe that's not the preferred approach? Is there a better one?
Any help would be greatly appreciated.
Best wishes,
--greg
override def getCollection( createIfMissing : Boolean )(
xmlCollStr : String
) : Option[Collection] = {
try {
// BUGBUG -- LGM the semantics of BXCollection a little // different than createIfMissing; and requires catching the // database not found exception
Some( new BXCollection( xmlCollStr, true ) )
}
catch {
case e : XMLDBException => {
val bxColl = new BXCollection( xmlCollStr, false )
val document =
bxColl.createResource(
null, XMLResource.RESOURCE_TYPE
).asInstanceOf[XMLResource]
document.setContent( "<database></database>" )
bxColl.storeResource( document )
Some( bxColl )
}
case _ => None
}
}
override def update( xmlCollStr : String )(
cnxn : CnxnCtxtLabel[Namespace,Var,String]
) : Unit = {
for( xmlColl <- getCollection( true )( xmlCollStr ) ) {
val resourceList : Array[String] = xmlColl.listResources if ( resourceList.size == 0 ) {
val document =
xmlColl.createResource(
null, XMLResource.RESOURCE_TYPE
).asInstanceOf[XMLResource]
document.setContent( xmlIfier.asXML( cnxn ).toString )
xmlColl.storeResource( document )
}
else {
val cnxnElem = xmlIfier.asXML( cnxn )
cnxnElem match {
case cElem : Elem => {
delete( xmlCollStr, resourceList( 0 ) )( cElem )
insert( xmlCollStr, resourceList( 0 ) )( cElem )
}
case _ => {
throw new Exception( "record is not an XML element" )
}
}
}
}
}
<tweet>storing to db : org.basex.api.xmldb.BXDatabase@77dc754 pair :
record(contactMeUsing(email),
{"com.biosimilarity.lift.model.store.MonadicTermTypes_-Ground":{"v":{"@class":"string","$":"for
the win Mikail.Mauz at gmail.com"},"_-outer":{"@class":"com.biosimilarity.lift.model.store.PersistedMonadicTS$TheMTT$"}}})
in coll : Squibble</tweet>
java.lang.IndexOutOfBoundsException
at java.io.RandomAccessFile.readBytes(Native Method)
at java.io.RandomAccessFile.read(RandomAccessFile.java:322)
at java.io.RandomAccessFile.readFully(RandomAccessFile.java:381)
at org.basex.io.DataAccess.cursor(DataAccess.java:225)
at org.basex.io.DataAccess.readToken(DataAccess.java:147)
at org.basex.data.DiskData.txt(DiskData.java:213)
at org.basex.data.DiskData.text(DiskData.java:181)
at org.basex.api.xmldb.BXCollection.listResources(BXCollection.java:128)
at
com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$$anonfun$update$1.apply(BaseXXMLPersist.scala:313)
at
com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$$anonfun$update$1.apply(BaseXXMLPersist.scala:312)
at scala.Option.foreach(Option.scala:185)
at
com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$class.update(BaseXXMLPersist.scala:312)
at
com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction.update(PersistedMonadicTermStore.scala:321)
at
com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12$$anonfun$apply$13.apply(PersistedMonadicTermStore.scala:468)
at
com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12$$anonfun$apply$13.apply(PersistedMonadicTermStore.scala:459)
at scala.Option.foreach(Option.scala:185)
at
com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12.apply(PersistedMonadicTermStore.scala:459)
at
com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12.apply(PersistedMonadicTermStore.scala:458)
at scala.Option.foreach(Option.scala:185)
at
com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3.apply(PersistedMonadicTermStore.scala:458)
at
com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3.apply(PersistedMonadicTermStore.scala:458)
at scala.util.continuations.package$.run(package.scala:30)
at scala.concurrent.cpsops$$anonfun$spawn$1.apply$mcV$sp(cpsops.scala:9)
at
scala.concurrent.FJTaskRunners$FJTaskRunner$$anon$1.compute(FJTaskRunners.scala:21)
at jsr166y.forkjoin.RecursiveAction.exec(RecursiveAction.java:247)
at jsr166y.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:286)--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SW
Seattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
CG
Christian Grün15 Apr 2011 16:28 #
Dear Meredith,
could you provide us with a Java example that allows us to quickly reproduce the bug? Apart from that, please note that we're
discouraging the use of the XML:DB and XQJ APIs, esp. if they are used in parallel to our own API. Instead, to retrieve the number of documents, you could as well run an XQuery expression such as the following one:
count ( db:open ( "NameOfDB" ) )
Hope this helps,
Christian
Quoted text · Meredith Gregory · 131 lines
On Fri, Apr 15, 2011 at 12:19 AM, Meredith Gregory <lgreg.meredith at gmail.com> wrote: > Dear BaseXers, > So far, BaseX has been a lot of fun to work with! Thanks for all your > efforts on this codebase. > i've got a couple of questions, though. > > Whether i've got no documents in a freshly created BXCollection, or i've > ensured that there is at least one document present, a call to listResources > always throws an IndexOutOfBounds exception. Is that the intended behavior? > The reason i'm using this API is that i need to be able to update a single > document in a collection guaranteed to have exactly one document. So, i > thought i would simply ask the BXCollection to list it's resources, grab the > first one (since there should only be one) and then use the id from the list > returned by that API in subsequent queries. Maybe that's not the preferred > approach? Is there a better one? > > Any help would be greatly appreciated. > Best wishes, > --greg > override def getCollection( createIfMissing : Boolean )( > xmlCollStr : String > ) : Option[Collection] = { > try { > // BUGBUG -- LGM the semantics of BXCollection a little > // different than createIfMissing; and requires catching the > // database not found exception > Some( new BXCollection( xmlCollStr, true ) ) > } > catch { > case e : XMLDBException => { > val bxColl = new BXCollection( xmlCollStr, false ) > val document = > bxColl.createResource( > null, XMLResource.RESOURCE_TYPE > ).asInstanceOf[XMLResource] > document.setContent( "<database></database>" ) > bxColl.storeResource( document ) > Some( bxColl ) > } > case _ => None > } > } > override def update( xmlCollStr : String )( > cnxn : CnxnCtxtLabel[Namespace,Var,String] > ) : Unit = { > for( xmlColl <- getCollection( true )( xmlCollStr ) ) { > val resourceList : Array[String] = xmlColl.listResources > if ( resourceList.size == 0 ) { > val document = > xmlColl.createResource( > null, XMLResource.RESOURCE_TYPE > ).asInstanceOf[XMLResource] > document.setContent( xmlIfier.asXML( cnxn ).toString ) > xmlColl.storeResource( document ) > } > else { > val cnxnElem = xmlIfier.asXML( cnxn ) > cnxnElem match { > case cElem : Elem => { > delete( xmlCollStr, resourceList( 0 ) )( cElem ) > insert( xmlCollStr, resourceList( 0 ) )( cElem ) > } > case _ => { > throw new Exception( "record is not an XML element" ) > } > } > } > } > } > <tweet>storing to db : org.basex.api.xmldb.BXDatabase@77dc754 pair : > record(contactMeUsing(email), > {"com.biosimilarity.lift.model.store.MonadicTermTypes_-Ground":{"v":{"@class":"string","$":"for > the win > Mikail.Mauz at gmail.com"},"_-outer":{"@class":"com.biosimilarity.lift.model.store.PersistedMonadicTS$TheMTT$"}}}) > in coll : Squibble</tweet> > java.lang.IndexOutOfBoundsException > at java.io.RandomAccessFile.readBytes(Native Method) > at java.io.RandomAccessFile.read(RandomAccessFile.java:322) > at java.io.RandomAccessFile.readFully(RandomAccessFile.java:381) > at org.basex.io.DataAccess.cursor(DataAccess.java:225) > at org.basex.io.DataAccess.readToken(DataAccess.java:147) > at org.basex.data.DiskData.txt(DiskData.java:213) > at org.basex.data.DiskData.text(DiskData.java:181) > at org.basex.api.xmldb.BXCollection.listResources(BXCollection.java:128) > at > com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$$anonfun$update$1.apply(BaseXXMLPersist.scala:313) > at > com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$$anonfun$update$1.apply(BaseXXMLPersist.scala:312) > at scala.Option.foreach(Option.scala:185) > at > com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$class.update(BaseXXMLPersist.scala:312) > at > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction.update(PersistedMonadicTermStore.scala:321) > at > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12$$anonfun$apply$13.apply(PersistedMonadicTermStore.scala:468) > at > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12$$anonfun$apply$13.apply(PersistedMonadicTermStore.scala:459) > at scala.Option.foreach(Option.scala:185) > at > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12.apply(PersistedMonadicTermStore.scala:459) > at > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12.apply(PersistedMonadicTermStore.scala:458) > at scala.Option.foreach(Option.scala:185) > at > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3.apply(PersistedMonadicTermStore.scala:458) > at > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3.apply(PersistedMonadicTermStore.scala:458) > at scala.util.continuations.package$.run(package.scala:30) > at scala.concurrent.cpsops$$anonfun$spawn$1.apply$mcV$sp(cpsops.scala:9) > at > scala.concurrent.FJTaskRunners$FJTaskRunner$$anon$1.compute(FJTaskRunners.scala:21) > at jsr166y.forkjoin.RecursiveAction.exec(RecursiveAction.java:247) > at jsr166y.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:286) > -- > L.G. Meredith > Managing Partner > Biosimilarity LLC > 7329 39th Ave SW > Seattle, WA 98136 > > +1 206.650.3740 > > http://biosimilarity.blogspot.com > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > >
CG
Hi Greg,
thanks for your mail. You might want to have a look at the following page in our Wiki, where some basic examples are listed how our API can be accessed (..we invite everyone to actively extend our Wiki pages):
http://docs.basex.org/wiki/Code_Examples
Here is one more example how you can directly request the number of documents in the currently opened database:
public final class Test {
public static void main(final String[] args) throws Exception {
// single, global database context,
// which should be used for all database operations
Context ctx = new Context();
// open new database
new Open("database").execute(ctx);
// request and count document nodes
System.out.println(ctx.doc().length);
// finally close context
ctx.close();
}
}We don't have resources to develop a more thorough documentation of our API for free. Instead, a comprehensive documentation will be a future feature of our commercial portfolio. You also might want to have a closer look into the project's JavaDoc.
Hope this helps,
Christian
Quoted text · Meredith Gregory · 18 lines
On Fri, Apr 15, 2011 at 10:10 PM, Meredith Gregory <lgreg.meredith at gmail.com> wrote: > Dear Christian, > Thanks! i was coming to that conclusion from reading through the examples on > github, but it is a bit of detective work. It has been hard for me from the > posted code samples and wiki to find a clear indication of which APIs are > supported and the use of which is encouraged and which APIs are not so much > in this category. Admittedly, i've been focused on reading through the > material that looks like it might be applicable to my problem and not on > thoroughly reading your documentation. Is there a page in the wiki or a > readme in the examples codebase that describes the status of the various > APIs? > In this particular case, is there a code sample you can point me to that > would flesh out your proposal a bit more. In particular, though i'm issuing > the count calculation at the XQuery level i need to take action on the basis > of the result at the Java/Scala level. > Best wishes, > --greg
MG
Dear Christian,
Thanks! i was coming to that conclusion from reading through the examples on github, but it is a bit of detective work. It has been hard for me from the posted code samples and wiki to find a clear indication of which APIs are supported and the use of which is encouraged and which APIs are not so much in this category. Admittedly, i've been focused on reading through the material that looks like it might be applicable to my problem and not on thoroughly reading your documentation. Is there a page in the wiki or a readme in the examples codebase that describes the status of the various APIs?
In this particular case, is there a code sample you can point me to that would flesh out your proposal a bit more. In particular, though i'm issuing the count calculation at the XQuery level i need to take action on the basis of the result at the Java/Scala level.
Best wishes,
--greg
On Fri, Apr 15, 2011 at 7:28 AM, Christian Grün
<christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 169 lines
> Dear Meredith, > > could you provide us with a Java example that allows us to quickly > reproduce the bug? Apart from that, please note that we're > discouraging the use of the XML:DB and XQJ APIs, esp. if they are used > in parallel to our own API. Instead, to retrieve the number of > documents, you could as well run an XQuery expression such as the > following one: > > count ( db:open ( "NameOfDB" ) ) > > Hope this helps, > Christian > > ___________________________ > > On Fri, Apr 15, 2011 at 12:19 AM, Meredith Gregory > <lgreg.meredith at gmail.com> wrote: > > Dear BaseXers, > > So far, BaseX has been a lot of fun to work with! Thanks for all your > > efforts on this codebase. > > i've got a couple of questions, though. > > > > Whether i've got no documents in a freshly created BXCollection, or i've > > ensured that there is at least one document present, a call to > listResources > > always throws an IndexOutOfBounds exception. Is that the intended > behavior? > > The reason i'm using this API is that i need to be able to update a > single > > document in a collection guaranteed to have exactly one document. So, i > > thought i would simply ask the BXCollection to list it's resources, grab > the > > first one (since there should only be one) and then use the id from the > list > > returned by that API in subsequent queries. Maybe that's not the > preferred > > approach? Is there a better one? > > > > Any help would be greatly appreciated. > > Best wishes, > > --greg > > override def getCollection( createIfMissing : Boolean )( > > xmlCollStr : String > > ) : Option[Collection] = { > > try { > > // BUGBUG -- LGM the semantics of BXCollection a little > > // different than createIfMissing; and requires catching the > > // database not found exception > > Some( new BXCollection( xmlCollStr, true ) ) > > } > > catch { > > case e : XMLDBException => { > > val bxColl = new BXCollection( xmlCollStr, false ) > > val document = > > bxColl.createResource( > > null, XMLResource.RESOURCE_TYPE > > ).asInstanceOf[XMLResource] > > document.setContent( "<database></database>" ) > > bxColl.storeResource( document ) > > Some( bxColl ) > > } > > case _ => None > > } > > } > > override def update( xmlCollStr : String )( > > cnxn : CnxnCtxtLabel[Namespace,Var,String] > > ) : Unit = { > > for( xmlColl <- getCollection( true )( xmlCollStr ) ) { > > val resourceList : Array[String] = xmlColl.listResources > > if ( resourceList.size == 0 ) { > > val document = > > xmlColl.createResource( > > null, XMLResource.RESOURCE_TYPE > > ).asInstanceOf[XMLResource] > > document.setContent( xmlIfier.asXML( cnxn ).toString ) > > xmlColl.storeResource( document ) > > } > > else { > > val cnxnElem = xmlIfier.asXML( cnxn ) > > cnxnElem match { > > case cElem : Elem => { > > delete( xmlCollStr, resourceList( 0 ) )( cElem ) > > insert( xmlCollStr, resourceList( 0 ) )( cElem ) > > } > > case _ => { > > throw new Exception( "record is not an XML element" ) > > } > > } > > } > > } > > } > > <tweet>storing to db : org.basex.api.xmldb.BXDatabase@77dc754 pair : > > record(contactMeUsing(email), > > > {"com.biosimilarity.lift.model.store.MonadicTermTypes_-Ground":{"v":{"@class > ":"string","$":"for > > the win > > Mikail.Mauz at gmail.com"},"_-outer":{"@class > ":"com.biosimilarity.lift.model.store.PersistedMonadicTS$TheMTT$"}}}) > > in coll : Squibble</tweet> > > java.lang.IndexOutOfBoundsException > > at java.io.RandomAccessFile.readBytes(Native Method) > > at java.io.RandomAccessFile.read(RandomAccessFile.java:322) > > at java.io.RandomAccessFile.readFully(RandomAccessFile.java:381) > > at org.basex.io.DataAccess.cursor(DataAccess.java:225) > > at org.basex.io.DataAccess.readToken(DataAccess.java:147) > > at org.basex.data.DiskData.txt(DiskData.java:213) > > at org.basex.data.DiskData.text(DiskData.java:181) > > at org.basex.api.xmldb.BXCollection.listResources(BXCollection.java:128) > > at > > > com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$$anonfun$update$1.apply(BaseXXMLPersist.scala:313) > > at > > > com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$$anonfun$update$1.apply(BaseXXMLPersist.scala:312) > > at scala.Option.foreach(Option.scala:185) > > at > > > com.biosimilarity.lift.model.store.xml.BaseXCnxnStorage$class.update(BaseXXMLPersist.scala:312) > > at > > > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction.update(PersistedMonadicTermStore.scala:321) > > at > > > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12$$anonfun$apply$13.apply(PersistedMonadicTermStore.scala:468) > > at > > > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12$$anonfun$apply$13.apply(PersistedMonadicTermStore.scala:459) > > at scala.Option.foreach(Option.scala:185) > > at > > > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12.apply(PersistedMonadicTermStore.scala:459) > > at > > > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3$$anonfun$apply$12.apply(PersistedMonadicTermStore.scala:458) > > at scala.Option.foreach(Option.scala:185) > > at > > > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3.apply(PersistedMonadicTermStore.scala:458) > > at > > > com.biosimilarity.lift.model.store.PersistedTermStoreScope$PersistedMonadicGeneratorJunction$$anonfun$putInStore$3.apply(PersistedMonadicTermStore.scala:458) > > at scala.util.continuations.package$.run(package.scala:30) > > at scala.concurrent.cpsops$$anonfun$spawn$1.apply$mcV$sp(cpsops.scala:9) > > at > > > scala.concurrent.FJTaskRunners$FJTaskRunner$$anon$1.compute(FJTaskRunners.scala:21) > > at jsr166y.forkjoin.RecursiveAction.exec(RecursiveAction.java:247) > > at > jsr166y.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:286) > > -- > > L.G. Meredith > > Managing Partner > > Biosimilarity LLC > > 7329 39th Ave SW > > Seattle, WA 98136 > > > > +1 206.650.3740 > > > > http://biosimilarity.blogspot.com > > > > _______________________________________________ > > BaseX-Talk mailing list > > BaseX-Talk at mailman.uni-konstanz.de > > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk > > > > >
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SW
Seattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
CG
Thanks Greg,
I've updated our docs a little.
Hope this helps,
Christian
Quoted text · Meredith Gregory · 85 lines
On Sun, Apr 17, 2011 at 5:09 AM, Meredith Gregory <lgreg.meredith at gmail.com> wrote: > Dear Christian, > Thanks for that thoughtful reply! i really appreciate it. i think i was just > noting that your wiki page lists 4 distinct APIs. A sentence saying which is > actively supported and the use of which is encouraged might save some people > (like me! ;-) a lot of time. ;-) > Best wishes, > --greg > > On Fri, Apr 15, 2011 at 2:55 PM, Christian Grün <christian.gruen at gmail.com> > wrote: >> >> Hi Greg, >> >> thanks for your mail. You might want to have a look at the following >> page in our Wiki, where some basic examples are listed how our API can >> be accessed (..we invite everyone to actively extend our Wiki pages): >> >> http://docs.basex.org/wiki/Code_Examples >> >> Here is one more example how you can directly request the number of >> documents in the currently opened database: >> >> public final class Test { >> public static void main(final String[] args) throws Exception { >> // single, global database context, >> // which should be used for all database operations >> Context ctx = new Context(); >> // open new database >> new Open("database").execute(ctx); >> // request and count document nodes >> System.out.println(ctx.doc().length); >> // finally close context >> ctx.close(); >> } >> } >> >> We don't have resources to develop a more thorough documentation of >> our API for free. Instead, a comprehensive documentation will be a >> future feature of our commercial portfolio. You also might want to >> have a closer look into the project's JavaDoc. >> >> Hope this helps, >> Christian >> ___________________________ >> >> On Fri, Apr 15, 2011 at 10:10 PM, Meredith Gregory >> <lgreg.meredith at gmail.com> wrote: >> > Dear Christian, >> > Thanks! i was coming to that conclusion from reading through the >> > examples on >> > github, but it is a bit of detective work. It has been hard for me from >> > the >> > posted code samples and wiki to find a clear indication of which APIs >> > are >> > supported and the use of which is encouraged and which APIs are not so >> > much >> > in this category. Admittedly, i've been focused on reading through the >> > material that looks like it might be applicable to my problem and not on >> > thoroughly reading your documentation. Is there a page in the wiki or a >> > readme in the examples codebase that describes the status of the various >> > APIs? >> > In this particular case, is there a code sample you can point me to that >> > would flesh out your proposal a bit more. In particular, though i'm >> > issuing >> > the count calculation at the XQuery level i need to take action on the >> > basis >> > of the result at the Java/Scala level. >> > Best wishes, >> > --greg > > > > -- > L.G. Meredith > Managing Partner > Biosimilarity LLC > 7329 39th Ave SW > Seattle, WA 98136 > > +1 206.650.3740 > > http://biosimilarity.blogspot.com >
MG
Dear Christian,
Thanks for that thoughtful reply! i really appreciate it. i think i was just noting that your wiki page lists 4 distinct APIs. A sentence saying which is actively supported and the use of which is encouraged might save some people (like me! ;-) a lot of time. ;-)
Best wishes,
--greg
On Fri, Apr 15, 2011 at 2:55 PM, Christian Grün
<christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 58 lines
> Hi Greg, > > thanks for your mail. You might want to have a look at the following > page in our Wiki, where some basic examples are listed how our API can > be accessed (..we invite everyone to actively extend our Wiki pages): > > http://docs.basex.org/wiki/Code_Examples > > Here is one more example how you can directly request the number of > documents in the currently opened database: > > public final class Test { > public static void main(final String[] args) throws Exception { > // single, global database context, > // which should be used for all database operations > Context ctx = new Context(); > // open new database > new Open("database").execute(ctx); > // request and count document nodes > System.out.println(ctx.doc().length); > // finally close context > ctx.close(); > } > } > > We don't have resources to develop a more thorough documentation of > our API for free. Instead, a comprehensive documentation will be a > future feature of our commercial portfolio. You also might want to > have a closer look into the project's JavaDoc. > > Hope this helps, > Christian > ___________________________ > > On Fri, Apr 15, 2011 at 10:10 PM, Meredith Gregory > <lgreg.meredith at gmail.com> wrote: > > Dear Christian, > > Thanks! i was coming to that conclusion from reading through the examples > on > > github, but it is a bit of detective work. It has been hard for me from > the > > posted code samples and wiki to find a clear indication of which APIs are > > supported and the use of which is encouraged and which APIs are not so > much > > in this category. Admittedly, i've been focused on reading through the > > material that looks like it might be applicable to my problem and not on > > thoroughly reading your documentation. Is there a page in the wiki or a > > readme in the examples codebase that describes the status of the various > > APIs? > > In this particular case, is there a code sample you can point me to that > > would flesh out your proposal a bit more. In particular, though i'm > issuing > > the count calculation at the XQuery level i need to take action on the > basis > > of the result at the Java/Scala level. > > Best wishes, > > --greg >
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SW
Seattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
MG
Dear Christian,
Thanks!
Best wishes,
--greg
On Sat, Apr 16, 2011 at 8:20 PM, Christian Grün
<christian.gruen at gmail.com>wrote:
Quoted text · Christian Grün · 102 lines
> Thanks Greg, > > I've updated our docs a little. > Hope this helps, > Christian > ___________________________ > > On Sun, Apr 17, 2011 at 5:09 AM, Meredith Gregory > <lgreg.meredith at gmail.com> wrote: > > Dear Christian, > > Thanks for that thoughtful reply! i really appreciate it. i think i was > just > > noting that your wiki page lists 4 distinct APIs. A sentence saying which > is > > actively supported and the use of which is encouraged might save some > people > > (like me! ;-) a lot of time. ;-) > > Best wishes, > > --greg > > > > On Fri, Apr 15, 2011 at 2:55 PM, Christian Grün < > christian.gruen at gmail.com> > > wrote: > >> > >> Hi Greg, > >> > >> thanks for your mail. You might want to have a look at the following > >> page in our Wiki, where some basic examples are listed how our API can > >> be accessed (..we invite everyone to actively extend our Wiki pages): > >> > >> http://docs.basex.org/wiki/Code_Examples > >> > >> Here is one more example how you can directly request the number of > >> documents in the currently opened database: > >> > >> public final class Test { > >> public static void main(final String[] args) throws Exception { > >> // single, global database context, > >> // which should be used for all database operations > >> Context ctx = new Context(); > >> // open new database > >> new Open("database").execute(ctx); > >> // request and count document nodes > >> System.out.println(ctx.doc().length); > >> // finally close context > >> ctx.close(); > >> } > >> } > >> > >> We don't have resources to develop a more thorough documentation of > >> our API for free. Instead, a comprehensive documentation will be a > >> future feature of our commercial portfolio. You also might want to > >> have a closer look into the project's JavaDoc. > >> > >> Hope this helps, > >> Christian > >> ___________________________ > >> > >> On Fri, Apr 15, 2011 at 10:10 PM, Meredith Gregory > >> <lgreg.meredith at gmail.com> wrote: > >> > Dear Christian, > >> > Thanks! i was coming to that conclusion from reading through the > >> > examples on > >> > github, but it is a bit of detective work. It has been hard for me > from > >> > the > >> > posted code samples and wiki to find a clear indication of which APIs > >> > are > >> > supported and the use of which is encouraged and which APIs are not so > >> > much > >> > in this category. Admittedly, i've been focused on reading through the > >> > material that looks like it might be applicable to my problem and not > on > >> > thoroughly reading your documentation. Is there a page in the wiki or > a > >> > readme in the examples codebase that describes the status of the > various > >> > APIs? > >> > In this particular case, is there a code sample you can point me to > that > >> > would flesh out your proposal a bit more. In particular, though i'm > >> > issuing > >> > the count calculation at the XQuery level i need to take action on the > >> > basis > >> > of the result at the Java/Scala level. > >> > Best wishes, > >> > --greg > > > > > > > > -- > > L.G. Meredith > > Managing Partner > > Biosimilarity LLC > > 7329 39th Ave SW > > Seattle, WA 98136 > > > > +1 206.650.3740 > > > > http://biosimilarity.blogspot.com > > >
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SW
Seattle, WA 98136
+1 206.650.3740
http://biosimilarity.blogspot.com
Written for BaseX 6.6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery