Package com.hp.hpl.jena.assembler.assemblers

Examples of com.hp.hpl.jena.assembler.assemblers.RuleSetAssembler.open()


   
    public void testEmptyRuleSet()
        {
        Assembler a = new RuleSetAssembler();
        Resource root = resourceInModel( "x rdf:type ja:RuleSet" );
        assertEquals( RuleSet.empty, a.open( root ) );
        }
   
    public void testSingleRuleString()
        {
        Assembler a = new RuleSetAssembler();
View Full Code Here


    public void testSingleRuleString()
        {
        Assembler a = new RuleSetAssembler();
        String ruleString = "[(?a P ?b) -> (?a Q ?b)]";
        Resource root = resourceInModel( "x rdf:type ja:RuleSet; x ja:rule '" + ruleString.replaceAll( " ", "\\\\s" ) + "'" );
        RuleSet rules = (RuleSet) a.open( root );
        Set<Rule> expected = new HashSet<>( Rule.parseRules( ruleString ) );
        assertEquals( expected, new HashSet<>( rules.getRules() ) );
        }
   
    public void testMultipleRuleStrings()
View Full Code Here

        Resource root = resourceInModel
            ( "x rdf:type ja:RuleSet"
            + "; x ja:rule '" + ruleStringA.replaceAll( " ", "\\\\s" ) + "'"
            + "; x ja:rule '" + ruleStringB.replaceAll( " ", "\\\\s" ) + "'"
            );
        RuleSet rules = (RuleSet) a.open( root );
        Set<Rule> expected = new HashSet<>( Rule.parseRules( ruleStringA ) );
        expected.addAll( Rule.parseRules( ruleStringB ) );
        assertEquals( expected, new HashSet<>( rules.getRules() ) );
        }
   
View Full Code Here

        {
        Assembler a = new RuleSetAssembler();
        String rulesA = file( "example.rules" );
        Resource root = resourceInModel( "x rdf:type ja:RuleSet; x ja:rulesFrom " + rulesA );
        Set<Rule> expected = new HashSet<>( Rule.rulesFromURL( rulesA ) );
        RuleSet rules = (RuleSet) a.open( root );
        assertEquals( expected, new HashSet<>( rules.getRules() ) );
        }
   
    public void testSubRules()
        {
View Full Code Here

        String ruleStringA = "[(?a P ?b) -> (?a Q ?b)]";
        Resource root = resourceInModel
            ( "x rdf:type ja:RuleSet; x ja:rules y"
            + "; y rdf:type ja:RuleSet; y ja:rule '" + ruleStringA.replaceAll( " ", "\\\\s" ) + "'" );
        Set<Rule> expected = new HashSet<>( Rule.parseRules( ruleStringA ) );
        RuleSet rules = (RuleSet) a.open( root );
        assertEquals( expected, new HashSet<>( rules.getRules() ) );
        }
   
    public void testTrapsBadRulesObject()
        {
View Full Code Here

            ( "x rdf:type ja:RuleSet; x <property> <value>"
              .replaceAll( "<property>", property ).replaceAll( "<value>", value )
            );
        try
            {
            a.open( root );
            fail( "should trap bad rules object " + value + " for property " + property );
            }
        catch (BadObjectException e)
            {
            Model m = e.getRoot().getModel();
View Full Code Here

   
    public void testEmptyRuleSet()
        {
        Assembler a = new RuleSetAssembler();
        Resource root = resourceInModel( "x rdf:type ja:RuleSet" );
        assertEquals( RuleSet.empty, a.open( root ) );
        }
   
    public void testSingleRuleString()
        {
        Assembler a = new RuleSetAssembler();
View Full Code Here

    public void testSingleRuleString()
        {
        Assembler a = new RuleSetAssembler();
        String ruleString = "[(?a P ?b) -> (?a Q ?b)]";
        Resource root = resourceInModel( "x rdf:type ja:RuleSet; x ja:rule '" + ruleString.replaceAll( " ", "\\\\s" ) + "'" );
        RuleSet rules = (RuleSet) a.open( root );
        Set<Rule> expected = new HashSet<Rule>( Rule.parseRules( ruleString ) );
        assertEquals( expected, new HashSet<Rule>( rules.getRules() ) );
        }
   
    public void testMultipleRuleStrings()
View Full Code Here

        Resource root = resourceInModel
            ( "x rdf:type ja:RuleSet"
            + "; x ja:rule '" + ruleStringA.replaceAll( " ", "\\\\s" ) + "'"
            + "; x ja:rule '" + ruleStringB.replaceAll( " ", "\\\\s" ) + "'"
            );
        RuleSet rules = (RuleSet) a.open( root );
        Set<Rule> expected = new HashSet<Rule>( Rule.parseRules( ruleStringA ) );
        expected.addAll( Rule.parseRules( ruleStringB ) );
        assertEquals( expected, new HashSet<Rule>( rules.getRules() ) );
        }
   
View Full Code Here

        {
        Assembler a = new RuleSetAssembler();
        String rulesA = file( "example.rules" );
        Resource root = resourceInModel( "x rdf:type ja:RuleSet; x ja:rulesFrom " + rulesA );
        Set<Rule> expected = new HashSet<Rule>( Rule.rulesFromURL( rulesA ) );
        RuleSet rules = (RuleSet) a.open( root );
        assertEquals( expected, new HashSet<Rule>( rules.getRules() ) );
        }
   
    public void testSubRules()
        {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.