Java 类com.hp.hpl.jena.rdf.model.Property 实例源码

项目:r2rml-kit    文件:Message.java   
/**
 * @param problem
 * @param subject May be null
 * @param predicates May be null
 * @param objects May be null
 */
public Message(Problem problem, Resource subject,
        Property[] predicates, RDFNode[] objects) {
    this.problem = problem;
    this.subject = subject;
    this.predicates = 
        predicates == null 
                ? Collections.<Property>emptyList() 
                : Arrays.asList(predicates);
    Collections.sort(this.predicates, RDFComparator.getRDFNodeComparator());
    this.objects = 
        objects == null 
                ? Collections.<RDFNode>emptyList() 
                : Arrays.asList(objects);
    Collections.sort(this.objects, RDFComparator.getRDFNodeComparator());
    this.detailCode = null;
    this.details = null;
    this.cause = null;
}
项目:r2rml-kit    文件:Message.java   
/**
 * @param problem
 * @param term
 * @param detailCode Optional error code; indicates a subclass of problems
 * @param details Optional string containing error details
 * @param contextResource May be null
 * @param contextProperty May be null
 */
public Message(Problem problem, MappingTerm term, 
        String detailCode, String details, 
        Resource contextResource, Property contextProperty) {
    this.problem = problem;
    this.subject = contextResource; 
    this.predicates = 
        contextProperty == null 
                ? Collections.<Property>emptyList() 
                : Collections.singletonList(contextProperty);
    this.objects = 
        term == null
                ? Collections.<RDFNode>emptyList()
                : Collections.<RDFNode>singletonList(ResourceFactory.createPlainLiteral(term.toString()));
    this.detailCode = detailCode;
    this.details = details;
    this.cause = null;
}
项目:c4a_data_repository    文件:ClassMap.java   
public void validate() throws D2RQException {
    assertHasBeenDefined(this.database, D2RQ.dataStorage, D2RQException.CLASSMAP_NO_DATABASE);
    assertHasPrimarySpec(new Property[]{
            D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.uriSqlExpression, D2RQ.bNodeIdColumns, D2RQ.constantValue
    });
    if (this.constantValue != null && this.constantValue.isLiteral()) {
        throw new D2RQException(
                "d2rq:constantValue for class map " + toString() + " must be a URI or blank node", 
                D2RQException.CLASSMAP_INVALID_CONSTANTVALUE);
    }
    if (this.uriPattern != null && new Pattern(uriPattern).attributes().size() == 0) {
        this.log.warn(toString() + " has an uriPattern without any column specifications. This usually happens when no primary keys are defined for a table. If the configuration is left as is, all table rows will be mapped to a single instance. " +
                "If this is not what you want, please define the keys in the database and re-run the mapping generator, or edit the mapping to provide the relevant keys.");
    }
    for (PropertyBridge bridge: propertyBridges) {
        bridge.validate();
    }
    // TODO
}
项目:r2rml-kit    文件:DirectMappingStyle.java   
public Property getForeignKeyProperty(TableName tableName, ForeignKey foreignKey) {
    StringBuffer result = new StringBuffer(baseIRI);
    result.append(encodeTableName(tableName));
    int i = 1;
    for (Identifier column: foreignKey.getLocalColumns().getColumns()) {
        String encoded = encodeColumnName(column);
        if (i == 1) {
            result.append("#ref-");
            result.append(encoded);
        } else {
            result.append(";" + encoded);
        }
        i++;
    }
    return model.createProperty(result.toString());
}
项目:c4a_data_repository    文件:VocabularySummarizer.java   
public void assertNoUndefinedTerms(Model model, 
        int undefinedPropertyErrorCode, int undefinedClassErrorCode) {
    Collection<Property> unknownProperties = getUndefinedProperties(model);
    if (!unknownProperties.isEmpty()) {
        throw new D2RQException(
                "Unknown property " + PrettyPrinter.toString(
                        unknownProperties.iterator().next()) + ", maybe a typo?",
                undefinedPropertyErrorCode);
    }
    Collection<Resource> unknownClasses = getUndefinedClasses(model);
    if (!unknownClasses.isEmpty()) {
        throw new D2RQException(
                "Unknown class " + PrettyPrinter.toString(
                        unknownClasses.iterator().next()) + ", maybe a typo?",
                undefinedClassErrorCode);
    }
}
项目:r2rml-kit    文件:D2RQWriter.java   
private void printTranslationTable(TranslationTable table) {
    printMapObject(table, D2RQ.TranslationTable);
    out.printURIProperty(D2RQ.href, table.getHref());
    out.printProperty(D2RQ.javaClass, table.getJavaClass());
    Iterator<Translation> it = table.getTranslations().iterator();
    List<Map<Property,RDFNode>> values = new ArrayList<Map<Property,RDFNode>>();
    while (it.hasNext()) {
        Translation translation = it.next();
        Map<Property,RDFNode> r = new LinkedHashMap<Property,RDFNode>();
        r.put(D2RQ.databaseValue, 
                ResourceFactory.createPlainLiteral(translation.dbValue()));
        r.put(D2RQ.rdfValue, 
                ResourceFactory.createPlainLiteral(translation.rdfValue()));
        values.add(r);
    }
    out.printCompactBlankNodeProperties(D2RQ.translation, values);
}
项目:r2rml-kit    文件:D2RQValidator.java   
public void visit(DownloadMap downloadMap) {
    visitResourceMap(downloadMap);
    assertHasPrimarySpec(downloadMap, new Property[]{
            D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.uriSqlExpression, D2RQ.constantValue
    });
    if (downloadMap.getDatabase() == null && downloadMap.getBelongsToClassMap() == null) {
        error("Download map " + downloadMap + " needs a d2rq:dataStorage (or d2rq:belongsToClassMap)", 
                D2RQException.DOWNLOADMAP_NO_DATASTORAGE);
    }
    assertNotNull(downloadMap.getContentDownloadColumn(), D2RQ.contentDownloadColumn, 
            D2RQException.DOWNLOADMAP_NO_CONTENTCOLUMN);
    if (downloadMap.getConstantValue() != null && !downloadMap.getConstantValue().isURIResource()) {
        error("d2rq:constantValue for download map " + downloadMap + " must be a URI", 
                D2RQException.RESOURCEMAP_INVALID_CONSTANTVALUE);
    }
    // Validate media type?
}
项目:r2rml-kit    文件:D2RQValidator.java   
protected void assertHasPrimarySpec(ResourceMap resourceMap, Property[] allowedSpecs) {
    List<Property> definedSpecs = new ArrayList<Property>();
    for (Property allowedProperty: Arrays.asList(allowedSpecs)) {
        if (hasPrimarySpec(resourceMap, allowedProperty)) {
            definedSpecs.add(allowedProperty);
        }
    }
    if (definedSpecs.isEmpty()) {
        StringBuffer error = new StringBuffer(resourceMap.toString());
        error.append(" needs one of ");
        for (int i = 0; i < allowedSpecs.length; i++) {
            if (i > 0) {
                error.append(", ");
            }
            error.append(PrettyPrinter.toString(allowedSpecs[i]));
        }
        error(error.toString(), D2RQException.RESOURCEMAP_MISSING_PRIMARYSPEC);
    }
    if (definedSpecs.size() > 1) {
        error(resourceMap + " can't have both " +
                PrettyPrinter.toString((Property) definedSpecs.get(0)) +
                " and " +
                PrettyPrinter.toString((Property) definedSpecs.get(1)),
                D2RQException.RESOURCEMAP_DUPLICATE_PRIMARYSPEC);
    }
}
项目:c4a_data_repository    文件:DownloadMap.java   
@Override
public void validate() throws D2RQException {
    assertHasPrimarySpec(new Property[]{
            D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.constantValue
    });
    if (database == null && belongsToClassMap == null) {
        throw new D2RQException(
                "Download map " + toString() + " needs a d2rq:dataStorage (or d2rq:belongsToClassMap)", 
                D2RQException.DOWNLOADMAP_NO_DATASTORAGE);
    }
    assertHasBeenDefined(contentDownloadColumn, D2RQ.contentDownloadColumn, 
            D2RQException.DOWNLOADMAP_NO_CONTENTCOLUMN);
    if (this.constantValue != null && !this.constantValue.isURIResource()) {
        throw new D2RQException(
                "d2rq:constantValue for download map " + toString() + " must be a URI", 
                D2RQException.DOWNLOADMAP_INVALID_CONSTANTVALUE);
    }
    if (this.uriPattern != null && new Pattern(uriPattern).attributes().size() == 0) {
        log.warn(toString() + " has an uriPattern without any column specifications. This usually happens when no primary keys are defined for a table. If the configuration is left as is, all table rows will be mapped to a single instance. " +
                "If this is not what you want, please define the keys in the database and re-run the mapping generator, or edit the mapping to provide the relevant keys.");
    }
}
项目:r2rml-kit    文件:D2RQTarget.java   
public void generateRefProperty(Property property, 
        TableName table, ForeignKey foreignKey) {
    IdentifierList localColumns = foreignKey.getLocalColumns();
    TableName referencedTable = foreignKey.getReferencedTable();
    PropertyBridge bridge = new PropertyBridge(
            getPropertyBridgeResource(table, localColumns));
    bridge.setBelongsToClassMap(getClassMap(table));
    bridge.addProperty(property);
    bridge.setRefersToClassMap(getClassMap(referencedTable));
    TableName target = referencedTable;
    if (referencedTable.equals(table)) {
        // Same-table join? Then we need to set up an alias for the table and join to that
        target = TableName.create(null, null, 
                Identifier.createDelimited( 
                        Microsyntax.toString(referencedTable).replace('.', '_') + "__alias"));
        bridge.addAlias(new AliasDeclaration(referencedTable, target));
        foreignKey = new ForeignKey(foreignKey.getLocalColumns(), foreignKey.getReferencedColumns(), target);
    }
    for (Join join: Join.createFrom(table, foreignKey)) {
        bridge.addJoin(join);
    }
}
项目:ontonethub    文件:IndexingJob.java   
private List<Statement> getUsage(Property property, Model model){

    List<Statement> stmts = new ArrayList<Statement>();
    String sparql = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
            + "PREFIX owl: <http://www.w3.org/2002/07/owl#> "
            + "SELECT DISTINCT ?concept "
            + "WHERE{"
            + "  {<" + property.getURI() + "> rdfs:domain ?concept} "
            + "  UNION "
            + "  { "
            + "    ?concept rdfs:subClassOf|owl:equivalentClass ?restriction . "
            + "    ?restriction a owl:Restriction; "
            + "      owl:onProperty <" + property.getURI() + "> "
            + "  } "
            + "}";
    Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
    QueryExecution queryExecution = QueryExecutionFactory.create(query, model);

    ResultSet resultSet = queryExecution.execSelect();
    while(resultSet.hasNext()){
        QuerySolution querySolution = resultSet.next();
        Resource concept = querySolution.getResource("concept");

        stmts.add(new StatementImpl(property, usage, concept));
    }

    return stmts;

}
项目:c4a_data_repository    文件:VocabularySummarizer.java   
public Collection<Property> getUndefinedProperties(Model model) {
    Set<Property> result = new HashSet<Property>();
    StmtIterator it = model.listStatements();
    while (it.hasNext()) {
        Statement stmt = it.nextStatement();
        if (stmt.getPredicate().getURI().startsWith(namespace)
                && !properties.contains(stmt.getPredicate())) {
            result.add(stmt.getPredicate());
        }
    }
    return result;
}
项目:zebra-puzzle-workshop    文件:Exercise31Test.java   
@Test
public void testOsloHasMainLanguageNorwegian() {
  Individual oslo = exercise31.getIndividual("Oslo");
  Property mainLanguage = ResourceFactory.createProperty(Exercise3.NS, "hasMainLanguage");
  RDFNode norwegian = ResourceFactory.createResource(Exercise3.NS + "Norwegian");
  Assert.assertTrue(oslo.hasProperty(mainLanguage, norwegian));
}
项目:r2rml-kit    文件:PrettyTurtleWriter.java   
public void printProperty(Property property, RDFNode term) {
    if (term == null) return;
    if (term.isResource()) {
        printPropertyTurtle(term != null, property, toTurtle(term.asResource()));
    } else {
        printPropertyTurtle(term != null, property, toTurtle(term.asLiteral()));
    }
}
项目:c4a_data_repository    文件:PropertyBridge.java   
public void validate() throws D2RQException {
    if (this.refersToClassMap != null) {
        if (!this.refersToClassMap.database().equals(this.belongsToClassMap.database())) {
            throw new D2RQException(toString() + 
                    " links two d2rq:ClassMaps with different d2rq:dataStorages",
                    D2RQException.PROPERTYBRIDGE_CONFLICTING_DATABASES);
        }
        // TODO refersToClassMap cannot be combined w/ value constraints or translation tables
    }
    if (properties.isEmpty() && dynamicPropertyPatterns.isEmpty()) {
        throw new D2RQException(toString() + " needs a d2rq:property or d2rq:dynamicProperty",
                D2RQException.PROPERTYBRIDGE_MISSING_PREDICATESPEC);
    }
    assertHasPrimarySpec(new Property[]{
            D2RQ.uriColumn, D2RQ.uriPattern, D2RQ.bNodeIdColumns,
            D2RQ.column, D2RQ.pattern, D2RQ.sqlExpression, D2RQ.uriSqlExpression, D2RQ.constantValue,
            D2RQ.refersToClassMap
    });
    if (this.datatype != null && this.lang != null) {
        throw new D2RQException(toString() + " has both d2rq:datatype and d2rq:lang",
                D2RQException.PROPERTYBRIDGE_LANG_AND_DATATYPE);
    }
    if (this.datatype != null && this.column == null && this.pattern == null
            && this.sqlExpression == null) {
        throw new D2RQException("d2rq:datatype can only be used with d2rq:column, d2rq:pattern " +
                "or d2rq:sqlExpression at " + this,
                D2RQException.PROPERTYBRIDGE_NONLITERAL_WITH_DATATYPE);
    }
    if (this.lang != null && this.column == null && this.pattern == null) {
        throw new D2RQException("d2rq:lang can only be used with d2rq:column, d2rq:pattern " +
                "or d2rq:sqlExpression at " + this,
                D2RQException.PROPERTYBRIDGE_NONLITERAL_WITH_LANG);
    }
}
项目:r2rml-kit    文件:PrettyTurtleWriter.java   
public void printPropertyTurtle(boolean writeIt, Property property, String turtleSnippet) {
    if (!writeIt) return;
    printIndent();
    out.print(toTurtle(property));
    out.print(" ");
    out.print(turtleSnippet);
    out.print(";");
}
项目:r2rml-kit    文件:PrettyTurtleWriter.java   
private String toTurtleCompact(Map<Property, RDFNode> resource) {
    if (resource.isEmpty()) return "[]";
    StringBuilder result = new StringBuilder("[ ");
    for (Property property: resource.keySet()) {
        result.append(toTurtle(property));
        result.append(" ");
        result.append(toTurtle(resource.get(property)));
        result.append("; ");
    }
    result.append("]");
    return result.toString();
}
项目:c4a_data_repository    文件:MapObject.java   
protected void assertHasBeenDefined(Object object, Property property, int errorCode) {
    if (object != null) {
        return;
    }
    throw new D2RQException("Missing " + PrettyPrinter.toString(property) + 
            " for " + this, errorCode);
}
项目:r2rml-kit    文件:VocabularySummarizer.java   
public Collection<Property> getUndefinedProperties(Model model) {
    Set<Property> result = new HashSet<Property>();
    StmtIterator it = model.listStatements();
    while (it.hasNext()) {
        Statement stmt = it.nextStatement();
        if (stmt.getPredicate().getURI().startsWith(namespace)
                && !properties.contains(stmt.getPredicate())) {
            result.add(stmt.getPredicate());
        }
    }
    return result;
}
项目:r2rml-kit    文件:VocabularySummarizerTest.java   
public void testFindOneUndefinedProperty() {
    final Model m = D2RQTestUtil.loadTurtle("vocab-summarizer/one-undefined-property.ttl");
    VocabularySummarizer vocab = new VocabularySummarizer(D2RQ.class);
    Collection<Property> expected = new HashSet<Property>() {{ 
        this.add(m.createProperty(D2RQ.NS + "price"));
    }};
    assertEquals(expected, vocab.getUndefinedProperties(m));
}
项目:c4a_data_repository    文件:DatasetDescriptionServlet.java   
private static Set<Resource> generatePartitions(Model m, Resource type,
        Property p) {
    Set<Resource> partitions = new HashSet<Resource>();
    ResIterator classIt = m.listResourcesWithProperty(RDF.type, type);
    while (classIt.hasNext()) {
        Resource classMap = classIt.next();
        StmtIterator pIt = classMap.listProperties(p);
        while (pIt.hasNext()) {
            partitions.add((Resource) pIt.next().getObject());
        }
    }
    return partitions;
}
项目:zebra-puzzle-workshop    文件:Exercise2.java   
private Model createModel() {
  Model model = ModelFactory.createDefaultModel();
  String NS = "http://www.computas.no/zebra/";
  model.setNsPrefix("", NS);
  model.setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#");
  Resource subject = model.createResource(NS + "Joe");
  Property predicate = model.createProperty(NS + "hasSentMessage");
  String object = "Hello World!";
  subject.addProperty(predicate, object, XSDDatatype.XSDstring);
  return model;
}
项目:r2rml-kit    文件:D2RQValidator.java   
private boolean hasPrimarySpec(ResourceMap map, Property property) {
    if (property.equals(D2RQ.bNodeIdColumns)) return !map.getBNodeIdColumnsParsed().isEmpty();
    if (property.equals(D2RQ.uriColumn)) return map.getURIColumn() != null;
    if (property.equals(D2RQ.uriPattern)) return map.getURIPattern() != null;
    if (property.equals(D2RQ.uriSqlExpression)) return map.getUriSQLExpression() != null;
    if (property.equals(D2RQ.column)) return ((PropertyBridge) map).getColumn() != null;
    if (property.equals(D2RQ.pattern)) return ((PropertyBridge) map).getPattern() != null;
    if (property.equals(D2RQ.sqlExpression)) return ((PropertyBridge) map).getSQLExpression() != null;
    if (property.equals(D2RQ.refersToClassMap)) return ((PropertyBridge) map).getRefersToClassMap() != null;
    if (property.equals(D2RQ.constantValue)) return map.getConstantValue() != null;
    throw new IllegalArgumentException("Not a primary spec: " + property);
}
项目:c4a_data_repository    文件:Mapping.java   
/**
 * Helper method to add definitions from a ResourceMap to its underlying resource
 * @param map
 * @param targetResource
 */
private void addDefinitions(ResourceMap map, Resource targetResource) {
    /* Infer rdfs:Class or rdf:Property type */
    Statement s = vocabularyModel.createStatement(targetResource, RDF.type, map instanceof ClassMap ? RDFS.Class : RDF.Property);
    if (!this.vocabularyModel.contains(s))
        this.vocabularyModel.add(s);

    /* Apply labels */
    for (Literal propertyLabel: map.getDefinitionLabels()) {
        s = vocabularyModel.createStatement(targetResource, RDFS.label, propertyLabel);
        if (!this.vocabularyModel.contains(s))
            this.vocabularyModel.add(s);
    }

    /* Apply comments */
    for (Literal propertyComment: map.getDefinitionComments()) {
        s = vocabularyModel.createStatement(targetResource, RDFS.comment, propertyComment);
        if (!this.vocabularyModel.contains(s))
            this.vocabularyModel.add(s);
    }

    /* Apply additional properties */
    for (Resource additionalProperty: map.getAdditionalDefinitionProperties()) {
        s = vocabularyModel.createStatement(targetResource, 
                    (Property)(additionalProperty.getProperty(D2RQ.propertyName).getResource().as(Property.class)),
                    additionalProperty.getProperty(D2RQ.propertyValue).getObject());
        if (!this.vocabularyModel.contains(s))
            this.vocabularyModel.add(s);                
    }
}
项目:r2rml-kit    文件:MapObject.java   
protected void assertArgumentNotNull(Object object, Property property, int errorCode) {
    if (object != null) {
        return;
    }
    throw new D2RQException("Object for " + PrettyPrinter.toString(property) + 
            " not found at " + this, errorCode);
}
项目:r2rml-kit    文件:Mapping.java   
/**
 * Helper method to add definitions from a ResourceMap to its underlying resource
 * @param map
 * @param targetResource
 */
private void addDefinitions(ResourceMap map, Resource targetResource) {
    /* Infer rdfs:Class or rdf:Property type */
    Statement s = vocabularyModel.createStatement(targetResource, RDF.type, map instanceof ClassMap ? RDFS.Class : RDF.Property);
    if (!this.vocabularyModel.contains(s))
        this.vocabularyModel.add(s);

    /* Apply labels */
    for (Literal propertyLabel: map.getDefinitionLabels()) {
        s = vocabularyModel.createStatement(targetResource, RDFS.label, propertyLabel);
        if (!this.vocabularyModel.contains(s))
            this.vocabularyModel.add(s);
    }

    /* Apply comments */
    for (Literal propertyComment: map.getDefinitionComments()) {
        s = vocabularyModel.createStatement(targetResource, RDFS.comment, propertyComment);
        if (!this.vocabularyModel.contains(s))
            this.vocabularyModel.add(s);
    }

    /* Apply additional properties */
    for (Resource additionalProperty: map.getAdditionalDefinitionProperties()) {
        s = vocabularyModel.createStatement(targetResource, 
                    (Property)(additionalProperty.getProperty(D2RQ.propertyName).getResource().as(Property.class)),
                    additionalProperty.getProperty(D2RQ.propertyValue).getObject());
        if (!this.vocabularyModel.contains(s))
            this.vocabularyModel.add(s);                
    }
}
项目:r2rml-kit    文件:ConflictChecker.java   
public void add(Resource resource, Property property) {
    if (properties.get(resource) == null) {
        properties.put(resource, property);
    }
    if (!properties.get(resource).equals(property)) {
        report.report(Problem.CONFLICTING_PROPERTIES, 
                resource, new Property[]{properties.get(resource), property});
    }
}
项目:r2rml-kit    文件:MappingValidator.java   
@Override
public void visitComponentProperty(Property property, Resource resource, 
        ComponentType... types) {
    validateComponentType(property, resource, types);
    propertyStack.push(property);
    resourceStack.push(resource);
    super.visitComponentProperty(property, resource, types);
    resourceStack.pop();
    propertyStack.pop();
}
项目:r2rml-kit    文件:MappingValidator.java   
@Override
public void visitComponent(TriplesMap triplesMap) {
    require(triplesMap, RR.logicalTable);
    if (triplesMap.getSubject() == null && triplesMap.getSubjectMap() == null) {
        report.report(Problem.REQUIRED_VALUE_MISSING, 
                getContextResource(),
                new Property[]{RR.subject, RR.subjectMap});
    }
    if (triplesMap.getSubject() != null && triplesMap.getSubjectMap() != null) {
        report.report(Problem.CONFLICTING_PROPERTIES, 
                getContextResource(),
                new Property[]{RR.subject, RR.subjectMap});
    }
    contextLogicalTable = getLogicalTable(triplesMap);
}
项目:c4a_data_repository    文件:MapObject.java   
protected void assertNotYetDefined(Object object, Property property, int errorCode) {
    if (object == null) {
        return;
    }
    throw new D2RQException("Duplicate " + PrettyPrinter.toString(property) + 
            " for " + this, errorCode);
}
项目:c4a_data_repository    文件:ModelAPITest.java   
void dumpStatement(Statement stmt) {
    Resource  subject   = stmt.getSubject();
    Property  predicate = stmt.getPredicate();
    RDFNode   object    = stmt.getObject();
    System.out.print(subject + " " + predicate + " ");
    if (object instanceof Resource) {
        System.out.print(object);
    } else { // object is a literal
        System.out.print(" \"" + object + "\"");
    }
    System.out.println(" .");
}
项目:r2rml-kit    文件:MappingVisitor.java   
public void visitTermProperty(Property property, MappingTerm term) {
    if (term == null) return;
    if (RR.subject.equals(property)) {
        ((ConstantShortcut) term).acceptAs(this, Position.SUBJECT_MAP);
    } else if (RR.predicate.equals(property)) {
        ((ConstantShortcut) term).acceptAs(this, Position.PREDICATE_MAP);
    } else if (RR.object.equals(property)) {
        ((ConstantShortcut) term).acceptAs(this, Position.OBJECT_MAP);
    } else if (RR.graph.equals(property)) {
        ((ConstantShortcut) term).acceptAs(this, Position.GRAPH_MAP);
    } else {
        term.accept(this);
    }
}
项目:r2rml-kit    文件:R2RMLReader.java   
public Set<Resource> listResourcesWith(Property... properties) {
    Set<Resource> result = new HashSet<Resource>();
    for (Property property: properties) {
        ResIterator it = model.listResourcesWithProperty(property);
        while (it.hasNext()) {
            result.add(it.next());
        }
    }
    return result;
}
项目:zebra-puzzle-workshop    文件:Exercise33Jena.java   
public Exercise33Jena() {
  ontModel = readModel(MODEL_INPUT_EX33_JENA);
  OntClass norwegianCity = ontModel.getOntClass(NS + "NorwegianCity");
  OntClass city = ontModel.getOntClass(NS + "City");
  RDFList intersectingClasses = ontModel.createList();
  intersectingClasses = intersectingClasses.with(city);
  Property hasMainLanguage = ontModel.getProperty(NS, "hasMainLanguage");
  Restriction hasMainLanguageRestriction = ontModel.createRestriction(hasMainLanguage);
  Resource norwegian = ontModel.getOntResource(NS + "Norwegian");
  hasMainLanguageRestriction.convertToHasValueRestriction(norwegian);
  intersectingClasses.add(hasMainLanguageRestriction);
  norwegianCity.getEquivalentClass().convertToIntersectionClass(intersectingClasses);
  individuals = getIndividuals(ontModel);
}
项目:r2rml-kit    文件:R2RMLReader.java   
public List<Resource> getResources(Resource r, Property p, NodeType acceptableNodeTypes) {
    List<Resource> result = new ArrayList<Resource>();
    for (RDFNode node: getRDFNodes(r, p, acceptableNodeTypes)) {
        result.add(node.asResource());
    }
    return result;
}
项目:phenopacket-reference-implementation    文件:RdfReader.java   
private static Property getProperty(String localName, Context context) {
    String expanded = null;
    try {
        if (localName.equals("types")) {
            expanded = RDF.type.getURI();
        } else {
            expanded = ContextUtil.expandIdentifierAsPropertyOrType(
                    localName, context);
        }
    } catch (JsonLdError e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return ResourceFactory.createProperty(expanded);
}
项目:r2rml-kit    文件:R2RMLReader.java   
public List<String> getStrings(Resource r, Property p) {
    List<String> result = new ArrayList<String>();
    for (RDFNode node: getRDFNodes(r, p, NodeType.STRING_LITERAL)) {
        result.add(node.asLiteral().getLexicalForm());
    }
    return result;
}
项目:c4a_data_repository    文件:VocabularySummarizer.java   
private Set<Resource> findAllClasses() {
    Set<Resource> results = new HashSet<Resource>();
    for (int i = 0; i < vocabularyJavaClass.getFields().length; i++) {
        Field field = vocabularyJavaClass.getFields()[i];
        if (!Modifier.isStatic(field.getModifiers())) continue;
        if (!Resource.class.isAssignableFrom(field.getType())) continue;
        if (Property.class.isAssignableFrom(field.getType())) continue;
        try {
            results.add((Resource) field.get(null));
        } catch (IllegalAccessException ex) {
            throw new D2RQException(ex);
        }
    }
    return results;
}
项目:r2rml-kit    文件:R2RMLWriter.java   
@Override
public void visitTermProperty(Property property, MappingTerm term) {
    if (term == null) return;
    if (term instanceof ConstantShortcut) {
        out.printProperty(property, ((ConstantShortcut) term).asRDFNode()); 
    } else if (term instanceof ConstantIRI) {
        out.printProperty(property, ((ConstantIRI) term).asResource()); 
    } else if (term instanceof SQLQuery) {
        out.printLongStringProperty(property, term.toString());
    } else {
        out.printProperty(property, term.toString());
    }
}
项目:c4a_data_repository    文件:VocabularySummarizer.java   
private Set<Property> findAllProperties() {
    Set<Property> results = new HashSet<Property>();
    for (int i = 0; i < vocabularyJavaClass.getFields().length; i++) {
        Field field = vocabularyJavaClass.getFields()[i];
        if (!Modifier.isStatic(field.getModifiers())) continue;
        if (!Property.class.isAssignableFrom(field.getType())) continue;
        try {
            results.add((Property) field.get(null));
        } catch (IllegalAccessException ex) {
            throw new D2RQException(ex);
        }
    }
    return results;
}