Ejemplo n.º 1
0
  public static void insertSystemTriples(
      ISparulExecutor executor, String dataGraphName, String metaGraphName) throws Exception {
    logger.info("Inserting Annotation Properties.");

    List<RDFTriple> triples = new ArrayList<RDFTriple>();

    MyVocabulary[] vocabs = {
      MyVocabulary.DC_MODIFIED,
      MyVocabulary.DBM_EDIT_LINK,
      MyVocabulary.DBM_PAGE_ID,
      MyVocabulary.DBM_REVISION,
      MyVocabulary.DBM_OAIIDENTIFIER
    };

    for (MyVocabulary item : vocabs) {
      triples.add(
          new RDFTriple(
              new RDFResourceNode(item.getIRI()),
              new RDFResourceNode(OWLRDFVocabulary.RDF_TYPE.getIRI()),
              new RDFResourceNode(OWLRDFVocabulary.OWL_ANNOTATION_PROPERTY.getIRI())));
    }

    List<RDFTriple> metaTriples = new ArrayList<RDFTriple>();
    for (RDFTriple item : triples) {
      URI uri = RDFUtil.generateMD5HashUri("http://dbpedia.org/sysvocab/", item);

      RDFResourceNode reifier = new RDFResourceNode(IRI.create(uri));

      metaTriples.add(
          new RDFTriple(
              reifier,
              new RDFResourceNode(OWLRDFVocabulary.OWL_ANNOTATED_SOURCE.getIRI()),
              item.getSubject()));
      metaTriples.add(
          new RDFTriple(
              reifier,
              new RDFResourceNode(OWLRDFVocabulary.OWL_ANNOTATED_PROPERTY.getIRI()),
              item.getProperty()));
      metaTriples.add(
          new RDFTriple(
              reifier,
              new RDFResourceNode(OWLRDFVocabulary.OWL_ANNOTATED_TARGET.getIRI()),
              item.getObject()));
      metaTriples.add(
          new RDFTriple(
              reifier,
              new RDFResourceNode(MyVocabulary.DBM_EXTRACTED_BY.getIRI()),
              new RDFResourceNode(IRI.create(TBoxExtractor.extractorUri))));
    }

    executor.insert(metaTriples, metaGraphName);
    executor.insert(triples, dataGraphName);
  }