• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SKOS类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.openrdf.model.vocabulary.SKOS的典型用法代码示例。如果您正苦于以下问题:Java SKOS类的具体用法?Java SKOS怎么用?Java SKOS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SKOS类属于org.openrdf.model.vocabulary包,在下文中一共展示了SKOS类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getConnections

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
/**
 * Gets the top-level connections between the give node types
 *
 * @param subtype
 * @param objtype
 * @param engine
 * @return a collection of connections
 */
public static Collection<URI> getConnections( URI subtype, URI objtype, IEngine engine ) {
	String query = "SELECT DISTINCT ?rel {\n"
			+ "  ?s a ?subtype .\n"
			+ "  ?o a ?objtype .\n"
			+ "  ?s ?rel ?o .\n"
			+ "  ?rel rdfs:subPropertyOf ?semrel .\n"
			+ "  FILTER( ?rel != ?semrel ) .\n"
			+ "  FILTER( ?subtype != ?concept && ?subtype != ?skos ) .\n"
			+ "  FILTER( ?objtype != ?concept && ?objtype != ?skos ) .\n"
			+ "}";
	ListQueryAdapter<URI> lqa = OneVarListQueryAdapter.getUriList( query );
	lqa.bind( "semrel", engine.getSchemaBuilder().getRelationUri().build() );
	lqa.bind( "concept", engine.getSchemaBuilder().getConceptUri().build() );
	lqa.bind( "skos", SKOS.CONCEPT );
	lqa.bind( "subtype", subtype );
	lqa.bind( "objtype", objtype );
	Set<URI> edges = getTopLevelRelations( engine.queryNoEx( lqa ), engine );

	return edges;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:29,代码来源:NodeDerivationTools.java


示例2: getExpander

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
private ModelQueryAdapter getExpander( Collection<URI> instances, URI totype,
		boolean instanceIsSubject ) {
	// we only want the "root" edges (those in the 
	// schema namespace, also, those without properties)
	StringBuilder query = new StringBuilder( "CONSTRUCT { ?subject ?predicate ?object } " )
			.append( "WHERE { " )
			.append( "  ?subject ?predicate ?object ." )
			.append( "  ?subject a ?subtype . FILTER( ?subtype != ?skos ) ." )
			.append( "  ?object a ?objtype . FILTER( ?objtype != ?skos ) ." )
			.append( "   VALUES ?" )
			.append( instanceIsSubject ? "subject" : "object" );
	query.append( "{ " )
			.append( Utility.implode( instances ) )
			.append( "} ." );
	query.append( "}" );

	ModelQueryAdapter mqa = new ModelQueryAdapter( query.toString() );
	mqa.bind( "skos", SKOS.CONCEPT );
	mqa.bind( instanceIsSubject ? "objtype" : "subtype", totype );
	logger.debug( "expander query is: " + mqa.bindAndGetSparql() );

	return mqa;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:24,代码来源:TraverseFreelyPopup.java


示例3: testSymmetry

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
/**
 * prp-symp
 */
@Test
public void testSymmetry() throws Exception {
    schema.processTriple(TestUtils.statement(SKOS.RELATED, RDF.TYPE,
        OWL.SYMMETRICPROPERTY));
    reasoner.processFact(TestUtils.fact(TestUtils.uri("y"), SKOS.RELATED,
        TestUtils.NODE));
    for (Fact t : reasoner.getFacts()) {
        if (t.getSubject().equals(TestUtils.NODE)
            && t.getPredicate().equals(SKOS.RELATED)
            && t.getObject().equals(TestUtils.uri("y"))) {
            return;
        }
    }
    Assert.fail("Symmetric property not inferred");
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:19,代码来源:LocalReasonerTest.java


示例4: QueryService

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
public <T> QueryService(ObjectConnection connection, LDPathEvaluatorConfiguration evaluatorConfiguration) {
    this.connection = connection;

    this.queryServiceDTO = new QueryServiceConfiguration();
    queryServiceDTO.setEvaluatorConfiguration(evaluatorConfiguration);
    queryServiceDTO.setConfiguration(createLDPathConfiguration());

    this.queryOptimizer = QueryOptimizer.getInstance();

    // Setting some common name spaces
    addPrefix(OADM.PREFIX, OADM.NS);
    addPrefix(CNT.PREFIX, CNT.NS);
    addPrefix(DC.PREFIX, DC.NS);
    addPrefix(DCTERMS.PREFIX, DCTERMS.NS);
    addPrefix(DCTYPES.PREFIX, DCTYPES.NS);
    addPrefix(FOAF.PREFIX, FOAF.NS);
    addPrefix(PROV.PREFIX, PROV.NS);
    addPrefix(RDF.PREFIX, RDF.NS);
    addPrefix(OWL.PREFIX, OWL.NAMESPACE);
    addPrefix(RDFS.PREFIX, RDFS.NAMESPACE);
    addPrefix(SKOS.PREFIX, SKOS.NAMESPACE);
}
 
开发者ID:anno4j,项目名称:anno4j,代码行数:23,代码来源:QueryService.java


示例5: setLabels

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
private void setLabels(URI concept1uri, URI concept2uri, int delay) throws RepositoryException, InterruptedException {        
    Statement defPrefLabel = new StatementImpl(concept1uri, SKOS.PREF_LABEL, new LiteralImpl("concept"));
    Statement updatePrefLabel = new StatementImpl(concept2uri, SKOS.PREF_LABEL, new LiteralImpl("updated concept"));

    persistAndNotifyProvider.persistAndNotify(
            Helper.createChangeSetModel(defPrefLabel, ChangeTripleService.CHANGETYPE_ADD),
            true);

    persistAndNotifyProvider.persistAndNotify(
            Helper.createChangeSetModel(defPrefLabel, ChangeTripleService.CHANGETYPE_REMOVE),
            true);

    Thread.sleep(delay);

    persistAndNotifyProvider.persistAndNotify(
            Helper.createChangeSetModel(updatePrefLabel, ChangeTripleService.CHANGETYPE_ADD),
            true);
}
 
开发者ID:rsine,项目名称:rsine,代码行数:19,代码来源:LabelUpdateTest.java


示例6: multiHierarchicalCycles

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void multiHierarchicalCycles()
    throws RDFParseException, IOException, RDFHandlerException, RepositoryException
{
    subscribe("/quality/cyclic_hierarchical_relations.ttl");

    addTriple(new URIImpl("http://reegle.info/glossary/1124"),
            SKOS.BROADER,
            new URIImpl("http://reegle.info/newConcept"));
    addTriple(new URIImpl("http://reegle.info/newConcept"),
        SKOS.BROADER,
        new URIImpl("http://reegle.info/glossary/676"));
    addTriple(new URIImpl("http://reegle.info/glossary/676"),
        SKOS.BROADER,
        new URIImpl("http://reegle.info/glossary/1124"));

    Assert.assertEquals(2, countingNotifier.getNotificationCount());
}
 
开发者ID:rsine,项目名称:rsine,代码行数:19,代码来源:QualityNotificationsTest.java


示例7: mappingClashes

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void mappingClashes() throws RDFParseException, IOException, RDFHandlerException, RepositoryException {
    subscribe("/quality/mapping_clashes.ttl");

    String concept = "http://reegle.info/glossary/1912";
    String relatedMappedConcept = "http://dbpedia.org/resource/Vulnerability";

    // error
    addTriple(new URIImpl(concept), SKOS.BROAD_MATCH, new URIImpl(relatedMappedConcept));

    // error
    addTriple(new URIImpl(relatedMappedConcept), SKOS.EXACT_MATCH, new URIImpl(concept));

    // ok
    addTriple(new URIImpl(concept), SKOS.BROAD_MATCH, new URIImpl("http://reegle.info/glossary/1674"));

    Assert.assertEquals(2, countingNotifier.getNotificationCount());
}
 
开发者ID:rsine,项目名称:rsine,代码行数:19,代码来源:QualityNotificationsTest.java


示例8: topConceptsHavingBroaderConcepts

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void topConceptsHavingBroaderConcepts()
    throws RDFParseException, IOException, RDFHandlerException, RepositoryException
{
    subscribe("/quality/top_concepts_having_broader_concepts.ttl");

    String topConcept = "http://reegle.info/glossary/1127";

    // error (should count as one because of inverse relation)
    addTriple(new URIImpl(topConcept), SKOS.BROADER, new URIImpl("http://some.concept"));
    addTriple(new URIImpl("http://some.other.concept"), SKOS.NARROWER, new URIImpl(topConcept));

    // no error
    addTriple(new URIImpl(topConcept), SKOS.NARROWER, new URIImpl("http://some.completely.other.concept"));

    addTriple(new URIImpl("http://some.completely.other.concept"), SKOS.BROADER, new URIImpl("http://some.completely.other.concept2"));

    Assert.assertEquals(1, countingNotifier.getNotificationCount());
}
 
开发者ID:rsine,项目名称:rsine,代码行数:20,代码来源:QualityNotificationsTest.java


示例9: getConnectedConceptTypes

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
/**
 *
 * @param instance
 * @param engine
 * @param instanceIsSubject
 * @return
 */
public static List<URI> getConnectedConceptTypes( URI instance, IEngine engine,
		boolean instanceIsSubject ) {
	String query = "SELECT DISTINCT ?subtype ?objtype \n"
			+ "WHERE { \n"
			+ "  ?subject ?predicate ?object .\n"
			+ "  ?subject a ?subtype .\n"
			+ "  ?subtype rdfs:subClassOf ?concept . FILTER( ?subtype != ?concept && ?subtype != ?skos ) .\n"
			+ "  ?object a ?objtype .\n"
			+ "  ?objtype rdfs:subClassOf ?concept . FILTER( ?objtype != ?concept && ?objtype != ?skos ) .\n"
			+ "}";

	OneVarListQueryAdapter<URI> lqa = OneVarListQueryAdapter.getUriList( query );
	lqa.bind( "concept", engine.getSchemaBuilder().getConceptUri().build() );
	lqa.bind( "skos", SKOS.CONCEPT );

	if ( instanceIsSubject ) {
		lqa.setVariableName( "objtype" );
		lqa.bind( "subject", instance );
	}
	else {
		lqa.setVariableName( "subtype" );
		lqa.bind( "object", instance );
	}

	log.debug( "connected types (one instance) is: " + lqa.bindAndGetSparql() );

	return engine.queryNoEx( lqa );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:36,代码来源:NodeDerivationTools.java


示例10: testDisjointClasses

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
/**
 * cax-dw
 */
@Test
public void testDisjointClasses() throws Exception {
    schema.processTriple(TestUtils.statement(SKOS.CONCEPT, OWL.DISJOINTWITH,
        SKOS.COLLECTION));
    reasoner.processFact(TestUtils.fact(TestUtils.NODE, RDF.TYPE,
        SKOS.CONCEPT));
    reasoner.processFact(TestUtils.fact(TestUtils.NODE, RDF.TYPE,
        SKOS.COLLECTION));
    Assert.assertTrue("Disjoint class membership not detected",
        reasoner.hasInconsistencies());
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:15,代码来源:LocalReasonerTest.java


示例11: testInputDisjointClass

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void testInputDisjointClass() throws Exception {
    Schema schema = new Schema();
    schema.processTriple(TestUtils.statement(SKOS.CONCEPT,
        OWL.DISJOINTWITH, SKOS.COLLECTION));
    Assert.assertTrue("(x disjointWith y): y not found in x's disjoint classes",
        schema.getClass(SKOS.CONCEPT).getDisjointClasses().contains(SKOS.COLLECTION));
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:9,代码来源:SchemaTest.java


示例12: testInputDisjointClassReverse

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void testInputDisjointClassReverse() throws Exception {
    Schema schema = new Schema();
    schema.processTriple(TestUtils.statement(SKOS.CONCEPT,
        OWL.DISJOINTWITH, SKOS.COLLECTION));
    Assert.assertTrue("(x disjointWith y): x not found in y's disjoint classes",
        schema.getClass(SKOS.COLLECTION).getDisjointClasses().contains(SKOS.CONCEPT));
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:9,代码来源:SchemaTest.java


示例13: testInputSymmetric

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void testInputSymmetric() throws Exception {
    Schema schema = new Schema();
    schema.processTriple(TestUtils.statement(SKOS.RELATED,
        RDF.TYPE, OWL.SYMMETRICPROPERTY));
    Assert.assertTrue("Property should be identified as symmetric",
        schema.getProperty(SKOS.RELATED).isSymmetric());
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:9,代码来源:SchemaTest.java


示例14: handleStatement

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Override
public void handleStatement(final Statement st) {
    if (conceptMap.get(st.getSubject().stringValue()) == null) {
        conceptMap.put(st.getSubject().stringValue(),
                new HashMap<String, Object>());
    }
    HashMap<String, Object> concept =
            conceptMap.get(st.getSubject().stringValue());
    if (st.getPredicate().equals(SKOS.PREF_LABEL)) {
        concept.put("prefLabel", st.getObject().stringValue());
    }
    if (st.getPredicate().equals(SKOS.NOTATION)) {
        concept.put("notation", st.getObject().stringValue());
    }
    if (st.getPredicate().equals(SKOS.BROADER)) {
        if (concept.get("broader") == null) {
            concept.put("broader",
                    new ArrayList<String>());
        }
        @SuppressWarnings("unchecked")
        ArrayList<String> broaderList =
            (ArrayList<String>) concept.get("broader");
        broaderList.add(st.getObject().stringValue());
    }
    if (st.getPredicate().equals(SKOS.NARROWER)) {
        if (concept.get("narrower") == null) {
            concept.put("narrower",
                    new ArrayList<String>());
        }
        @SuppressWarnings("unchecked")
        ArrayList<String> narrowerList =
            (ArrayList<String>) concept.get("narrower");
        narrowerList.add(st.getObject().stringValue());
    }
}
 
开发者ID:au-research,项目名称:ANDS-Vocabs-Toolkit,代码行数:36,代码来源:JsonListTransformProvider.java


示例15: handleStatement

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Override
public void handleStatement(final Statement st) {
    if (st.getPredicate().equals(SKOS.PREF_LABEL)) {
        countedPrefLabels++;
        conceptText += st.getObject().stringValue() + " ";
    }
}
 
开发者ID:au-research,项目名称:ANDS-Vocabs-Toolkit,代码行数:8,代码来源:SolrIndexTransformProvider.java


示例16: handleStatement

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Override
public void handleStatement(final Statement st) {
    for (Entry<URI, String> term : metadataToLookFor.entrySet()) {
        if (st.getPredicate().equals(term.getKey())) {
           addToMap(term.getValue(), st);
        }
    }
    if (st.getPredicate().equals(RDF.TYPE)
            && (st.getObject().equals(SKOS.CONCEPT))) {
        countedConcepts++;
    }
}
 
开发者ID:au-research,项目名称:ANDS-Vocabs-Toolkit,代码行数:13,代码来源:GetMetadataTransformProvider.java


示例17: useInjectedDomains

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
/**
 * Using the appropriate constructor, it is possible to define a custom set of domains.
 */
@Test
public void useInjectedDomains() {
	final String[] customDomains = { FOAF.NAMESPACE, SKOS.NAMESPACE };

	_cut = new KnownURIsDictionary(randomString(), _decoratee, customDomains);

	assertArrayEquals(customDomains, _cut._domains);
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:12,代码来源:KnownURIsDictionaryTest.java


示例18: addConcepts

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
private void addConcepts() throws RepositoryException {
    mainConceptUri = new URIImpl("http://reegle.info/glossary/440");
    abandonedConceptUri = new URIImpl("http://reegle.info/glossary/442");
    abandonedConceptPrefLabel = new LiteralImpl("combi storage tanks", "en");

    Statement mainConcept = new StatementImpl(mainConceptUri, RDF.TYPE, SKOS.CONCEPT);
    Statement abandonedConcept = new StatementImpl(abandonedConceptUri, RDF.TYPE, SKOS.CONCEPT);
    Statement abandonedConceptLabel = new StatementImpl(abandonedConceptUri, SKOS.PREF_LABEL, abandonedConceptPrefLabel);
    repCon.add(mainConcept);
    repCon.add(abandonedConcept);
    repCon.add(abandonedConceptLabel);
}
 
开发者ID:rsine,项目名称:rsine,代码行数:13,代码来源:ConceptMergeTest.java


示例19: mergeDetection

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
@Test
public void mergeDetection() throws RepositoryException {
    Helper.setLabel(repCon,
            new URIImpl("http://reegle.info/glossary/1111"),
            SKOS.PREF_LABEL,
            new LiteralImpl("Ottakringer Helles", "en"),
            persistAndNotifyProvider);
    Helper.setAltLabel(repCon, mainConceptUri, abandonedConceptPrefLabel, persistAndNotifyProvider);
    removeConcept(abandonedConceptUri);

    Assert.assertEquals(1, countingNotifier.getNotificationCount());
}
 
开发者ID:rsine,项目名称:rsine,代码行数:13,代码来源:ConceptMergeTest.java


示例20: persistChangeSet

import org.openrdf.model.vocabulary.SKOS; //导入依赖的package包/类
private void persistChangeSet() throws IOException {
    Model changeSet = new ChangeSetCreator().assembleChangeset(
        new StatementImpl(otherConceptUri, SKOS.BROADER, conceptUri),
        null,
        ChangeTripleService.CHANGETYPE_ADD);
    persistAndNotifyProvider.persistAndNotify(changeSet, true);
}
 
开发者ID:rsine,项目名称:rsine,代码行数:8,代码来源:NotificationWithAuxiliaryTest.java



注:本文中的org.openrdf.model.vocabulary.SKOS类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProgressBarDeterminate类代码示例发布时间:2022-05-22
下一篇:
Java HorizontalAlignment类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap