Examples of RDFDataSet


Examples of com.github.jsonldjava.core.RDFDataset

                + subject.getClass().getName());
    }

    @Override
    public RDFDataset parse(Object input) throws JsonLdError {
        final RDFDataset result = new RDFDataset();
        if (input instanceof Statement) {
            handleStatement(result, (Statement) input);
        } else if (input instanceof Graph) {
            if (input instanceof Model) {
                final Set<Namespace> namespaces = ((Model) input).getNamespaces();
View Full Code Here

Examples of com.github.jsonldjava.core.RDFDataset

            // opts.skipExpansion = false;
            opts.setCompactArrays(true);
            // opts.keepFreeFloatingNodes = false;
            final JsonLdApi api = new JsonLdApi(opts);
            final JenaRDFParser parser = new JenaRDFParser();
            final RDFDataset result = parser.parse(dataset);
            Object obj = api.fromRDF(result);
            final Map<String, Object> localCtx = new HashMap<String, Object>();
            localCtx.put("@context", ctx);

            // TODO: How/when to do simplify vs compact?
View Full Code Here

Examples of com.github.jsonldjava.core.RDFDataset

        }
    }

    @Override
    public RDFDataset parse(Object input) throws JsonLdError {
        final RDFDataset result = new RDFDataset();

        // empty dataset if no input given
        if (input == null) {
            return result;
        }
View Full Code Here

Examples of com.github.jsonldjava.core.RDFDataset

        model.add(resource, property, "Test");

        final JsonLdOptions options = new JsonLdOptions();
        options.format = "application/ld+json";
        final JenaRDFParser parser = new JenaRDFParser();
        final RDFDataset dataset = parser.parse(model);
        final Object json = new JsonLdApi(options).fromRDF(dataset);
        final String jsonStr = JSONUtils.toPrettyString(json);
        // System.out.println(jsonStr);
        assertTrue(jsonStr.contains("@id"));
        assertTrue(jsonStr.contains("http://example.com/test"));
View Full Code Here

Examples of com.github.jsonldjava.core.RDFDataset

        model.add(resource, property, "Test");

        final JsonLdOptions options = new JsonLdOptions();
        options.format = "application/ld+json";
        final JsonLdApi api = new JsonLdApi(options);
        final RDFDataset dataset = new RDFDataset(api);
        final Object json = api.fromRDF(dataset);
        final String jsonStr = JSONUtils.toPrettyString(json);
        System.out.println(jsonStr);
        // [ {
        // "@id" : "http://example.com/test",
View Full Code Here

Examples of org.data2semantics.tools.rdf.RDFDataSet

  /**
   * @param args
   */
  public static void main(String[] args) {
    RDFDataSet testSetA = new RDFFileDataSet(DATA_DIR + "aifb-fixed_complete.rdf", RDFFormat.RDFXML);
    //RDFDataSet testSetB = new RDFFileDataSet(DATA_DIR + "aifb-fixed_no_schema.n3", RDFFormat.N3);

    List<LinkPredictionDataSetParameters> dataSetsParams = new ArrayList<LinkPredictionDataSetParameters>();
    List<String> bl = new ArrayList<String>();
    bl.add("http://swrc.ontoware.org/ontology#affiliation");
View Full Code Here

Examples of org.data2semantics.tools.rdf.RDFDataSet

    //---------


    // As one RDF graph dataset
    List<List<Statement>> rdfTriples2 = createMoleculeRDFGraphs(graphs, false);
    RDFDataSet ts = new RDFSingleDataSet();
    for (List<Statement> trips : rdfTriples2) {
      ts.addStatements(trips);
    }

    List<Resource> instances = new ArrayList<Resource>();

    List<Statement> stmts = ts.getStatementsFromStrings(null, RDF.TYPE.stringValue(), GraphUtils.NAMESPACE + "Molecule");
    for (Statement stmt : stmts) {
      instances.add(stmt.getSubject());
    }

    // Data graph
    DTGraph<String,String> sGraph = org.nodes.data.RDF.createDirectedGraph(ts.getStatements(null, null, null, false), null, null);

    //---------
    // Results Table
    ResultsTable resTable = new ResultsTable();
    resTable.setDigits(3);
View Full Code Here

Examples of org.data2semantics.tools.rdf.RDFDataSet

    //*/


    // As one RDF graph dataset
    List<List<Statement>> rdfTriples2 = createMoleculeRDFGraphs(graphs, false);
    RDFDataSet ts = new RDFSingleDataSet();
    for (List<Statement> trips : rdfTriples2) {
      ts.addStatements(trips);
    }

    List<Resource> instances = new ArrayList<Resource>();

    List<Statement> is = ts.getStatementsFromStrings(null, RDF.TYPE.stringValue(), GraphUtils.NAMESPACE + "Molecule");
    for (Statement stmt : is) {
      instances.add(stmt.getSubject());
    }


    DTGraph<String,String> sGraph = org.nodes.data.RDF.createDirectedGraph(ts.getStatements(null, null, null, false), null, null);
    List<DTNode<String,String>> hubs = SlashBurn.getHubs(sGraph, 2, true);
    // (int) Math.round(0.05 * sGraph.nodes().size())
   
 
    Comparator<Node<String>> comp2 = new DegreeComparator<String>();
View Full Code Here

Examples of org.data2semantics.tools.rdf.RDFDataSet

  private final static int NUMBER_OF_PROC = 6;



  public static void main(String[] args) {
    RDFDataSet testSetA = new RDFFileDataSet(DATA_DIR + "aifb-fixed_complete.rdf", RDFFormat.RDFXML);
    RDFDataSet testSetB = new RDFFileDataSet(DATA_DIR + "aifb-fixed_no_schema.n3", RDFFormat.N3);

    long[] seeds = {11,21,31,41,51,61,71,81,91,101};
    double[] cs = {0.001, 0.01, 0.1, 1, 10, 100, 1000}

    PropertyPredictionDataSet dataset;
View Full Code Here

Examples of org.data2semantics.tools.rdf.RDFDataSet

  public void test() {
    List<String> bl = new ArrayList<String>();
    bl.add("http://swrc.ontoware.org/ontology#affiliation");
    bl.add("http://swrc.ontoware.org/ontology#employs");
   
    RDFDataSet testSet = new RDFFileDataSet("D:\\workspaces\\datasets\\aifb\\aifb-fixed_complete.rdf", RDFFormat.RDFXML);
    LinkPredictionDataSet set = DataSetFactory.createLinkPredictonDataSet(testSet, "http://swrc.ontoware.org/ontology#Person", "http://swrc.ontoware.org/ontology#ResearchGroup", "http://swrc.ontoware.org/ontology#affiliation", bl, 2, false, false);
    System.out.println(set.getLabel());
    System.out.println(set.getLabels().size());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.