當前位置: 首頁>>代碼示例>>Java>>正文


Java TupleQueryResult.close方法代碼示例

本文整理匯總了Java中org.openrdf.query.TupleQueryResult.close方法的典型用法代碼示例。如果您正苦於以下問題:Java TupleQueryResult.close方法的具體用法?Java TupleQueryResult.close怎麽用?Java TupleQueryResult.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openrdf.query.TupleQueryResult的用法示例。


在下文中一共展示了TupleQueryResult.close方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSmithWatermanGotohFiveArg

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testSmithWatermanGotohFiveArg() throws Exception {

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?result where { bind(ss:smithWatermanGotoh(\"Stardog\", \"Starman\", -0.5, 1.0, -2.0) as ?result) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();

        try {
            assertTrue("Should have a result", aResult.hasNext());

            final String aValue = aResult.next().getValue("result").stringValue();

            assertEquals(0.5714286, Double.parseDouble(aValue), 0.00001);

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:28,代碼來源:TestSmithWatermanGotoh.java

示例2: testTooFewArgs

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testTooFewArgs() throws Exception {

    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {
        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?result where { bind(ss:caverphone2() as ?result) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestCaverphone2.java

示例3: testTwoArgument

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testTwoArgument() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?result where { bind(ss:damerau(\"ABCDEF\", \"BACDFE\") as ?result) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();

        try {
            assertTrue("Should have a result", aResult.hasNext());

            final String aValue = aResult.next().getValue("result").stringValue();

            assertEquals(2.0, Double.parseDouble(aValue), 0.0);

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:31,代碼來源:TestDamerau.java

示例4: testMetaphone

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testMetaphone() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?metaphone where { bind(ss:metaphone(\"Stardog\") as ?metaphone) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();

        try {
            assertTrue("Should have a result", aResult.hasNext());

            final String aValue = aResult.next().getValue("metaphone").stringValue();

            assertEquals("STRT", aValue);

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:31,代碼來源:TestMetaphone.java

示例5: testLevenshteinWrongType

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testLevenshteinWrongType() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?str where { bind(ss:weightedLevenshtein(7) as ?str) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestWeightedLevenshtein.java

示例6: testLevenstheinTooManyArgs

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testLevenstheinTooManyArgs() throws Exception {

    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {
        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?str where { bind(ss:levenshtein(\"one\", \"two\", \"three\") as ?str) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestLevenshtein.java

示例7: testLevenshteinWrongType

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testLevenshteinWrongType() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?str where { bind(ss:levenshtein(7) as ?str) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestLevenshtein.java

示例8: testHammingDistance

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testHammingDistance() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?hammingDistance where { bind(ss:hammingDistance(\"Stardog\", \"Starman\") as ?hammingDistance) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();

        try {
            assertTrue("Should have a result", aResult.hasNext());

            final String aValue = aResult.next().getValue("hammingDistance").stringValue();

            assertEquals(3.0, Double.parseDouble(aValue), 0.0001);

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:31,代碼來源:TestHammingDistance.java

示例9: testOneArgument

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testOneArgument() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?result where { bind(ss:nysiis(\"Stardog\") as ?result) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();

        try {
            assertTrue("Should have a result", aResult.hasNext());

            final String aValue = aResult.next().getValue("result").stringValue();

            assertEquals("STARDA", aValue);

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:31,代碼來源:TestNysiis.java

示例10: testWrongType

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testWrongType() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?result where { bind(ss:nysiis(7) as ?result) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestNysiis.java

示例11: testNormalizedLevenstheinTooManyArgs

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testNormalizedLevenstheinTooManyArgs() throws Exception {

    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {
        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?str where { bind(ss:normalizedLevenshtein(\"one\", \"two\", \"three\") as ?str) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestNormalizedLevenshtein.java

示例12: testNeedlemanWunchTooManyArgs

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testNeedlemanWunchTooManyArgs() throws Exception {

    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {
        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?dist where { bind(ss:needlemanWunch(\"one\", \"two\", \"three\", \"four\") as ?dist) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestNeedlemanWunch.java

示例13: testJaroWinkler

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testJaroWinkler() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?dist where { bind(ss:jaroWinkler(\"My string\", \"My tsring\") as ?dist) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();

        try {
            assertTrue("Should have a result", aResult.hasNext());

            final String aValue = aResult.next().getValue("dist").stringValue();

            assertEquals(0.9740740656852722, Double.parseDouble(aValue), 0.000001);

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:31,代碼來源:TestJaroWinkler.java

示例14: testMetricLongestCommonSubsequenceWrongType

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testMetricLongestCommonSubsequenceWrongType() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + "> " +
                "select ?str where { bind(ss:metricLongestCommonSubsequence(7) as ?str) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestMetricLongestCommonSubsequence.java

示例15: testCosineThirdArgNotConstant

import org.openrdf.query.TupleQueryResult; //導入方法依賴的package包/類
@Test
public void testCosineThirdArgNotConstant() throws Exception {
    final Connection aConn = ConnectionConfiguration.to(DB)
            .credentials("admin", "admin")
            .connect();

    try {

        final String aQuery = "prefix ss: <" + StringSimilarityVocab.NAMESPACE + ">" +
                "select ?result where { bind(ss:cosine(\"Stardog\", \"Starlight\", ?thirdArg) as ?result) }";

        final TupleQueryResult aResult = aConn.select(aQuery).execute();
        try {
            // there should be a result because implicit in the query is the singleton set, so because the bind
            // should fail due to the value error, we expect a single empty binding
            assertTrue("Should have a result", aResult.hasNext());

            final BindingSet aBindingSet = aResult.next();

            assertTrue("Should have no bindings", aBindingSet.getBindingNames().isEmpty());

            assertFalse("Should have no more results", aResult.hasNext());
        }
        finally {
            aResult.close();
        }
    }
    finally {
        aConn.close();
    }
}
 
開發者ID:semantalytics,項目名稱:stardog-plugin-string-similarity,代碼行數:32,代碼來源:TestCosine.java


注:本文中的org.openrdf.query.TupleQueryResult.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。