Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-25 Thread Henrik Schmidt
If there will be a fix for this it would be nice this solution for the 
jena provider will be also added to the main repo :


https://github.com/openlink/virtuoso-opensource/issues/687

Am 25.01.2018 um 11:19 schrieb Hugh Williams:

Hi Quentin,

Thanks for the input, I see what you mean as the jena program is 
executing the query:


String qStr = "PREFIX base:  PREFIX xsd: 
SELECT ?s {?s base:name 
\"test_sensor\"^^xsd:string}";


and does actually return results when run against isql:

SQL> SPARQL define input:default-graph-uri   PREFIX  xsd:  
 PREFIX  base:   
SELECT ?s WHERE   { ?s  base:name  "test_sensor"^^xsd:string };

s
LONG VARCHAR
___

http://base.org#x1
http://base.org#x2

2 Rows. -- 101 msec.
SQL>

But when I set Virtuoso trace_on() ^^xsd:string  element is being 
stripped off by time it gets to Virtuoso ie


define input:default-graph-uri 
PREFIX  xsd:  
PREFIX  base: 

SELECT  ?s
WHERE
  { ?s  base:name  "test_sensor" }

which I assume must be done by the Jena Provider, thus we need to 
check this ...


Best Regards
Hugh Williams
Professional Services
OpenLink Software, Inc.      // http://www.openlinksw.com/
Weblog   -- http://www.openlinksw.com/blogs/
LinkedIn -- http://www.linkedin.com/company/openlink-software/
Twitter  -- http://twitter.com/OpenLink
Google+  -- http://plus.google.com/100570109519069333827/
Facebook -- http://www.facebook.com/OpenLinkSoftware
Universal Data Access, Integration, and Management Technology Providers



On 25 Jan 2018, at 02:27, Quentin > wrote:


Hi Hugh,

In your example, you have this query:

SELECT  ?s WHERE   { ?s  base:name  "test_sensor" };


But the data is:
s 
o 
datatype
LONG VARCHAR 
 LONG 
VARCHAR 
 LONG 
VARCHAR

___
http://base.org#x1 
   test_sensor 
http://www.w3.org/2001/XMLSchema#string



Would you expect a query for string literals to return xsd typed strings?
I've always found that filtering or querying over string literals 
would not be successful unless everything was very carefully typed.


I note that Jason tried xsd types in his queries in the first 
instance, so that's probably not actually the issue here.

--
Regards,
Quentin Serrurier.
GuidingHand.Solutions





--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot


___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-25 Thread Hugh Williams
Hi Quentin,

Thanks for the input, I see what you mean as the jena program is executing the 
query:

String qStr = "PREFIX base:  PREFIX xsd: 
  SELECT ?s {?s base:name 
\"test_sensor\"^^xsd:string}";

and does actually return results when run against isql:

SQL> SPARQL define input:default-graph-uri   PREFIX  xsd:  
 PREFIX  base:   SELECT  
?s WHERE   { ?s  base:name  "test_sensor"^^xsd:string };
s
LONG VARCHAR
___

http://base.org#x1
http://base.org#x2

2 Rows. -- 101 msec.
SQL>

But when I set Virtuoso trace_on() ^^xsd:string  element is being stripped off 
by time it gets to Virtuoso ie

define input:default-graph-uri  
PREFIX  xsd:  
PREFIX  base: 

SELECT  ?s
WHERE
  { ?s  base:name  "test_sensor" }

which I assume must be done by the Jena Provider, thus we need to check this ...

Best Regards
Hugh Williams
Professional Services
OpenLink Software, Inc.  //  http://www.openlinksw.com/
Weblog   -- http://www.openlinksw.com/blogs/
LinkedIn -- http://www.linkedin.com/company/openlink-software/
Twitter  -- http://twitter.com/OpenLink
Google+  -- http://plus.google.com/100570109519069333827/
Facebook -- http://www.facebook.com/OpenLinkSoftware
Universal Data Access, Integration, and Management Technology Providers



> On 25 Jan 2018, at 02:27, Quentin  wrote:
> 
> Hi Hugh,
> 
> In your example, you have this query:
>> SELECT  ?s WHERE   { ?s  base:name  "test_sensor" };
> 
> But the data is:
> s 
> o 
> datatype
> LONG VARCHAR  
> LONG VARCHAR  
> LONG VARCHAR
> ___
> http://base.org#x1
> test_sensor   
> http://www.w3.org/2001/XMLSchema#string
> 
> 
> Would you expect a query for string literals to return xsd typed strings?
> I've always found that filtering or querying over string literals would not 
> be successful unless everything was very carefully typed.
> 
> I note that Jason tried xsd types in his queries in the first instance, so 
> that's probably not actually the issue here.
> -- 
> Regards,
> Quentin Serrurier.
> GuidingHand.Solutions
> 

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-24 Thread Quentin

Hi Hugh,

In your example, you have this query:

SELECT  ?s WHERE   { ?s  base:name  "test_sensor" };


But the data is:
s
 o   
  datatype
LONG VARCHAR 
 LONG VARCHAR
  LONG VARCHAR

___
http://base.org#x1   
 test_sensor 
  http://www.w3.org/2001/XMLSchema#string



Would you expect a query for string literals to return xsd typed 
strings?
I've always found that filtering or querying over string literals would 
not be successful unless everything was very carefully typed.


I note that Jason tried xsd types in his queries in the first instance, 
so that's probably not actually the issue here.

--
Regards,
Quentin Serrurier.
GuidingHand.Solutions

On 2018-01-25 07:34, Hugh Williams wrote:

Hi Jason,

I have been able to compile and run your program and can see the 
problem:


De-iMac-232:virtuoso_driver hwilliams$ javac -classpath
".:../lib-3.3.0/commons-lang3-3.4.jar:../lib-3.3.0/jena-arq-3.3.0-SNAPSHOT.jar:../lib-3.3.0/jena-iri-3.3.0-SNAPSHOT.jar:../lib-3.3.0/jena-base-3.3.0-SNAPSHOT.jar:../lib-3.3.0/jena-core-3.3.0-SNAPSHOT.jar:../../../libsrc/JDBCDriverType4/virtjdbc4.jar:../virt_jena3.jar:../lib-3.3.0/jcl-over-slf4j-1.7.21.jar:../lib-3.3.0/log4j-1.2.17.jar:../lib-3.3.0/slf4j-api-1.7.21.jar:../lib-3.3.0/slf4j-log4j12-1.7.21.jar:../lib-3.3.0/xercesImpl-2.11.0.jar:../lib-3.3.0/xml-apis-1.4.01.jar:../lib-3.3.0/jena-shaded-guava-3.3.0-SNAPSHOT.jar:../lib-3.3.0/libthrift-0.9.3.jar:../lib-3.3.0/sparql-generate-jena-1.0.jar:../lib-3.3.0/jena-arq-3.3.0-SNAPSHOT.jar:../lib-3.3.0/httpclient-4.5.2.jar:../lib-3.3.0/httpclient-cache-4.5.2.jar"
Tester.java
De-iMac-232:virtuoso_driver hwilliams$ java -classpath
".:../lib-3.3.0/commons-lang3-3.4.jar:../lib-3.3.0/jena-arq-3.3.0-SNAPSHOT.jar:../lib-3.3.0/jena-iri-3.3.0-SNAPSHOT.jar:../lib-3.3.0/jena-base-3.3.0-SNAPSHOT.jar:../lib-3.3.0/jena-core-3.3.0-SNAPSHOT.jar:../../../libsrc/JDBCDriverType4/virtjdbc4.jar:../virt_jena3.jar:../lib-3.3.0/jcl-over-slf4j-1.7.21.jar:../lib-3.3.0/log4j-1.2.17.jar:../lib-3.3.0/slf4j-api-1.7.21.jar:../lib-3.3.0/slf4j-log4j12-1.7.21.jar:../lib-3.3.0/xercesImpl-2.11.0.jar:../lib-3.3.0/xml-apis-1.4.01.jar:../lib-3.3.0/jena-shaded-guava-3.3.0-SNAPSHOT.jar:../lib-3.3.0/libthrift-0.9.3.jar:../lib-3.3.0/sparql-generate-jena-1.0.jar:../lib-3.3.0/jena-arq-3.3.0-SNAPSHOT.jar:../lib-3.3.0/httpclient-4.5.2.jar:../lib-3.3.0/httpclient-cache-4.5.2.jar"
Tester
log4j:WARN No appenders could be found for logger (Jena).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
for more info.
failed!
De-iMac-232:virtuoso_driver hwilliams$

In fact turning Virtuoso tracing on (with the “trace_on();” function)
I see the query being run against Virtuoso by the Jena layer is:

SPARQL define input:default-graph-uri   PREFIX  xsd:
 PREFIX  base: 
SELECT  ?s WHERE   { ?s  base:name  "test_sensor" };

which when I run against “isql”  also returns no results:

SQL> SPARQL define input:default-graph-uri   PREFIX  xsd:
 PREFIX  base: 
SELECT  ?s WHERE   { ?s  base:name  "test_sensor" };
s
LONG VARCHAR
___


0 Rows. -- 2 msec.
SQL>

Nor does even:

SQL> SPARQL define input:default-graph-uri   PREFIX  xsd:
 PREFIX  base: 
SELECT  ?s WHERE   { ?s  ?p  "test_sensor" };
s
LONG VARCHAR
___


0 Rows. -- 2 msec.
SQL>

But the following does:

SQL> SPARQL define input:default-graph-uri   PREFIX  xsd:
 PREFIX  base: 
SELECT  ?s WHERE   { ?s  ?p  ?o };
s
LONG VARCHAR
___

http://base.org#x1
http://base.org#x2

2 Rows. -- 5 msec.
SQL>

Which is strange as my  test case does work with the same type of
query and both literal values are string types:

SQL> SPARQL define input:default-graph-uri   PREFIX  xsd:
 PREFIX  base: 
SELECT  ?s ?o ?datatype WHERE   { ?s  ?p  ?o . BIND (DATATYPE(?o) as
?datatype)};
s
   o
  datatype
LONG VARCHAR
   LONG VARCHAR
  LONG VARCHAR
___

http://base.org#x1
 

Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-24 Thread Jason Koh
Dear Hugh and the community,

I have created a regenerator repository:
https://github.com/jbkoh/virtjena_regenerator

If available, please review the problem. I think it's the problem of Virt
Jena, your feedback would be much useful for me to write the right code.

Thanks!


With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh

On Tue, Jan 23, 2018 at 12:50 PM, Jason Koh  wrote:

> Forgot to clarify the configuration:
>
> Ubuntu 16.04 (64bit)
> Virtuoso 7.2.4.2
> Virtuoso Jean: virt_jena3
> Virtuodo JDBC: virtjdbc4
> Java: openjdk version "1.8.0_151"
>
> Thank you.
>
>
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh
>
> On Tue, Jan 23, 2018 at 12:46 PM, Jason Koh  wrote:
>
>> Here's the Java code snippet not working:
>> ```java
>> String nameStr = "test_sensor1";
>> String BASE = "http://base.org#;;
>> String uuid = "x";
>> Node name = NodeFactory.createLiteralByValue(nameStr, XSDstring);
>> Node point = NodeFactory.createURI(BASE + uuid);
>> Node hasName = NodeFactory.createURI(BASE + "name");
>> graph.add(new Triple(point, hasName, name));
>> String qStr =
>> "PREFIX base: \n" +
>> "SELECT ?s WHERE {\n" +
>> "?s base:name \"test_sensor1\" . \n" +
>> "}";
>> Query sparql = QueryFactory.create(qStr);
>> VirtuosoQueryExecution vqd = VirtuosoQueryExecutionFactory.create(sparql,
>> graph);
>> ResultSet results = vqd.execSelect();
>> while (results.hasNext()) {
>>   QuerySolution result = results.nextSolution();
>>   System.out.println(result.get("s").toString());
>> }
>> System.out.println("Done");
>>   }
>> ```
>>
>> The value ``results`` is empty and this code does not print anything. I
>> can make a regenerator. Let me know if that helps.
>>
>>
>> With regards,
>> Jason Koh
>> cseweb.ucsd.edu/~jbkoh
>>
>> On Tue, Jan 23, 2018 at 12:16 PM, Jason Koh  wrote:
>>
>>> Hi Hugh,
>>>
>>> I inserted the tripled through *Virtuoso Jena* and I can see triples
>>> like
>>> ``ex:base:nametest_sensor0``
>>> when I query just with ?s ?p ?o. However, I don't get any result with
>>> ``?s base:name "test_sensor0"``.
>>>
>>> As you showed, it works with command line insertions. Let me verify the
>>> source of the problem once again and come back.
>>>
>>> Thank you!
>>>
>>>
>>> With regards,
>>> Jason Koh
>>> cseweb.ucsd.edu/~jbkoh
>>>
>>> On Tue, Jan 23, 2018 at 3:17 AM, Hugh Williams >> > wrote:
>>>
 Hi Jason,

 What exactly is not working for you ? As the following works for me:

 SQL> SPARQL PREFIX base:  INSERT DATA { GRAPH  { <1>
 base:name "sensor1" . } };

 Done. -- 1 msec.
 SQL> SPARQL SELECT * FROM  WHERE {?s ?p ?o};
 s
p
  o
 LONG VARCHAR
   LONG VARCHAR
 LONG VARCHAR
 
 ___

 1
basename
   sensor1

 1 Rows. -- 2 msec.
 SQL> SPARQL PREFIX base:  SELECT ?s {?s base:name "sensor1"};
 s
 LONG VARCHAR
 
 ___

 1

 1 Rows. -- 1 msec.
 SQL> SPARQL PREFIX base:  SELECT ?g ?s {GRAPH ?g {?s base:name
 "sensor1"}};
 g
s
 LONG VARCHAR
   LONG VARCHAR
 
 ___

 koh
1

 1 Rows. -- 1 msec.
 SQL>


 Best Regards
 Hugh Williams
 Professional Services
 OpenLink Software, Inc.  //  http://www.openlinksw.com/
 Weblog   -- http://www.openlinksw.com/blogs/
 LinkedIn -- http://www.linkedin.com/company/openlink-software/
 Twitter  -- http://twitter.com/OpenLink
 Google+  -- http://plus.google.com/100570109519069333827/
 Facebook -- http://www.facebook.com/OpenLinkSoftware
 Universal Data Access, Integration, and Management Technology Providers



 > On 23 Jan 2018, at 09:58, Jason Koh  wrote:
 >
 > Hi Kingsley,
 >
 > Thanks for the prompt response. I just tried it and it works well. I
 haven't compared the performance yet but wish the string match is faster.
 >
 > However, I am having trouble querying with the String Literal with
 SPARQL. The following query does not work for Virtuoso.
 > ```sparql
 > select ?s {
 >   ?s base:name "sensor1". # also tried "sensor1"^^xsd:string but the
 same result.
 > }
 > ```
 > This query returns empty result.
 >
 > If I query with no pattern (?s ?p ?o), I can see the following triple:
 > : base:name "sensor1",
 >
 > Can't sort out the problem. Do you have any ideas on this?
 >
 > Thank you!
 >
 >
 >
 >
 >
 > With regards,
 > Jason Koh
 

Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-23 Thread Jason Koh
Forgot to clarify the configuration:

Ubuntu 16.04 (64bit)
Virtuoso 7.2.4.2
Virtuoso Jean: virt_jena3
Virtuodo JDBC: virtjdbc4
Java: openjdk version "1.8.0_151"

Thank you.


With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh

On Tue, Jan 23, 2018 at 12:46 PM, Jason Koh  wrote:

> Here's the Java code snippet not working:
> ```java
> String nameStr = "test_sensor1";
> String BASE = "http://base.org#;;
> String uuid = "x";
> Node name = NodeFactory.createLiteralByValue(nameStr, XSDstring);
> Node point = NodeFactory.createURI(BASE + uuid);
> Node hasName = NodeFactory.createURI(BASE + "name");
> graph.add(new Triple(point, hasName, name));
> String qStr =
> "PREFIX base: \n" +
> "SELECT ?s WHERE {\n" +
> "?s base:name \"test_sensor1\" . \n" +
> "}";
> Query sparql = QueryFactory.create(qStr);
> VirtuosoQueryExecution vqd = VirtuosoQueryExecutionFactory.create(sparql,
> graph);
> ResultSet results = vqd.execSelect();
> while (results.hasNext()) {
>   QuerySolution result = results.nextSolution();
>   System.out.println(result.get("s").toString());
> }
> System.out.println("Done");
>   }
> ```
>
> The value ``results`` is empty and this code does not print anything. I
> can make a regenerator. Let me know if that helps.
>
>
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh
>
> On Tue, Jan 23, 2018 at 12:16 PM, Jason Koh  wrote:
>
>> Hi Hugh,
>>
>> I inserted the tripled through *Virtuoso Jena* and I can see triples like
>> ``ex:base:nametest_sensor0``
>> when I query just with ?s ?p ?o. However, I don't get any result with
>> ``?s base:name "test_sensor0"``.
>>
>> As you showed, it works with command line insertions. Let me verify the
>> source of the problem once again and come back.
>>
>> Thank you!
>>
>>
>> With regards,
>> Jason Koh
>> cseweb.ucsd.edu/~jbkoh
>>
>> On Tue, Jan 23, 2018 at 3:17 AM, Hugh Williams 
>> wrote:
>>
>>> Hi Jason,
>>>
>>> What exactly is not working for you ? As the following works for me:
>>>
>>> SQL> SPARQL PREFIX base:  INSERT DATA { GRAPH  { <1>
>>> base:name "sensor1" . } };
>>>
>>> Done. -- 1 msec.
>>> SQL> SPARQL SELECT * FROM  WHERE {?s ?p ?o};
>>> s
>>>  p
>>>o
>>> LONG VARCHAR
>>>   LONG VARCHAR
>>> LONG VARCHAR
>>> 
>>> ___
>>>
>>> 1
>>>  basename
>>> sensor1
>>>
>>> 1 Rows. -- 2 msec.
>>> SQL> SPARQL PREFIX base:  SELECT ?s {?s base:name "sensor1"};
>>> s
>>> LONG VARCHAR
>>> 
>>> ___
>>>
>>> 1
>>>
>>> 1 Rows. -- 1 msec.
>>> SQL> SPARQL PREFIX base:  SELECT ?g ?s {GRAPH ?g {?s base:name
>>> "sensor1"}};
>>> g
>>>  s
>>> LONG VARCHAR
>>>   LONG VARCHAR
>>> 
>>> ___
>>>
>>> koh
>>>  1
>>>
>>> 1 Rows. -- 1 msec.
>>> SQL>
>>>
>>>
>>> Best Regards
>>> Hugh Williams
>>> Professional Services
>>> OpenLink Software, Inc.  //  http://www.openlinksw.com/
>>> Weblog   -- http://www.openlinksw.com/blogs/
>>> LinkedIn -- http://www.linkedin.com/company/openlink-software/
>>> Twitter  -- http://twitter.com/OpenLink
>>> Google+  -- http://plus.google.com/100570109519069333827/
>>> Facebook -- http://www.facebook.com/OpenLinkSoftware
>>> Universal Data Access, Integration, and Management Technology Providers
>>>
>>>
>>>
>>> > On 23 Jan 2018, at 09:58, Jason Koh  wrote:
>>> >
>>> > Hi Kingsley,
>>> >
>>> > Thanks for the prompt response. I just tried it and it works well. I
>>> haven't compared the performance yet but wish the string match is faster.
>>> >
>>> > However, I am having trouble querying with the String Literal with
>>> SPARQL. The following query does not work for Virtuoso.
>>> > ```sparql
>>> > select ?s {
>>> >   ?s base:name "sensor1". # also tried "sensor1"^^xsd:string but the
>>> same result.
>>> > }
>>> > ```
>>> > This query returns empty result.
>>> >
>>> > If I query with no pattern (?s ?p ?o), I can see the following triple:
>>> > : base:name "sensor1",
>>> >
>>> > Can't sort out the problem. Do you have any ideas on this?
>>> >
>>> > Thank you!
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > With regards,
>>> > Jason Koh
>>> > cseweb.ucsd.edu/~jbkoh
>>> >
>>> > On Mon, Jan 22, 2018 at 2:52 PM, Kingsley Idehen <
>>> kide...@openlinksw.com> wrote:
>>> > On 1/22/18 5:11 PM, Jason Koh wrote:
>>> >> Hi there,
>>> >>
>>> >> I am trying to use Virtuoso for metadata of city-scale sensor
>>> database. (metroinsight.io).
>>> >>
>>> >> I wonder if there is a way to optimize certain SPARQL query pattern.
>>> I often query this:
>>> >> ```sparql
>>> >> select ?s where {
>>> >>   ?s base:name ex:mySensor1 .
>>> >> }
>>> >> ```
>>> >>
>>> >> I could optimize it by caching those with Redis or else, but I wonder
>>> if I 

Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-23 Thread Jason Koh
Here's the Java code snippet not working:
```java
String nameStr = "test_sensor1";
String BASE = "http://base.org#;;
String uuid = "x";
Node name = NodeFactory.createLiteralByValue(nameStr, XSDstring);
Node point = NodeFactory.createURI(BASE + uuid);
Node hasName = NodeFactory.createURI(BASE + "name");
graph.add(new Triple(point, hasName, name));
String qStr =
"PREFIX base: \n" +
"SELECT ?s WHERE {\n" +
"?s base:name \"test_sensor1\" . \n" +
"}";
Query sparql = QueryFactory.create(qStr);
VirtuosoQueryExecution vqd = VirtuosoQueryExecutionFactory.create(sparql,
graph);
ResultSet results = vqd.execSelect();
while (results.hasNext()) {
  QuerySolution result = results.nextSolution();
  System.out.println(result.get("s").toString());
}
System.out.println("Done");
  }
```

The value ``results`` is empty and this code does not print anything. I can
make a regenerator. Let me know if that helps.


With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh

On Tue, Jan 23, 2018 at 12:16 PM, Jason Koh  wrote:

> Hi Hugh,
>
> I inserted the tripled through *Virtuoso Jena* and I can see triples like
> ``ex:base:nametest_sensor0``
> when I query just with ?s ?p ?o. However, I don't get any result with ``?s
> base:name "test_sensor0"``.
>
> As you showed, it works with command line insertions. Let me verify the
> source of the problem once again and come back.
>
> Thank you!
>
>
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh
>
> On Tue, Jan 23, 2018 at 3:17 AM, Hugh Williams 
> wrote:
>
>> Hi Jason,
>>
>> What exactly is not working for you ? As the following works for me:
>>
>> SQL> SPARQL PREFIX base:  INSERT DATA { GRAPH  { <1> base:name
>> "sensor1" . } };
>>
>> Done. -- 1 msec.
>> SQL> SPARQL SELECT * FROM  WHERE {?s ?p ?o};
>> s
>>  p
>>o
>> LONG VARCHAR
>> LONG VARCHAR
>>   LONG VARCHAR
>> 
>> ___
>>
>> 1
>>  basename
>> sensor1
>>
>> 1 Rows. -- 2 msec.
>> SQL> SPARQL PREFIX base:  SELECT ?s {?s base:name "sensor1"};
>> s
>> LONG VARCHAR
>> 
>> ___
>>
>> 1
>>
>> 1 Rows. -- 1 msec.
>> SQL> SPARQL PREFIX base:  SELECT ?g ?s {GRAPH ?g {?s base:name
>> "sensor1"}};
>> g
>>  s
>> LONG VARCHAR
>> LONG VARCHAR
>> 
>> ___
>>
>> koh
>>  1
>>
>> 1 Rows. -- 1 msec.
>> SQL>
>>
>>
>> Best Regards
>> Hugh Williams
>> Professional Services
>> OpenLink Software, Inc.  //  http://www.openlinksw.com/
>> Weblog   -- http://www.openlinksw.com/blogs/
>> LinkedIn -- http://www.linkedin.com/company/openlink-software/
>> Twitter  -- http://twitter.com/OpenLink
>> Google+  -- http://plus.google.com/100570109519069333827/
>> Facebook -- http://www.facebook.com/OpenLinkSoftware
>> Universal Data Access, Integration, and Management Technology Providers
>>
>>
>>
>> > On 23 Jan 2018, at 09:58, Jason Koh  wrote:
>> >
>> > Hi Kingsley,
>> >
>> > Thanks for the prompt response. I just tried it and it works well. I
>> haven't compared the performance yet but wish the string match is faster.
>> >
>> > However, I am having trouble querying with the String Literal with
>> SPARQL. The following query does not work for Virtuoso.
>> > ```sparql
>> > select ?s {
>> >   ?s base:name "sensor1". # also tried "sensor1"^^xsd:string but the
>> same result.
>> > }
>> > ```
>> > This query returns empty result.
>> >
>> > If I query with no pattern (?s ?p ?o), I can see the following triple:
>> > : base:name "sensor1",
>> >
>> > Can't sort out the problem. Do you have any ideas on this?
>> >
>> > Thank you!
>> >
>> >
>> >
>> >
>> >
>> > With regards,
>> > Jason Koh
>> > cseweb.ucsd.edu/~jbkoh
>> >
>> > On Mon, Jan 22, 2018 at 2:52 PM, Kingsley Idehen <
>> kide...@openlinksw.com> wrote:
>> > On 1/22/18 5:11 PM, Jason Koh wrote:
>> >> Hi there,
>> >>
>> >> I am trying to use Virtuoso for metadata of city-scale sensor
>> database. (metroinsight.io).
>> >>
>> >> I wonder if there is a way to optimize certain SPARQL query pattern. I
>> often query this:
>> >> ```sparql
>> >> select ?s where {
>> >>   ?s base:name ex:mySensor1 .
>> >> }
>> >> ```
>> >>
>> >> I could optimize it by caching those with Redis or else, but I wonder
>> if I can force indexing "name" properties in Virtuoso.
>> >>
>> >> Thank you!
>> >>
>> >>
>> >> With regards,
>> >> Jason Koh
>> >> cseweb.ucsd.edu/~jbkoh
>> >
>> > Have you looked at text indexing in Virtuoso with regards to SPARQL?
>> > [1] http://docs.openlinksw.com/virtuoso/rdfsparqlrulefulltext/ .
>> > --
>> > Regards,
>> >
>> > Kingsley Idehen
>> > Founder & CEO
>> > OpenLink Software   (Home Page:
>> > http://www.openlinksw.com
>> > )
>> >
>> > Weblogs (Blogs):
>> > Legacy Blog:
>> > 

Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-23 Thread Jason Koh
Hi Hugh,

I inserted the tripled through *Virtuoso Jena* and I can see triples like
``ex:base:nametest_sensor0``
when I query just with ?s ?p ?o. However, I don't get any result with ``?s
base:name "test_sensor0"``.

As you showed, it works with command line insertions. Let me verify the
source of the problem once again and come back.

Thank you!


With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh

On Tue, Jan 23, 2018 at 3:17 AM, Hugh Williams 
wrote:

> Hi Jason,
>
> What exactly is not working for you ? As the following works for me:
>
> SQL> SPARQL PREFIX base:  INSERT DATA { GRAPH  { <1> base:name
> "sensor1" . } };
>
> Done. -- 1 msec.
> SQL> SPARQL SELECT * FROM  WHERE {?s ?p ?o};
> s
>p
>  o
> LONG VARCHAR
> LONG VARCHAR
>   LONG VARCHAR
> 
> ___
>
> 1
>basename
>   sensor1
>
> 1 Rows. -- 2 msec.
> SQL> SPARQL PREFIX base:  SELECT ?s {?s base:name "sensor1"};
> s
> LONG VARCHAR
> 
> ___
>
> 1
>
> 1 Rows. -- 1 msec.
> SQL> SPARQL PREFIX base:  SELECT ?g ?s {GRAPH ?g {?s base:name
> "sensor1"}};
> g
>s
> LONG VARCHAR
> LONG VARCHAR
> 
> ___
>
> koh
>1
>
> 1 Rows. -- 1 msec.
> SQL>
>
>
> Best Regards
> Hugh Williams
> Professional Services
> OpenLink Software, Inc.  //  http://www.openlinksw.com/
> Weblog   -- http://www.openlinksw.com/blogs/
> LinkedIn -- http://www.linkedin.com/company/openlink-software/
> Twitter  -- http://twitter.com/OpenLink
> Google+  -- http://plus.google.com/100570109519069333827/
> Facebook -- http://www.facebook.com/OpenLinkSoftware
> Universal Data Access, Integration, and Management Technology Providers
>
>
>
> > On 23 Jan 2018, at 09:58, Jason Koh  wrote:
> >
> > Hi Kingsley,
> >
> > Thanks for the prompt response. I just tried it and it works well. I
> haven't compared the performance yet but wish the string match is faster.
> >
> > However, I am having trouble querying with the String Literal with
> SPARQL. The following query does not work for Virtuoso.
> > ```sparql
> > select ?s {
> >   ?s base:name "sensor1". # also tried "sensor1"^^xsd:string but the
> same result.
> > }
> > ```
> > This query returns empty result.
> >
> > If I query with no pattern (?s ?p ?o), I can see the following triple:
> > : base:name "sensor1",
> >
> > Can't sort out the problem. Do you have any ideas on this?
> >
> > Thank you!
> >
> >
> >
> >
> >
> > With regards,
> > Jason Koh
> > cseweb.ucsd.edu/~jbkoh
> >
> > On Mon, Jan 22, 2018 at 2:52 PM, Kingsley Idehen 
> wrote:
> > On 1/22/18 5:11 PM, Jason Koh wrote:
> >> Hi there,
> >>
> >> I am trying to use Virtuoso for metadata of city-scale sensor database.
> (metroinsight.io).
> >>
> >> I wonder if there is a way to optimize certain SPARQL query pattern. I
> often query this:
> >> ```sparql
> >> select ?s where {
> >>   ?s base:name ex:mySensor1 .
> >> }
> >> ```
> >>
> >> I could optimize it by caching those with Redis or else, but I wonder
> if I can force indexing "name" properties in Virtuoso.
> >>
> >> Thank you!
> >>
> >>
> >> With regards,
> >> Jason Koh
> >> cseweb.ucsd.edu/~jbkoh
> >
> > Have you looked at text indexing in Virtuoso with regards to SPARQL?
> > [1] http://docs.openlinksw.com/virtuoso/rdfsparqlrulefulltext/ .
> > --
> > Regards,
> >
> > Kingsley Idehen
> > Founder & CEO
> > OpenLink Software   (Home Page:
> > http://www.openlinksw.com
> > )
> >
> > Weblogs (Blogs):
> > Legacy Blog:
> > http://www.openlinksw.com/blog/~kidehen/
> >
> > Blogspot Blog:
> > http://kidehen.blogspot.com
> >
> > Medium Blog:
> > https://medium.com/@kidehen
> >
> >
> > Profile Pages:
> > Pinterest:
> > https://www.pinterest.com/kidehen/
> >
> > Quora:
> > https://www.quora.com/profile/Kingsley-Uyi-Idehen
> >
> > Twitter:
> > https://twitter.com/kidehen
> >
> > Google+:
> > https://plus.google.com/+KingsleyIdehen/about
> >
> > LinkedIn:
> > http://www.linkedin.com/in/kidehen
> >
> >
> > Web Identities (WebID):
> > Personal:
> > http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
> >
> > :
> > http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/
> kingsley.ttl#this
> >
> >
> >
> >
> > 
> --
> > Check out the vibrant tech community on one of the world's most
> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> > ___
> > Virtuoso-users mailing list
> > Virtuoso-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/virtuoso-users
> >
> >
> > 
> --
> > Check out the vibrant tech community on 

Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-23 Thread Hugh Williams
Hi Jason,

What exactly is not working for you ? As the following works for me:

SQL> SPARQL PREFIX base:  INSERT DATA { GRAPH  { <1> base:name 
"sensor1" . } };

Done. -- 1 msec.
SQL> SPARQL SELECT * FROM  WHERE {?s ?p ?o};
s   
  p 
o
LONG VARCHAR
  LONG VARCHAR  
LONG VARCHAR
___

1   
  basename  
sensor1

1 Rows. -- 2 msec.
SQL> SPARQL PREFIX base:  SELECT ?s {?s base:name "sensor1"};
s
LONG VARCHAR
___

1

1 Rows. -- 1 msec.
SQL> SPARQL PREFIX base:  SELECT ?g ?s {GRAPH ?g {?s base:name 
"sensor1"}};
g   
  s
LONG VARCHAR
  LONG VARCHAR
___

koh 
  1

1 Rows. -- 1 msec.
SQL>


Best Regards
Hugh Williams
Professional Services
OpenLink Software, Inc.  //  http://www.openlinksw.com/
Weblog   -- http://www.openlinksw.com/blogs/
LinkedIn -- http://www.linkedin.com/company/openlink-software/
Twitter  -- http://twitter.com/OpenLink
Google+  -- http://plus.google.com/100570109519069333827/
Facebook -- http://www.facebook.com/OpenLinkSoftware
Universal Data Access, Integration, and Management Technology Providers



> On 23 Jan 2018, at 09:58, Jason Koh  wrote:
> 
> Hi Kingsley,
> 
> Thanks for the prompt response. I just tried it and it works well. I haven't 
> compared the performance yet but wish the string match is faster.
> 
> However, I am having trouble querying with the String Literal with SPARQL. 
> The following query does not work for Virtuoso.
> ```sparql
> select ?s {
>   ?s base:name "sensor1". # also tried "sensor1"^^xsd:string but the same 
> result.
> }
> ```
> This query returns empty result.
> 
> If I query with no pattern (?s ?p ?o), I can see the following triple:
> : base:name "sensor1",
> 
> Can't sort out the problem. Do you have any ideas on this?
> 
> Thank you!
> 
> 
> 
> 
> 
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh
> 
> On Mon, Jan 22, 2018 at 2:52 PM, Kingsley Idehen  
> wrote:
> On 1/22/18 5:11 PM, Jason Koh wrote:
>> Hi there,
>> 
>> I am trying to use Virtuoso for metadata of city-scale sensor database. 
>> (metroinsight.io).
>> 
>> I wonder if there is a way to optimize certain SPARQL query pattern. I often 
>> query this:
>> ```sparql
>> select ?s where {
>>   ?s base:name ex:mySensor1 .
>> }
>> ```
>> 
>> I could optimize it by caching those with Redis or else, but I wonder if I 
>> can force indexing "name" properties in Virtuoso. 
>> 
>> Thank you!
>> 
>> 
>> With regards,
>> Jason Koh
>> cseweb.ucsd.edu/~jbkoh
> 
> Have you looked at text indexing in Virtuoso with regards to SPARQL? 
> [1] http://docs.openlinksw.com/virtuoso/rdfsparqlrulefulltext/ .
> -- 
> Regards,
> 
> Kingsley Idehen 
> Founder & CEO 
> OpenLink Software   (Home Page: 
> http://www.openlinksw.com
> )
> 
> Weblogs (Blogs):
> Legacy Blog: 
> http://www.openlinksw.com/blog/~kidehen/
> 
> Blogspot Blog: 
> http://kidehen.blogspot.com
> 
> Medium Blog: 
> https://medium.com/@kidehen
> 
> 
> Profile Pages:
> Pinterest: 
> https://www.pinterest.com/kidehen/
> 
> Quora: 
> https://www.quora.com/profile/Kingsley-Uyi-Idehen
> 
> Twitter: 
> https://twitter.com/kidehen
> 
> Google+: 
> https://plus.google.com/+KingsleyIdehen/about
> 
> LinkedIn: 
> http://www.linkedin.com/in/kidehen
> 
> 
> Web Identities (WebID):
> Personal: 
> http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
> 
> : 
> http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this
> 
> 
> 
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
> 
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! 
> http://sdm.link/slashdot___
> Virtuoso-users 

Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-23 Thread Jason Koh
Hi Kingsley,

Thanks for the prompt response. I just tried it and it works well. I
haven't compared the performance yet but wish the string match is faster.

However, I am having trouble querying with the String Literal with SPARQL.
The following query does not work for Virtuoso.
```sparql
select ?s {
  ?s base:name "sensor1". # also tried "sensor1"^^xsd:string but the same
result.
}
```
This query returns empty result.

If I query with no pattern (?s ?p ?o), I can see the following triple:
: base:name "sensor1",

Can't sort out the problem. Do you have any ideas on this?

Thank you!





With regards,
Jason Koh
cseweb.ucsd.edu/~jbkoh

On Mon, Jan 22, 2018 at 2:52 PM, Kingsley Idehen 
wrote:

> On 1/22/18 5:11 PM, Jason Koh wrote:
>
> Hi there,
>
> I am trying to use Virtuoso for metadata of city-scale sensor database. (
> metroinsight.io).
>
> I wonder if there is a way to optimize certain SPARQL query pattern. I
> often query this:
> ```sparql
> select ?s where {
>   ?s base:name ex:mySensor1 .
> }
> ```
>
> I could optimize it by caching those with Redis or else, but I wonder if I
> can force indexing "name" properties in Virtuoso.
>
> Thank you!
>
>
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh 
>
>
> Have you looked at text indexing in Virtuoso with regards to SPARQL?
>
> [1] http://docs.openlinksw.com/virtuoso/rdfsparqlrulefulltext/ .
>
> --
> Regards,
>
> Kingsley Idehen   
> Founder & CEO
> OpenLink Software   (Home Page: http://www.openlinksw.com)
>
> Weblogs (Blogs):
> Legacy Blog: http://www.openlinksw.com/blog/~kidehen/
> Blogspot Blog: http://kidehen.blogspot.com
> Medium Blog: https://medium.com/@kidehen
>
> Profile Pages:
> Pinterest: https://www.pinterest.com/kidehen/
> Quora: https://www.quora.com/profile/Kingsley-Uyi-Idehen
> Twitter: https://twitter.com/kidehen
> Google+: https://plus.google.com/+KingsleyIdehen/about
> LinkedIn: http://www.linkedin.com/in/kidehen
>
> Web Identities (WebID):
> Personal: http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
> : 
> http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this
>
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users


Re: [Virtuoso-users] Query optimization, possible indexing?

2018-01-22 Thread Kingsley Idehen
On 1/22/18 5:11 PM, Jason Koh wrote:
> Hi there,
>
> I am trying to use Virtuoso for metadata of city-scale sensor
> database. (metroinsight.io ).
>
> I wonder if there is a way to optimize certain SPARQL query pattern. I
> often query this:
> ```sparql
> select ?s where {
>   ?s base:name ex:mySensor1 .
> }
> ```
>
> I could optimize it by caching those with Redis or else, but I wonder
> if I can force indexing "name" properties in Virtuoso. 
>
> Thank you!
>
>
> With regards,
> Jason Koh
> cseweb.ucsd.edu/~jbkoh 


Have you looked at text indexing in Virtuoso with regards to SPARQL?

[1] http://docs.openlinksw.com/virtuoso/rdfsparqlrulefulltext/ .

-- 
Regards,

Kingsley Idehen   
Founder & CEO 
OpenLink Software   (Home Page: http://www.openlinksw.com)

Weblogs (Blogs):
Legacy Blog: http://www.openlinksw.com/blog/~kidehen/
Blogspot Blog: http://kidehen.blogspot.com
Medium Blog: https://medium.com/@kidehen

Profile Pages:
Pinterest: https://www.pinterest.com/kidehen/
Quora: https://www.quora.com/profile/Kingsley-Uyi-Idehen
Twitter: https://twitter.com/kidehen
Google+: https://plus.google.com/+KingsleyIdehen/about
LinkedIn: http://www.linkedin.com/in/kidehen

Web Identities (WebID):
Personal: http://kingsley.idehen.net/public_home/kidehen/profile.ttl#i
: 
http://id.myopenlink.net/DAV/home/KingsleyUyiIdehen/Public/kingsley.ttl#this



smime.p7s
Description: S/MIME Cryptographic Signature
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users