RDFConnection fetch() issue?

2018-01-20 Thread Claude Warren
I am working with an RDFConnection to a Fuseki server.

The server is set up as

DatasetGraph serverdsg = DatasetGraphFactory.createTxnMem();
FusekiServer server = FusekiServer.make( 3030, "/ds", serverdsg );
server.start();

I have called

ARQ.enableBlankNodeResultLabels(true);

It seems that  the fetch() and query() results for the same graph are
different.

calling

connection.query( "SELECT ?s ?p ?o  WHERE {  ?s ?p ?o }" )

yields different blank node ID from

connection.fetch();

and

connection.queryConstruct( "CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }" );

yields a different blank nodes from either of the above.


I'm not sure if this is a defect or an undocumented feature, or perhaps a
bit of both.

I can understand that the "fetch" is different as is simply gets a TURTLE
dump of the db and so the blank nodes might be renumbered.  But I would
expect that the construct should return the same node values -- then again,
perhaps not as it is a new model as well.

If this is not a bug (and I am beginning to suspect it isn't) I think the
javadoc should be updated to specify when the
ARQ.enableBlankNodeResultLabels(true); is in play and when it is not.

Claude


-- 
I like: Like Like - The likeliest place on the web

LinkedIn: http://www.linkedin.com/in/claudewarren


[jira] [Commented] (JENA-1459) add highlighting support to jena-text

2018-01-20 Thread Code Ferret (JIRA)

[ 
https://issues.apache.org/jira/browse/JENA-1459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=1631#comment-1631
 ] 

Code Ferret commented on JENA-1459:
---

I've added documentation for the highlighting feature to the Jena Text 
documentation and committed via "Improve this page".

> add highlighting support to jena-text
> -
>
> Key: JENA-1459
> URL: https://issues.apache.org/jira/browse/JENA-1459
> Project: Apache Jena
>  Issue Type: Improvement
>  Components: Jena, Text
>Affects Versions: Jena 3.6.0
>Reporter: Code Ferret
>Assignee: Code Ferret
>Priority: Major
> Fix For: Jena 3.7.0
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> This issue proposes an improvement to jena-text to include optional 
> highlighting of results via:
> {{org.apache.lucene.search.highlight.Highlighter}}
> and 
> {{org.apache.lucene.search.highlight.SimpleHTMLFormatter}}
> The improvement will add an optional input argument to {{TextQueryPF}} that 
> signals that highlighting should be performed on the Lucene search results; 
> optionally indicates the _start_ and _end_ char sequences of a highlighted 
> term; optionally indicates the maximum number of fragments to highlight; and 
> optionally indicates a fragment separator.
> The highlighted results are bound to the {{?literal}} output argument of  
> {{TextQueryPF}}.
> Inclusion of this improvement will introduce a simple extraction of the 
> _highlight_ option string and a single test for the presence of the option 
> string so that the inclusion of the improvement will be of minimal impact 
> when highlighting is not used. The _highlight_ option string is passed 
> directly to {{TextIndex.query(...)}} and so can be used from code other than 
> {{TextQueryPF}}.
> The simplest use of highlighting is like:
> {code}
> select ?s ?lit
> where {
>   (?s ?sc ?lit) text:query (skos:prefLabel "one" 100 "lang:en" "highlight:") .
> }
> {code}
> which will produce results such as:
> {code}
> "another ↦one↤ abc"@en
> {code}
> the right-arrow (\u21a6) and left-arrow (\u21a4) are the default _start_ and 
> _end_ highlighting character sequences. These are chosen to be very unlikely 
> to occur in literals. These can be changed easily via {{"s:"}} and {{"e:"}} 
> in the highlight options, for example:
> {code}
> select ?s ?lit
> where {
>   (?s ?sc ?lit) text:query (skos:prefLabel "one" 100 "lang:en" "highlight: 
> s: | e:") .
> {code}
> which will produce results such as:
> {code}
> "another one abc"@en
> {code}
> Coding of this improvement is complete and a PR can be issued if there is 
> agreement that this improvement should be included in jena-text.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


CMS diff: Jena Full Text Search

2018-01-20 Thread Chris Tomlinson
Clone URL (Committers only):
https://cms.apache.org/redirect?new=anonymous;action=diff;uri=http://jena.apache.org/documentation%2Fquery%2Ftext-query.mdtext

Chris Tomlinson

Index: trunk/content/documentation/query/text-query.mdtext
===
--- trunk/content/documentation/query/text-query.mdtext (revision 1821724)
+++ trunk/content/documentation/query/text-query.mdtext (working copy)
@@ -2,6 +2,8 @@
 
 Title: Jena Full Text Search
 
+Title: Jena Full Text Search
+
 This extension to ARQ combines SPARQL and full text search via
 [Lucene](https://lucene.apache.org) 6.4.1 or
 [ElasticSearch](https://www.elastic.co) 5.2.1 (which is built on
@@ -80,6 +82,7 @@
 -   [Queries with graphs](#queries-with-graphs)
 -   [Queries across multiple `Fields`](#queries-across-multiple-fields)
 -   [Queries with _Boolean Operators_ and _Term 
Modifiers_](#queries-with-boolean-operators-and-term-modifiers)
+-   [Highlighting](#highlighting)
 -   [Good practice](#good-practice)
 -   [Configuration](#configuration)
 -   [Text Dataset Assembler](#text-dataset-assembler)
@@ -242,6 +245,7 @@
 | query string  | Lucene query string fragment   |
 | limit | (optional) `int` limit on the number of results   |
 | lang:xx   | (optional) language tag spec   |
+| highlight:xx  | (optional) highlighting options|
 
 The `property` URI is only necessary if multiple properties have been
 indexed and the property being searched over is not the [default field
@@ -258,8 +262,10 @@
 indexed with the tag _xx_. Searches may be restricted to field values with no 
 language tag via `"lang:none"`. 
 
-If both `limit` and `lang:xx` are present, then `limit` must precede `lang:xx`.
+The `highlight:xx` specification is an optional string where _xx_ are options 
that control the highlighting of search result literals. See 
[below](#highlighting) for details.
 
+If both `limit` and one or more of `lang:xx` or `highlight:xx` are present, 
then `limit` must precede these arguments.
+
 If only the query string is required, the surrounding `( )` _may be_ omitted.
 
  Output arguments:
@@ -495,7 +501,52 @@
 **Always surround the query string with `( )` if more than a single term or 
phrase
 are involved.**
 
+ Highlighting
 
+The highlighting option uses the Lucene `Highlighter` and 
`SimpleHTMLFormatter` to insert highlighting markup into the literals returned 
from search results (hence the text dataset must be configured to store the 
literals). The highlighted results are returned via the _literal_ output 
argument.
+
+The simplest way to request highlighting is via `'highlight:'`. This will 
apply all the defaults:
+
+| Option | Key | Default |
+||-|-|
+| maxFrags | m: | 3 |
+| fragSize | z: |  128 |
+| start | s: | RIGHT_ARROW |
+| end | e: | LEFT_ARROW |
+| fragSep | f: | DIVIDES |
+| joinHi | jh: | true |
+| joinFrags | jf: | true |
+
+to the highlighting of the search results. For example if the query is:
+
+(?s ?sc ?lit) text:query ( "brown fox" "highlight:" ) 
+
+then a resulting literal binding might be:
+
+"the quick ↦brown fox↤ jumped over the lazy baboon"
+
+The `RIGHT_ARROW` is Unicode \u21a6 and the `LEFT_ARROW` is Unicode \u21a4. 
These are chosen to be single characters that in most situations will be very 
unlikely to occur in resulting literals. The `fragSize` of 128 is chosen to be 
large enough that in many situations the matches will result in single 
fragments. If the literal is larger than 128 characters and there are several 
matches in the literal then there may be additional fragments separated by the 
`DIVIDES`, Unicode \u2223.
+
+Depending on the analyzer used and the tokenizer, the highlighting will result 
in marking each token rather than an entire phrase. The `joinHi` option is by 
default `true` so that entire phrases are highlighted together rather than as 
individual tokens as in:
+
+"the quick ↦brown↤ ↦fox↤ jumped over the lazy baboon"
+
+which would result from:
+
+(?s ?sc ?lit) text:query ( "brown fox" "highlight:jh:n" )
+
+The `jh` and `jf` boolean options are set `false` via `n`. Any other value is 
`true`. The defaults for these options have been selected to be reasonable for 
most applications.
+
+The joining is performed post highlighting via Java `String replaceAll` rather 
than using the Lucene Unified Highlighter facility which requires that term 
vectors and positions be stored. The joining deletes _extra_ highlighting with 
only intervening Unicode separators, `\p{Z}`.
+
+The more conventional output of the Lucene `SimpleHTMLFormatter` with html 
emphasis markup is achieved via, `"highlight:s: | e:"` 
(highlight options are separated by a Unicode vertical line, \u007c. The spaces 
are not necessary). The result with the above example will be:
+
+"the quick brown fox jumped over the 

[jira] [Created] (JENA-1469) GraphTxnTDB does not handle abort() properly

2018-01-20 Thread Claude Warren (JIRA)
Claude Warren created JENA-1469:
---

 Summary: GraphTxnTDB does not handle abort() properly
 Key: JENA-1469
 URL: https://issues.apache.org/jira/browse/JENA-1469
 Project: Apache Jena
  Issue Type: Bug
  Components: TDB
Affects Versions: Jena 3.7.0
Reporter: Claude Warren
 Attachments: TDBGraphTxnTest.java

If, when in a transaction, an instance of GraphTxnTDB calls abort() and 
subsquently calls begin() an "Existing active write transaction"  
TDBTransactionException is thrown.

 

Example JUnit test is attached.

 

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Closed] (JENA-1466) Jena解析protege本体有的实例解析错误

2018-01-20 Thread Andy Seaborne (JIRA)

 [ 
https://issues.apache.org/jira/browse/JENA-1466?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Seaborne closed JENA-1466.
---

> Jena解析protege本体有的实例解析错误
> ---
>
> Key: JENA-1466
> URL: https://issues.apache.org/jira/browse/JENA-1466
> Project: Apache Jena
>  Issue Type: Bug
> Environment: protege使用4.3版,Jena使用3.2版本
>Reporter: jingjaingbo
>Assignee: Andy Seaborne
>Priority: Major
>
> 我用Jena解析protege构建的本体,但是出现了以下的问题,很奇怪,同样的本体有的实例可以分析出来,有的实例就报这个错误,望大神可以解答
> Exception in thread "main" org.apache.jena.ontology.ConversionException: 
> Cannot convert node [http://www.w3.org/2002/07/owl#NamedIndividual] to 
> OntClass: it does not have rdf:type owl:Class or equivalent
> at org.apache.jena.ontology.impl.OntClassImpl$1.wrap(OntClassImpl.java:82)
> at org.apache.jena.enhanced.EnhNode.convertTo(EnhNode.java:152)
> at org.apache.jena.enhanced.EnhNode.convertTo(EnhNode.java:31)
> at org.apache.jena.enhanced.Polymorphic.asInternal(Polymorphic.java:62)
> at org.apache.jena.enhanced.EnhNode.as(EnhNode.java:107)
> at 
> org.apache.jena.ontology.impl.IndividualImpl.getOntClass(IndividualImpl.java:174)
> at 
> org.apache.jena.ontology.impl.IndividualImpl.getOntClass(IndividualImpl.java:148)
> at jena.jj.main(jj.java:244)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Resolved] (JENA-1466) Jena解析protege本体有的实例解析错误

2018-01-20 Thread Andy Seaborne (JIRA)

 [ 
https://issues.apache.org/jira/browse/JENA-1466?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Seaborne resolved JENA-1466.
-
Resolution: Not A Problem
  Assignee: Andy Seaborne

Hi there - we havn't heard back from you and it seems to be an issue with the 
data, so I've closed this JIRA ticket.

If you have new information, please do reopen it and include the new 
information.


> Jena解析protege本体有的实例解析错误
> ---
>
> Key: JENA-1466
> URL: https://issues.apache.org/jira/browse/JENA-1466
> Project: Apache Jena
>  Issue Type: Bug
> Environment: protege使用4.3版,Jena使用3.2版本
>Reporter: jingjaingbo
>Assignee: Andy Seaborne
>Priority: Major
>
> 我用Jena解析protege构建的本体,但是出现了以下的问题,很奇怪,同样的本体有的实例可以分析出来,有的实例就报这个错误,望大神可以解答
> Exception in thread "main" org.apache.jena.ontology.ConversionException: 
> Cannot convert node [http://www.w3.org/2002/07/owl#NamedIndividual] to 
> OntClass: it does not have rdf:type owl:Class or equivalent
> at org.apache.jena.ontology.impl.OntClassImpl$1.wrap(OntClassImpl.java:82)
> at org.apache.jena.enhanced.EnhNode.convertTo(EnhNode.java:152)
> at org.apache.jena.enhanced.EnhNode.convertTo(EnhNode.java:31)
> at org.apache.jena.enhanced.Polymorphic.asInternal(Polymorphic.java:62)
> at org.apache.jena.enhanced.EnhNode.as(EnhNode.java:107)
> at 
> org.apache.jena.ontology.impl.IndividualImpl.getOntClass(IndividualImpl.java:174)
> at 
> org.apache.jena.ontology.impl.IndividualImpl.getOntClass(IndividualImpl.java:148)
> at jena.jj.main(jj.java:244)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)