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


Java PropertySelector類代碼示例

本文整理匯總了Java中org.apache.marmotta.ldpath.model.selectors.PropertySelector的典型用法代碼示例。如果您正苦於以下問題:Java PropertySelector類的具體用法?Java PropertySelector怎麽用?Java PropertySelector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PropertySelector類屬於org.apache.marmotta.ldpath.model.selectors包,在下文中一共展示了PropertySelector類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: evaluate

import org.apache.marmotta.ldpath.model.selectors.PropertySelector; //導入依賴的package包/類
@Override
public Var evaluate(NodeSelector nodeSelector, ElementGroup elementGroup, Var var, LDPathEvaluatorConfiguration evaluatorConfiguration) {
    TestingSelector testingSelector = (TestingSelector) nodeSelector;
    FunctionTest functionTest = (FunctionTest) testingSelector.getTest();

    if(functionTest.getArgSelectors().get(0) instanceof PropertySelector) {
        PropertySelector arg = (PropertySelector) functionTest.getArgSelectors().get(0);
        PropertySelector delegate = (PropertySelector) testingSelector.getDelegate();

        Var target = Var.alloc(VarIDGenerator.createID());
        elementGroup.addTriplePattern(new Triple(var.asNode(), NodeFactory.createURI(delegate.getProperty().toString()), target));

        Var selector = Var.alloc(VarIDGenerator.createID());
        elementGroup.addTriplePattern(new Triple(target.asNode(), NodeFactory.createURI(arg.getProperty().toString()), selector.asNode()));

        elementGroup.addElementFilter(new ElementFilter(new E_IsLiteral(new ExprVar(selector))));

        return selector;
    } else {
        throw new IllegalStateException("Argument of function isLiteral has to be a PropertySelector");
    }
}
 
開發者ID:anno4j,項目名稱:anno4j,代碼行數:23,代碼來源:IsLiteralTestEvaluator.java

示例2: testParsePath

import org.apache.marmotta.ldpath.model.selectors.PropertySelector; //導入依賴的package包/類
@Test
public void testParsePath() throws Exception {
    String path1 = "rdfs:label";

    NodeSelector<Value> s1 = parseSelector(path1, null);
    Assert.assertThat(s1, CoreMatchers.instanceOf(PropertySelector.class));
    Assert.assertEquals("<http://www.w3.org/2000/01/rdf-schema#label>",s1.getPathExpression(backend));


    Map<String,String> namespaces2 = ImmutableMap.of(
            "dct","http://purl.org/dc/terms/",
            "dbp-ont","http://dbpedia.org/ontology/"
    );
    String path2 = "(*[rdf:type is dbp-ont:Person]) | (dct:subject/^dct:subject[rdf:type is dbp-ont:Person]) | (dct:subject/^skos:broader/^dct:subject[rdf:type is dbp-ont:Person])";
    NodeSelector<Value> s2 = parseSelector(path2,namespaces2);
    Assert.assertThat(s2, CoreMatchers.instanceOf(UnionSelector.class));

    String path3 = "*[rdf:type is dbp-ont:Person] | dct:subject/^dct:subject[rdf:type is dbp-ont:Person] | dct:subject/^skos:broader/^dct:subject[rdf:type is dbp-ont:Person]";
    NodeSelector<Value> s3 = parseSelector(path3,namespaces2);
    Assert.assertThat(s3, CoreMatchers.instanceOf(UnionSelector.class));
    
    String path4 = "(* | dct:subject/^dct:subject | dct:subject/^skos:broader/^dct:subject)[rdf:type is dbp-ont:Person]";
    NodeSelector<Value> s4 = parseSelector(path4,namespaces2);
    Assert.assertThat(s4, CoreMatchers.instanceOf(TestingSelector.class));
}
 
開發者ID:apache,項目名稱:marmotta,代碼行數:26,代碼來源:ParserTest.java

示例3: evaluate

import org.apache.marmotta.ldpath.model.selectors.PropertySelector; //導入依賴的package包/類
@Override
public Var evaluate(NodeSelector nodeSelector, ElementGroup elementGroup, Var var, LDPathEvaluatorConfiguration evaluatorConfiguration) {
    PropertySelector propertySelector = (PropertySelector) nodeSelector;
    if (propertySelector instanceof WildcardSelector) {
        throw new IllegalStateException(propertySelector.getClass() + " is not supported.");
    }

    Var id = Var.alloc(VarIDGenerator.createID());
    elementGroup.addTriplePattern(new Triple(var.asNode(), NodeFactory.createURI(propertySelector.getProperty().toString()), id.asNode()));

    return id;
}
 
開發者ID:anno4j,項目名稱:anno4j,代碼行數:13,代碼來源:PropertySelectorEvaluator.java

示例4: IsATest

import org.apache.marmotta.ldpath.model.selectors.PropertySelector; //導入依賴的package包/類
public IsATest(Node rdfType, Node node) {
    super(new PropertySelector<Node>(rdfType), node);
}
 
開發者ID:apache,項目名稱:marmotta,代碼行數:4,代碼來源:IsATest.java


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