Re: [MarkLogic Dev General] Issues with MarkLogic Function in SPARQL Queries in Query Console

2017-08-01 Thread Steven Anderson
Thanks for the solution.  At the root of my confusion was this part of the
doc:

"For the prefix IRIs commonly associated with fn, cts, math, and xdmp (or
any other prefix IRIs that do not end with a "/" or "#"), append a # to the
prefix IRI to the prefix IRI and then the function localname, for example:
http://marklogic.com/cts#contains/;

I read the first saying that anything that's documented as fn: should use
the marklogic.com path.

But to your point, it also says, "Extension functions in SPARQL are
identified by IRIs in the form of http://www.w3.org/2005/xpath-functions#
*name*/ where *name* is the local name of the function and the string
before the # is the prefix IRI of the function, for example
http://www.w3.org/2005/xpath-functions#starts-with/;

Apparently if something is in both (aren't all fn: in the xpath-functions?)
I need to use the w3.org path.

   Steve


On Tue, Aug 1, 2017 at 7:07 AM, Christopher Hamlin <cbham...@gmail.com>
wrote:

> Try the same prefix for fn, rather than the cts one:
>
> PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
>
> I did see the other mistake in the doc, so I'll report that.  This I
> didn't find, so just a copy/paste error in testing?
>
> On Mon, Jul 31, 2017 at 5:56 PM, Steven Anderson <sander...@salesforce.com
> > wrote:
>
>> Yup, that worked, thanks.  Any ideas on why the fn: namespace version
>> isn't working?
>>
>> On Mon, Jul 31, 2017 at 1:29 PM, Christopher Hamlin <cbham...@gmail.com>
>> wrote:
>>
>>> I removed the trailing / in the function name here (after 'starts-with'):
>>>
>>> <http://www.w3.org/2005/xpath-functions#starts-with/>( ?o, "sf" ) )
>>>
>>> and the error went away.  Does that work for you?
>>>
>>> ___
>>> General mailing list
>>> General@developer.marklogic.com
>>> Manage your subscription at:
>>> http://developer.marklogic.com/mailman/listinfo/general
>>>
>>>
>>
>>
>> --
>>
>>  Steve
>>
>> ___
>> General mailing list
>> General@developer.marklogic.com
>> Manage your subscription at:
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>>
>
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>


-- 

 Steve
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Issues with MarkLogic Function in SPARQL Queries in Query Console

2017-07-31 Thread Steven Anderson
Yup, that worked, thanks.  Any ideas on why the fn: namespace version isn't
working?

On Mon, Jul 31, 2017 at 1:29 PM, Christopher Hamlin 
wrote:

> I removed the trailing / in the function name here (after 'starts-with'):
>
> ( ?o, "sf" ) )
>
> and the error went away.  Does that work for you?
>
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>


-- 

 Steve
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Make string XML "safe" in xquery

2017-07-29 Thread Steven Anderson
I know that the text string between the start and end tags contains no XML,
only text with no markup.

My plan is to put the text string between the open and close title tags as
part of a larger text string that I want to convert to an XML document via
xdmp:unquote .

Sounds like I'll be whipping up my own function based on fn:replace.

   Steve

On Jul 29, 2017, at 12:39 AM, Jason Hunter <jason.hun...@marklogic.com>
wrote:

Why do you have malformed xml like that?

How do you reliably know what's tags and what's string?

Your plan is to preprocess the text to make it well-formed xml so it can be
unquoted?

Sent from my iPhone

On Jul 29, 2017, at 14:08, Steven Anderson <sander...@salesforce.com> wrote:

Within the larger context, I have a string like this:

A title for  the product

that I'm then converting into an xml document node using xdmp:unquote.

That makes xdmp:unquote barf, but if I do a fn:replace, on the specific
characters it works.

As I said, I can whip something up, but I assumed there was an obvious
function for this.

  Steve

On Jul 28, 2017, at 10:28 PM, Jason Hunter <jason.hun...@marklogic.com>
wrote:

In normal XQuery you don't need to do this. Are you sure you do?

Maybe you just need:

{ $value }

The value will be properly escaped on output.

Sent from my iPhone

On Jul 29, 2017, at 13:01, Steven Anderson <sander...@salesforce.com> wrote:

I could do that, but I just figured there'd be a xquery function do to it
for all three special XML characters.  It's easy enough to write one, but I
just assumed that someone else would have needed it.

On Jul 28, 2017, at 9:12 PM, Indrajeet Verma <indrajeet.ve...@gmail.com>
wrote:

Steve - Did you try using fn:replace? e.g. fn:replace(fn:replace($title,
"<", "lt;"), ">", "gt;")


On Sat, Jul 29, 2017 at 5:32 AM, Steve Anderson <steve.ander...@gmail.com>
wrote:

> I have a string like this:
>
> A title for  the product
>
> and I'd like to replace it with
>
> A title for placeholder the product
>
> Basically, I want to make the a valid XML text node, fixing greater than,
> less than, and ampersands.  I thought I could make xdmp:quote do that, but,
> perhaps because it's Friday afternoon, I can't find the right options to
> make it work.
>
> Is there any easy solution I can't find?
>
>Steve
>
>
>
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Make string XML "safe" in xquery

2017-07-29 Thread Steven Anderson
Within the larger context, I have a string like this:

A title for  the product

that I'm then converting into an xml document node using xdmp:unquote.

That makes xdmp:unquote barf, but if I do a fn:replace, on the specific
characters it works.

As I said, I can whip something up, but I assumed there was an obvious
function for this.

  Steve

On Jul 28, 2017, at 10:28 PM, Jason Hunter <jason.hun...@marklogic.com>
wrote:

In normal XQuery you don't need to do this. Are you sure you do?

Maybe you just need:

{ $value }

The value will be properly escaped on output.

Sent from my iPhone

On Jul 29, 2017, at 13:01, Steven Anderson <sander...@salesforce.com> wrote:

I could do that, but I just figured there'd be a xquery function do to it
for all three special XML characters.  It's easy enough to write one, but I
just assumed that someone else would have needed it.

On Jul 28, 2017, at 9:12 PM, Indrajeet Verma <indrajeet.ve...@gmail.com>
wrote:

Steve - Did you try using fn:replace? e.g. fn:replace(fn:replace($title,
"<", "lt;"), ">", "gt;")


On Sat, Jul 29, 2017 at 5:32 AM, Steve Anderson <steve.ander...@gmail.com>
wrote:

> I have a string like this:
>
> A title for  the product
>
> and I'd like to replace it with
>
> A title for placeholder the product
>
> Basically, I want to make the a valid XML text node, fixing greater than,
> less than, and ampersands.  I thought I could make xdmp:quote do that, but,
> perhaps because it's Friday afternoon, I can't find the right options to
> make it work.
>
> Is there any easy solution I can't find?
>
>Steve
>
>
>
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Make string XML "safe" in xquery

2017-07-28 Thread Steven Anderson
I could do that, but I just figured there'd be a xquery function do to it
for all three special XML characters.  It's easy enough to write one, but I
just assumed that someone else would have needed it.

On Jul 28, 2017, at 9:12 PM, Indrajeet Verma 
wrote:

Steve - Did you try using fn:replace? e.g. fn:replace(fn:replace($title,
"<", "lt;"), ">", "gt;")


On Sat, Jul 29, 2017 at 5:32 AM, Steve Anderson 
wrote:

> I have a string like this:
>
> A title for  the product
>
> and I'd like to replace it with
>
> A title for placeholder the product
>
> Basically, I want to make the a valid XML text node, fixing greater than,
> less than, and ampersands.  I thought I could make xdmp:quote do that, but,
> perhaps because it's Friday afternoon, I can't find the right options to
> make it work.
>
> Is there any easy solution I can't find?
>
>Steve
>
>
>
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>
___
General mailing list
General@developer.marklogic.com
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general


Re: [MarkLogic Dev General] Is there a way to delete a stand-alone properties document?

2017-05-19 Thread Steven Anderson
Thanks, that worked like a charm.

On Fri, May 19, 2017 at 2:23 PM, Justin Makeig 
wrote:

> First, why are you working with "stand-alone [un-sic.] properties
> documents"? Could your implementation be simplified by storing the
> properties in their own documents? There's no real advantage to a
> properties fragment, other than being able to access it with the same URI
> as its related document. Accessing the contents still requires a join
> between two fragments, just like with two separate documents.
>
> In your particular case, you should be able to remove the properties
> fragment with, xdmp:node-delete(xdmp:document-properties($uri)).
>
> Justin
>
> > On May 19, 2017, at 4:06 PM, Steve Anderson 
> wrote:
> >
> > I'm doing some work with stand-along properties documents, and I want to
> be able to delete them.  I know I can delete all the properties with a
> >
> > xdmp:document-set-properties($uri, ())
> >
> > but that leaves an empty properties document hanging around.  Is there a
> way to delete it?
> >
> > Thanks,
> >
> >   Steve
> > ___
> > General mailing list
> > General@developer.marklogic.com
> > Manage your subscription at:
> > http://developer.marklogic.com/mailman/listinfo/general
>
>
> ___
> General mailing list
> General@developer.marklogic.com
> Manage your subscription at:
> http://developer.marklogic.com/mailman/listinfo/general
>
>


-- 

 Steve
___
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general