You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Rob Vesse (JIRA)" <ji...@apache.org> on 2012/11/09 18:56:12 UTC

[jira] [Created] (JENA-345) execConstructTriples() does not eliminate malformed triples from it's output

Rob Vesse created JENA-345:
------------------------------

             Summary: execConstructTriples() does not eliminate malformed triples from it's output
                 Key: JENA-345
                 URL: https://issues.apache.org/jira/browse/JENA-345
             Project: Apache Jena
          Issue Type: Bug
          Components: ARQ
    Affects Versions: ARQ 2.9.4
            Reporter: Rob Vesse
            Assignee: Rob Vesse


Start from any model which has triples containing only literals as their subjects, then try the following:

    @Test public void testConstructRejectsBadTriples1()
    {
        String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
        Query q = QueryFactory.create(queryString);
        
        QueryExecution qExec = QueryExecutionFactory.create(q, m);
        
        Model resultModel = qExec.execConstruct();
        assertEquals(0, resultModel.size());
    }
    
    @Test public void testConstructRejectsBadTriples2()
    {
        String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
        Query q = QueryFactory.create(queryString);
        
        QueryExecution qExec = QueryExecutionFactory.create(q, m);
        
        Iterator<Triple> ts = qExec.execConstructTriples();
        long count = 0;
        while (ts.hasNext()) {
            count++;
            ts.next();
        }
        assertEquals(0, count);
    }

The first test passes because execConstruct() correctly rejects triples with literal subjects as invalid, the second test fails because execConstructTriples() does not follow this behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (JENA-345) execConstructTriples() does not eliminate malformed triples from it's output

Posted by "Rob Vesse (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494173#comment-13494173 ] 

Rob Vesse commented on JENA-345:
--------------------------------

Fix was relatively simple, I only needed to have execConstructTriples() check that triples were not malformed by modifying the code in TemplateLib.calcTriples() slightly

I saw that execConstruct() already called a function in ModelUtils to try to convert a Triple into a Statement which contained code for determining if a Triple was valid as a Statement so I extracted that part of the code into a separate helper function so it could be used from the calcTriples() call as well as internally within ModelUtils
                
> execConstructTriples() does not eliminate malformed triples from it's output
> ----------------------------------------------------------------------------
>
>                 Key: JENA-345
>                 URL: https://issues.apache.org/jira/browse/JENA-345
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: ARQ 2.9.4
>            Reporter: Rob Vesse
>            Assignee: Rob Vesse
>              Labels: construct, sparql
>
> Start from any model which has triples containing only literals as their subjects, then try the following:
>     @Test public void testConstructRejectsBadTriples1()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Model resultModel = qExec.execConstruct();
>         assertEquals(0, resultModel.size());
>     }
>     
>     @Test public void testConstructRejectsBadTriples2()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Iterator<Triple> ts = qExec.execConstructTriples();
>         long count = 0;
>         while (ts.hasNext()) {
>             count++;
>             ts.next();
>         }
>         assertEquals(0, count);
>     }
> The first test passes because execConstruct() correctly rejects triples with literal subjects as invalid, the second test fails because execConstructTriples() does not follow this behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (JENA-345) execConstructTriples() does not eliminate malformed triples from it's output

Posted by "Rob Vesse (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JENA-345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Vesse resolved JENA-345.
----------------------------

       Resolution: Fixed
    Fix Version/s: Jena 2.10.0
    
> execConstructTriples() does not eliminate malformed triples from it's output
> ----------------------------------------------------------------------------
>
>                 Key: JENA-345
>                 URL: https://issues.apache.org/jira/browse/JENA-345
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: ARQ 2.9.4
>            Reporter: Rob Vesse
>            Assignee: Rob Vesse
>              Labels: construct, sparql
>             Fix For: Jena 2.10.0
>
>
> Start from any model which has triples containing only literals as their subjects, then try the following:
>     @Test public void testConstructRejectsBadTriples1()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Model resultModel = qExec.execConstruct();
>         assertEquals(0, resultModel.size());
>     }
>     
>     @Test public void testConstructRejectsBadTriples2()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Iterator<Triple> ts = qExec.execConstructTriples();
>         long count = 0;
>         while (ts.hasNext()) {
>             count++;
>             ts.next();
>         }
>         assertEquals(0, count);
>     }
> The first test passes because execConstruct() correctly rejects triples with literal subjects as invalid, the second test fails because execConstructTriples() does not follow this behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Closed] (JENA-345) execConstructTriples() does not eliminate malformed triples from it's output

Posted by "Andy Seaborne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JENA-345?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andy Seaborne closed JENA-345.
------------------------------

    
> execConstructTriples() does not eliminate malformed triples from it's output
> ----------------------------------------------------------------------------
>
>                 Key: JENA-345
>                 URL: https://issues.apache.org/jira/browse/JENA-345
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: ARQ 2.9.4
>            Reporter: Rob Vesse
>            Assignee: Rob Vesse
>              Labels: construct, sparql
>             Fix For: Jena 2.10.0
>
>
> Start from any model which has triples containing only literals as their subjects, then try the following:
>     @Test public void testConstructRejectsBadTriples1()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Model resultModel = qExec.execConstruct();
>         assertEquals(0, resultModel.size());
>     }
>     
>     @Test public void testConstructRejectsBadTriples2()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Iterator<Triple> ts = qExec.execConstructTriples();
>         long count = 0;
>         while (ts.hasNext()) {
>             count++;
>             ts.next();
>         }
>         assertEquals(0, count);
>     }
> The first test passes because execConstruct() correctly rejects triples with literal subjects as invalid, the second test fails because execConstructTriples() does not follow this behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (JENA-345) execConstructTriples() does not eliminate malformed triples from it's output

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13495143#comment-13495143 ] 

Hudson commented on JENA-345:
-----------------------------

Integrated in Jena_Development_Test_Windows #10 (See [https://builds.apache.org/job/Jena_Development_Test_Windows/10/])
    Tests and fix for JENA-345, ensures that execConstructTriples() does eliminate malformed triples (Revision 1407563)

     Result = SUCCESS
rvesse : 
Files : 
* /jena/trunk/jena-arq/ReleaseNotes.txt
* /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/TemplateLib.java
* /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/ModelUtils.java
* /jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/api/TestAPI.java

                
> execConstructTriples() does not eliminate malformed triples from it's output
> ----------------------------------------------------------------------------
>
>                 Key: JENA-345
>                 URL: https://issues.apache.org/jira/browse/JENA-345
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: ARQ 2.9.4
>            Reporter: Rob Vesse
>            Assignee: Rob Vesse
>              Labels: construct, sparql
>             Fix For: Jena 2.10.0
>
>
> Start from any model which has triples containing only literals as their subjects, then try the following:
>     @Test public void testConstructRejectsBadTriples1()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Model resultModel = qExec.execConstruct();
>         assertEquals(0, resultModel.size());
>     }
>     
>     @Test public void testConstructRejectsBadTriples2()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Iterator<Triple> ts = qExec.execConstructTriples();
>         long count = 0;
>         while (ts.hasNext()) {
>             count++;
>             ts.next();
>         }
>         assertEquals(0, count);
>     }
> The first test passes because execConstruct() correctly rejects triples with literal subjects as invalid, the second test fails because execConstructTriples() does not follow this behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (JENA-345) execConstructTriples() does not eliminate malformed triples from it's output

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JENA-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13494238#comment-13494238 ] 

Hudson commented on JENA-345:
-----------------------------

Integrated in Jena__Development_Test #260 (See [https://builds.apache.org/job/Jena__Development_Test/260/])
    Tests and fix for JENA-345, ensures that execConstructTriples() does eliminate malformed triples (Revision 1407563)

     Result = SUCCESS
rvesse : 
Files : 
* /jena/trunk/jena-arq/ReleaseNotes.txt
* /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/TemplateLib.java
* /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/util/ModelUtils.java
* /jena/trunk/jena-arq/src/test/java/com/hp/hpl/jena/sparql/api/TestAPI.java

                
> execConstructTriples() does not eliminate malformed triples from it's output
> ----------------------------------------------------------------------------
>
>                 Key: JENA-345
>                 URL: https://issues.apache.org/jira/browse/JENA-345
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: ARQ
>    Affects Versions: ARQ 2.9.4
>            Reporter: Rob Vesse
>            Assignee: Rob Vesse
>              Labels: construct, sparql
>             Fix For: Jena 2.10.0
>
>
> Start from any model which has triples containing only literals as their subjects, then try the following:
>     @Test public void testConstructRejectsBadTriples1()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Model resultModel = qExec.execConstruct();
>         assertEquals(0, resultModel.size());
>     }
>     
>     @Test public void testConstructRejectsBadTriples2()
>     {
>         String queryString = "CONSTRUCT { ?s ?p ?o } WHERE { ?o ?p ?s }";
>         Query q = QueryFactory.create(queryString);
>         
>         QueryExecution qExec = QueryExecutionFactory.create(q, m);
>         
>         Iterator<Triple> ts = qExec.execConstructTriples();
>         long count = 0;
>         while (ts.hasNext()) {
>             count++;
>             ts.next();
>         }
>         assertEquals(0, count);
>     }
> The first test passes because execConstruct() correctly rejects triples with literal subjects as invalid, the second test fails because execConstructTriples() does not follow this behavior.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira