Search in sources :

Example 6 with ConstructQuery

use of org.apache.clerezza.rdf.core.sparql.query.ConstructQuery in project stanbol by apache.

the class JenaAdpterTest method wrongAdaptabeClassTest.

@SuppressWarnings("unchecked")
@Test
public void wrongAdaptabeClassTest() {
    try {
        List<ConstructQuery> constructQueries = (List<ConstructQuery>) ruleAdapter.adaptTo(recipeGood, ConstructQuery.class);
        for (ConstructQuery constructQuery : constructQueries) {
            log.debug(constructQuery.toString());
            Assert.fail("The adapter for Jena should not accept " + ConstructQuery.class.getCanonicalName() + " objects.");
        }
    } catch (UnavailableRuleObjectException e) {
        Assert.fail(e.getMessage());
    } catch (UnsupportedTypeForExportException e) {
        log.debug(e.getMessage());
    } catch (RuleAtomCallExeption e) {
        Assert.fail(e.getMessage());
    }
}
Also used : UnsupportedTypeForExportException(org.apache.stanbol.rules.base.api.UnsupportedTypeForExportException) UnavailableRuleObjectException(org.apache.stanbol.rules.base.api.UnavailableRuleObjectException) List(java.util.List) RuleAtomCallExeption(org.apache.stanbol.rules.base.api.RuleAtomCallExeption) ConstructQuery(org.apache.clerezza.rdf.core.sparql.query.ConstructQuery) Test(org.junit.Test)

Example 7 with ConstructQuery

use of org.apache.clerezza.rdf.core.sparql.query.ConstructQuery in project stanbol by apache.

the class ClerezzaAdpterTest method test.

@SuppressWarnings("unchecked")
@Test
public void test() {
    try {
        List<ConstructQuery> constructQueries = (List<ConstructQuery>) ruleAdapter.adaptTo(recipeGood, ConstructQuery.class);
        for (ConstructQuery constructQuery : constructQueries) {
            ConstructQuery cq = (ConstructQuery) QueryParser.getInstance().parse(constructQuery.toString());
            System.out.println(cq.toString());
        }
        Assert.assertTrue(true);
    } catch (UnavailableRuleObjectException e) {
        Assert.fail(e.getMessage());
    } catch (UnsupportedTypeForExportException e) {
        Assert.fail(e.getMessage());
    } catch (RuleAtomCallExeption e) {
        Assert.fail(e.getMessage());
    } catch (ParseException e) {
        Assert.fail(e.getMessage());
    }
}
Also used : UnsupportedTypeForExportException(org.apache.stanbol.rules.base.api.UnsupportedTypeForExportException) UnavailableRuleObjectException(org.apache.stanbol.rules.base.api.UnavailableRuleObjectException) List(java.util.List) RuleAtomCallExeption(org.apache.stanbol.rules.base.api.RuleAtomCallExeption) ParseException(org.apache.clerezza.rdf.core.sparql.ParseException) ConstructQuery(org.apache.clerezza.rdf.core.sparql.query.ConstructQuery) Test(org.junit.Test)

Aggregations

ConstructQuery (org.apache.clerezza.rdf.core.sparql.query.ConstructQuery)7 UnsupportedTypeForExportException (org.apache.stanbol.rules.base.api.UnsupportedTypeForExportException)6 List (java.util.List)5 RuleAtomCallExeption (org.apache.stanbol.rules.base.api.RuleAtomCallExeption)5 UnavailableRuleObjectException (org.apache.stanbol.rules.base.api.UnavailableRuleObjectException)5 RuleAdapter (org.apache.stanbol.rules.base.api.RuleAdapter)3 Test (org.junit.Test)3 Graph (org.apache.clerezza.commons.rdf.Graph)2 ImmutableGraph (org.apache.clerezza.commons.rdf.ImmutableGraph)2 SimpleGraph (org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph)2 SimpleConstructQuery (org.apache.clerezza.rdf.core.sparql.query.impl.SimpleConstructQuery)2 Recipe (org.apache.stanbol.rules.base.api.Recipe)2 RefactoringException (org.apache.stanbol.rules.refactor.api.RefactoringException)2 Query (com.hp.hpl.jena.query.Query)1 QueryExecution (com.hp.hpl.jena.query.QueryExecution)1 Model (com.hp.hpl.jena.rdf.model.Model)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 IRI (org.apache.clerezza.commons.rdf.IRI)1