Package org.apache.marmotta.kiwi.reasoner.model.program

Examples of org.apache.marmotta.kiwi.reasoner.model.program.ResourceField


    protected ResourceField getResource(String uri) {
        if(resources != null && resources.get(uri) != null) {
            return resources.get(uri);
        } else {
            ResourceField result = new ResourceField(resolveResource(uri));
            resources.put(uri,result);
            return result;
        }
    }
View Full Code Here


        ValueFactory v = repository.getValueFactory();
        URI subject = v.createURI(SUBJECT1);
        URI predicate = v.createURI(PREDICATE2);
        Literal object = v.createLiteral(OBJECT3);

        Pattern p = new Pattern(new ResourceField(subject), new ResourceField(predicate), new LiteralField(object));
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(Collections.singleton(p), null, null, null, true));
            Assert.assertEquals(1, results.size());
            Assert.assertEquals(1,results.get(0).getJustifications().size());
View Full Code Here

    @Test
    public void testSingleVariablePattern() throws Exception {
        ValueFactory v = repository.getValueFactory();
        URI predicate = v.createURI(PREDICATE2);

        Pattern p = new Pattern(new VariableField("X"), new ResourceField(predicate), new VariableField("Y"));
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(Collections.singleton(p), null, null, null, true));
            Assert.assertEquals(3, results.size());
View Full Code Here

        VariableField x =  new VariableField("X");
        VariableField y =  new VariableField("Y");
        VariableField z =  new VariableField("Z");

        Pattern p1 = new Pattern(x, new ResourceField(predicate1), y);
        Pattern p2 = new Pattern(y, new ResourceField(predicate1), z);
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(ImmutableSet.of(p1,p2), null, null, null, true));
            Assert.assertEquals(1, results.size());
            Assert.assertEquals(2, results.get(0).getJustifications().size());
View Full Code Here

        ValueFactory v = repository.getValueFactory();
        URI subject = v.createURI(SUBJECT1);
        URI predicate = v.createURI(PREDICATE2);
        Literal object = v.createLiteral(OBJECT3);

        Pattern p = new Pattern(new ResourceField(subject), new ResourceField(predicate), new LiteralField(object));
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(Collections.singleton(p), null, null, null, true));
            Assert.assertEquals(1, results.size());
            Assert.assertEquals(1,results.get(0).getJustifications().size());
View Full Code Here

    @Test
    public void testSingleVariablePattern() throws Exception {
        ValueFactory v = repository.getValueFactory();
        URI predicate = v.createURI(PREDICATE2);

        Pattern p = new Pattern(new VariableField("X"), new ResourceField(predicate), new VariableField("Y"));
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(Collections.singleton(p), null, null, null, true));
            Assert.assertEquals(3, results.size());
View Full Code Here

        VariableField x =  new VariableField("X");
        VariableField y =  new VariableField("Y");
        VariableField z =  new VariableField("Z");

        Pattern p1 = new Pattern(x, new ResourceField(predicate1), y);
        Pattern p2 = new Pattern(y, new ResourceField(predicate1), z);
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(ImmutableSet.of(p1,p2), null, null, null, true));
            Assert.assertEquals(1, results.size());
            Assert.assertEquals(2, results.get(0).getJustifications().size());
View Full Code Here

    protected ResourceField getResource(String uri) {
        if(resources != null && resources.get(uri) != null) {
            return resources.get(uri);
        } else {
            ResourceField result = new ResourceField(resolveResource(uri));
            resources.put(uri,result);
            return result;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.marmotta.kiwi.reasoner.model.program.ResourceField

Copyright © 2018 www.massapicom. 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.