当前位置: 首页>>代码示例>>Java>>正文


Java DCTerms类代码示例

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


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

示例1: addISICAssetModel

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
/**
 * Adds the asset and asset distribution information for a classification in the model.
 * 
 * @param classification Short name of the classification, e.g. "NACE", "ISIC", etc.
 * @param version Version of the classification ("4", "2.1", "2008", etc.).
 */
private void addISICAssetModel(String classification, String version) {

	Resource csAssetResource = admsModel.createResource(ADMS_BASE_URI + "asset/" + Names.getCSContext(classification, version), ADMS.Asset);
	csAssetResource.addProperty(DCTerms.type, ADMS.TaxonomyAssetType); // Or CodeList
	csAssetResource.addProperty(ADMS.identifier, Names.getCSShortName(classification, version));
	csAssetResource.addProperty(DCTerms.title, Names.getCSLabel(classification, version));
	csAssetResource.addProperty(ADMS.status, ADMS.CompletedStatus); // TODO The asset itself is completed, the distribution is under development

	// TODO Do we directly take the SKOS ConceptScheme resource as ADMS distribution, or do we define a specific resource?
	Resource csDistributionResource = admsModel.createResource(csAssetResource.getURI() + "/skos", ADMS.AssetDistribution);
	csDistributionResource.addProperty(ADMS.status, ADMS.UnderDevelopmentStatus);
	csDistributionResource.addProperty(ADMS.representationTechnique, ADMS.SKOSRepresentationTechnique);
	csDistributionResource.addProperty(ADMS.representationTechnique, ADMS.SPARQLRepresentationTechnique);
	csAssetResource.addProperty(DCAT.distribution, csDistributionResource);

	repositoryResource.addProperty(ADMS.includedAsset, csAssetResource);
}
 
开发者ID:FranckCo,项目名称:Stamina,代码行数:24,代码来源:ADMSModelMaker.java

示例2: write

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
@Override
public void write(StringWriter writer, String format) {
    Model rdfModel = ModelFactory.createDefaultModel();
    Resource rec = rdfModel.createResource(this.baseUrl);
    rec.addLiteral(DCTerms.identifier, this.identifier);
    if (from != null){
       rec.addLiteral(DCTerms.date, this.from);
    } else if(this.fromString != null) {
       rec.addLiteral(DCTerms.date, this.fromString);
    } if (until != null){
       rec.addLiteral(DCTerms.date, this.until);
    } else if(this.untilString != null){ 
       rec.addLiteral(DCTerms.date, this.untilString);
    }
    rdfModel.write(writer, format);
}
 
开发者ID:DTL-FAIRData,项目名称:ODEX-FAIRDataPoint,代码行数:17,代码来源:Request.java

示例3: write

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
@Override
public void write(StringWriter writer, String format) {
    Model rdfModel = ModelFactory.createDefaultModel();
    Resource rdfRec = rdfModel.createResource(this.baseURL);
    rdfRec.addProperty(DCTerms.title, this.repositoryName)
            .addProperty(DCTerms.hasVersion, this.protocolVersion);
    for (String email : this.adminEmails){
        rdfRec.addProperty(VCARD.EMAIL, email);
    } 
    rdfModel.createTypedLiteral(this.earliestDatestamp);
    rdfModel.createTypedLiteral(this.deletedRecord);
    rdfModel.createTypedLiteral(this.granularity);
    if (!this.compressions.isEmpty()){
        for (String compression : this.compressions){
            rdfModel.createTypedLiteral(compression);
        } 
    }
    rdfModel.write(writer);
    if (this.description != null) {
        description.write(writer, format);
    }
}
 
开发者ID:DTL-FAIRData,项目名称:ODEX-FAIRDataPoint,代码行数:23,代码来源:Identify.java

示例4: toResource

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
public Resource toResource(Exception ex, Response.StatusType status, Resource statusResource)
{
    if (ex == null) throw new IllegalArgumentException("Exception cannot be null");
    if (status == null) throw new IllegalArgumentException("Response.Status cannot be null");
    //if (statusResource == null) throw new IllegalArgumentException("Status Resource cannot be null");

    Resource resource = ModelFactory.createDefaultModel().createResource().
            addProperty(RDF.type, HTTP.Response).
            addLiteral(HTTP.statusCodeValue, status.getStatusCode()).
            addLiteral(HTTP.reasonPhrase, status.getReasonPhrase());

    if (statusResource != null) resource.addProperty(HTTP.sc, statusResource);
    if (ex.getMessage() != null) resource.addLiteral(DCTerms.title, ex.getMessage());
    
    return resource;
}
 
开发者ID:AtomGraph,项目名称:Processor,代码行数:17,代码来源:ExceptionMapperBase.java

示例5: doStatusUpdate

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
private void doStatusUpdate(RegisterItem ri, String requestedStatus) {
    // TODO handle verification for accepted
    Resource status = parameters.containsKey(Parameters.FORCE) ? ri.forceStatus(requestedStatus): ri.setStatus(requestedStatus);
    if (status == null) {
        logResponse("Rejecting status update");
        throw new WebApplicationException(Response.Status.FORBIDDEN);
    }
    if (status.equals(RegistryVocab.statusExperimental) || status.equals(RegistryVocab.statusStable)) {
        RDFUtil.timestamp(ri.getRoot(), DCTerms.dateAccepted);
    }
    if ( parameters.containsKey(Parameters.SUCCESSOR) ) {
        setSuccessor(ri, parameters.getFirst(Parameters.SUCCESSOR) );
    }
    store.update(ri, false);
    checkDelegation(ri);
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:17,代码来源:CommandStatusUpdate.java

示例6: injectVersionHistory

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
private void injectVersionHistory(Description d) {
    Model m = d.getRoot().getModel();
    for (VersionInfo vi : store.listVersions(target)) {
        Resource interval = m.createResource();
        addTimestamp(interval, Time.hasBeginning, vi.getFromTime());
        addTimestamp(interval, Time.hasEnd, vi.getToTime());

        Resource ver = m.createResource( vi.getUri() )
            .addProperty(DCTerms.isVersionOf, d.getRoot())
            .addProperty(RDF.type, RegistryVocab.RegisterItem)
            .addProperty(RDF.type, Version.Version)
            .addProperty(Version.interval, interval)
            .addLiteral(OWL.versionInfo, vi.getVersion());
        if (vi.getReplaces() != null) {
            ver.addProperty(DCTerms.replaces, m.createResource(vi.getReplaces()));
        }
        if (vi.getToTime() == -1) {
            m.add(d.getRoot(), Version.currentVersion, ver);
        }
    }
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:22,代码来源:CommandRead.java

示例7: doUpdateRegister

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
protected Resource doUpdateRegister(Resource root, Calendar cal,
        Property... rigids) {
    root.removeAll(RegistryVocab.subregister);
    Resource current = getDefaultModel().getResource(root.getURI());
    Resource temp = current
            .getPropertyResourceValue(Version.currentVersion);
    if (temp != null) {
        current = temp;
    }
    // doUpdate call will need current versionInfo to be able to allocate
    // next version correctly
    RDFUtil.copyProperty(current, root, OWL.versionInfo);
    // Preserve subregister - could this just be added to rigids
    RDFUtil.copyProperty(current, root, RegistryVocab.subregister);
    root.removeAll(DCTerms.modified).addProperty(DCTerms.modified,
            getDefaultModel().createTypedLiteral(cal));
    return doUpdate(root, cal, rigids);
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:19,代码来源:StoreBaseImpl.java

示例8: doJsonldTests

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
private void doJsonldTests() throws IOException {
    // Assumes reg1 set up
    assertEquals(201, postFileStatus("test/purple-testcase.jsonld", REG1, JSONLDSupport.MIME_JSONLD));
    Model m = getModelResponse(BASE_URL + "reg1/purple");
    Resource r = m.getResource(ROOT_REGISTER + "reg1/purple");
    assertEquals("purple", RDFUtil.getStringValue(r, RDFS.label));
    assertEquals("I am purple but described using JSON-LD, good luck with that", RDFUtil.getStringValue(r, DCTerms.description));

    Response response = getResponse(BASE_URL + "reg1/blue", JSONLDSupport.MIME_JSONLD);
    assertEquals(200, response.getStatus());
    InputStream is = response.readEntity(InputStream.class);
    m = JSONLDSupport.readModel(RequestProcessor.DUMMY_BASE_URI, is);
    is.close();
    r = m.getResource(ROOT_REGISTER + "reg1/blue");
    assertEquals("blue", RDFUtil.getStringValue(r, RDFS.label));

    // JSON-LD patch
    assertEquals(204, invoke("PATCH", "test/reg1-patch.jsonld", REG1 + "?non-member-properties", "application/ld+json").getStatus());
    m = getModelResponse(REG1 + "?non-member-properties");
    assertEquals("Updated register 1", RDFUtil.getStringValue(m.getResource(REG1_URI), DCTerms.description));

}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:23,代码来源:TestAPI.java

示例9: doBNodeDuplicationBugTest

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
/**
 *  Test case for bnode duplication on registry reconstruction
 */
private void doBNodeDuplicationBugTest() {
    assertEquals(201, postFileStatus("test/rbd.ttl", BASE_URL + "?batch-managed&status=stable"));
    
    Model m = getModelResponse(BASE_URL + "RiverBasinDistrict");
    Resource reg = m.getResource("http://location.data.gov.uk/RiverBasinDistrict"); 
    int count = reg.listProperties(DCTerms.rights).toList().size();
    assertEquals(1, count);
    int version = RDFUtil.getIntValue(reg, OWL.versionInfo, -1);

    // Add to the register
    assertEquals(201, postFileStatus("test/red.ttl", BASE_URL + "RiverBasinDistrict"));
    m = getModelResponse(BASE_URL + "RiverBasinDistrict");
    reg = m.getResource("http://location.data.gov.uk/RiverBasinDistrict"); 
    assertEquals(version + 1, RDFUtil.getIntValue(reg, OWL.versionInfo, -1));        
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:19,代码来源:TestAPI.java

示例10: doEditTest

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
/**
 * Basic edit test cases
 */
private void doEditTest() {
    final String REGE = BASE_URL + "rege";
    assertEquals(201, postFileStatus("test/edit/rege.ttl", BASE_URL));
    assertEquals(204, postFileStatus("test/edit/edit1.ttl", REGE + "?edit"));
    checkModelResponse(REGE + "?_view=with_metadata&status=any", "test/edit/expected1.ttl", 
            DCTerms.dateSubmitted, DCTerms.modified);
    assertEquals(204, postFileStatus("test/edit/edit2.ttl", REGE + "?edit"));
    checkModelResponse(REGE + "?_view=with_metadata&status=any", "test/edit/expected2.ttl", 
            DCTerms.dateSubmitted, DCTerms.modified);
    // Re-apply same edit which should not change versions
    assertEquals(204, postFileStatus("test/edit/edit2.ttl", REGE + "?edit"));
    checkModelResponse(REGE + "?_view=with_metadata&status=any", "test/edit/expected2.ttl", 
            DCTerms.dateSubmitted, DCTerms.modified);
    assertEquals(204, postFileStatus("test/edit/edit3.csv", REGE + "?edit", "text/csv"));
    checkModelResponse(REGE + "?_view=with_metadata&status=any", "test/edit/expected3.ttl", 
            DCTerms.dateSubmitted, DCTerms.modified);
    assertEquals(204, postFileStatus("test/edit/edit4.ttl", REGE + "?edit"));
    checkModelResponse(REGE + "?_view=with_metadata&status=any", "test/edit/expected4.ttl", 
            DCTerms.dateSubmitted, DCTerms.modified);
}
 
开发者ID:UKGovLD,项目名称:registry-core,代码行数:24,代码来源:TestAPI.java

示例11: processSuiteResults

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
/**
 * Creates EARL statements for the entire collection of test suite results.
 * Each test subset is defined by a {@literal <test>} tag in the suite
 * definition; these correspond to earl:TestRequirement resources in the
 * model.
 * 
 * @param model
 *            An RDF Model containing EARL statements.
 * @param results
 *            A Map containing the actual test results, where the key is the
 *            name of a test subset (conformance class).
 */
void processSuiteResults(Model model, Map<String, ISuiteResult> results) {
    for (Map.Entry<String, ISuiteResult> entry : results.entrySet()) {
        String testReqName = entry.getKey().replaceAll("\\s", "-");
        // can return existing resource in model
        Resource testReq = model.createResource(testReqName);
        ITestContext testContext = entry.getValue().getTestContext();
        int nPassed = testContext.getPassedTests().size();
        int nSkipped = testContext.getSkippedTests().size();
        int nFailed = testContext.getFailedTests().size();
        testReq.addLiteral(CITE.testsPassed, new Integer(nPassed));
        testReq.addLiteral(CITE.testsFailed, new Integer(nFailed));
        testReq.addLiteral(CITE.testsSkipped, new Integer(nSkipped));
        if (nPassed + nFailed == 0) {
            testReq.addProperty(DCTerms.description,
                    "A precondition was not met. All tests in this set were skipped.");
        }
        processTestResults(model, testContext.getFailedTests());
        processTestResults(model, testContext.getSkippedTests());
        processTestResults(model, testContext.getPassedTests());
    }
}
 
开发者ID:opengeospatial,项目名称:teamengine,代码行数:34,代码来源:EarlReporter.java

示例12: addTestInputs

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
/**
 * Adds the test inputs to the TestRun resource. Each input is an anonymous
 * member of an unordered collection (rdf:Bag). A {@value #TEST_RUN_ID}
 * parameter is treated in special manner: its value is set as the value of
 * the standard dct:identifier property.
 * 
 * @param earl
 *            An RDF model containing EARL statements.
 * @param params
 *            A collection of name-value pairs gleaned from the test suite
 *            parameters.
 */
void addTestInputs(Model earl, final Map<String, String> params) {
    Bag inputs = earl.createBag();
    for (Map.Entry<String, String> param : params.entrySet()) {
        if (param.getKey().equals(TEST_RUN_ID)) {
            this.testRun.addProperty(DCTerms.identifier, param.getValue());
        } else {
            if (param.getValue().isEmpty())
                continue;
            Resource testInput = earl.createResource();
            testInput.addProperty(DCTerms.title, param.getKey());
            testInput.addProperty(DCTerms.description, param.getValue());
            inputs.add(testInput);
        }
    }
    this.testRun.addProperty(CITE.inputs, inputs);
}
 
开发者ID:opengeospatial,项目名称:teamengine,代码行数:29,代码来源:EarlReporter.java

示例13: write

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
@Override
public Resource write(Model model) {
    Resource resource = ElementWriter.copyElementResourceInModel(testGenerator, model);

    resource
            .addProperty(RDF.type, RDFUNITv.TestGenerator)
            .addProperty(DCTerms.description, testGenerator.getDescription())
            .addProperty(RDFUNITv.sparqlGenerator, testGenerator.getQuery())
            .addProperty(RDFUNITv.basedOnPattern, ElementWriter.copyElementResourceInModel(testGenerator.getPattern(), model));


    for (ResultAnnotation resultAnnotation: testGenerator.getAnnotations()) {
        Resource annotationResource = ResultAnnotationWriter.create(resultAnnotation).write(model);
        resource.addProperty(RDFUNITv.resultAnnotation, annotationResource);
    }

    return resource;
}
 
开发者ID:AKSW,项目名称:RDFUnit,代码行数:19,代码来源:TestGeneratorWriter.java

示例14: write

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
@Override
public Resource write(Model model) {
    Resource resource = ElementWriter.copyElementResourceInModel(pattern, model);

    resource
            .addProperty(RDF.type, RDFUNITv.Pattern)
            .addProperty(DCTerms.identifier, pattern.getId())
            .addProperty(DCTerms.description, pattern.getDescription())
            .addProperty(RDFUNITv.sparqlWherePattern, pattern.getSparqlWherePattern());

    if (pattern.getSparqlPatternPrevalence().isPresent()) {
        resource.addProperty(RDFUNITv.sparqlPrevalencePattern, pattern.getSparqlPatternPrevalence().get());
    }

    for (PatternParameter patternParameter: pattern.getParameters()) {
        Resource parameter = PatternParameterWriter.create(patternParameter).write(model);
        resource.addProperty(RDFUNITv.parameter, parameter);
    }

    for (ResultAnnotation resultAnnotation: pattern.getResultAnnotations()) {
        Resource annotationResource = ResultAnnotationWriter.create(resultAnnotation).write(model);
        resource.addProperty(RDFUNITv.resultAnnotation, annotationResource);
    }

    return resource;
}
 
开发者ID:AKSW,项目名称:RDFUnit,代码行数:27,代码来源:PatternWriter.java

示例15: setUp

import org.apache.jena.vocabulary.DCTerms; //导入依赖的package包/类
@BeforeEach
@SuppressWarnings("unchecked")
public void setUp() {
    initMocks(this);
    final Map<String, String> namespaces = new HashMap<>();
    namespaces.put("dcterms", DCTerms.NS);
    namespaces.put("rdf", RDF.uri);

    final Map<String, String> properties = new HashMap<>();
    properties.put("icon", "//www.trellisldp.org/assets/img/trellis.png");
    properties.put("css", "//www.trellisldp.org/assets/css/trellis.css");

    service = new JenaIOService(mockNamespaceService, properties,
            singleton("http://www.w3.org/ns/anno.jsonld"), singleton("http://www.trellisldp.org/ns/"), mockCache);

    service2 = new JenaIOService(mockNamespaceService, properties, emptySet(),
            singleton("http://www.w3.org/ns/"), mockCache);

    service3 = new JenaIOService(mockNamespaceService);

    when(mockNamespaceService.getNamespaces()).thenReturn(namespaces);
    when(mockNamespaceService.getPrefix(eq("http://purl.org/dc/terms/"))).thenReturn(Optional.of("dc"));
    when(mockNamespaceService.getPrefix(eq("http://sws.geonames.org/4929022/"))).thenReturn(empty());
    when(mockNamespaceService.getPrefix(eq("http://www.w3.org/1999/02/22-rdf-syntax-ns#")))
        .thenReturn(Optional.of("rdf"));
    when(mockNamespaceService.getPrefix(eq("http://purl.org/dc/dcmitype/")))
        .thenReturn(Optional.of("dcmitype"));
    when(mockCache.get(anyString(), any(Function.class))).thenAnswer(inv -> {
        final String key = (String) inv.getArgument(0);
        final Function mapper = (Function<String, String>) inv.getArgument(1);
        return mapper.apply(key);
    });
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:34,代码来源:IOServiceTest.java


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